Detect if "svn up"/"git pull"/etc resulted in any actual code updates
See original issue https://bitbucket.org/reinout/checkoutmanager/issues/22/add-command-switch-to-check-if by @chintal
I'm limiting the original issue to this:
What I'd like is reliably detecting whether "checkoutmanager up" resulted in any actual code updates. Seems hard to me, as hg/git/svn/bzr regularly change their output format and return codes and so. And it sometimes also is language-dependent. So... Any good ideas are welcome.
Is depending on the output of git/hg/svn possible after all? We do run everything in verbose mode, so you could for instance detect changed filenames in the following git output:
Updating 16071cf..8948503
Fast-forward
zest/releaser/tests/functional-svn.txt | 2 +-
zest/releaser/tests/svn.txt | 2 +-
zest/releaser/tests/test_setup.py | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
From github.com:zestsoftware/zest.releaser
16071cf..8948503 master -> origin/master
Another idea could be to use some "watch" tool on the filesystem. We should exclude the .git/, .svn/ directories then. Or perhaps watch modification dates.
Only... I don't want the checkoutmanager code to become twice as big :-)
To be clear, though, I never wanted the list of the files changed. The output of svn up or git pull already provides that, which is what checkoutmanager writes out to stdout by itself.
My problem was that the output was effectively too verbose. A list of the repositories that got/have changes is useful to me, since there are some repositories that I care about which aren't changed often. Also, with all that text scrolling down, I often did not realize that there was a problem during the update.
The changes I wrote against 1.16 (https://bitbucket.org/chintal/checkoutmanager/branches/compare/chintal/checkoutmanager:tip%0Dreinout/checkoutmanager:1.16#diff) were to allow me to look only at a final summary of everything that happened.
I'd recommend not actually using that code, though, because :
- I haven't kept up with the changes in your repository since then. The code as written then got the job done for me, and it's been stable enough (with caveats) since then.
- It doesn't support anything other than SVN, simply because it isn't implemented for anything else. I'm now in a position where having it support git and perhaps even git-svn (which is probably ambitious) would be nice.
- I'm presently considering using it as a python module from within a larger application instead of as a standalone script.
Due to these reasons, I'm seriously thinking about starting from a fresh checkout of checkoutmanager and redoing it. If you have any notes about it, or desirable behaviour or such, I can take that into account if/when I get around to working on it again.
I've only had one functional problem with the code over the last couple of years (the caveat). SVN conflicts are unreported, or not reported loudly enough. On occasion, this has led to stale repositories left in the tree.
As an example, right now (not connected to the network which has the repositories), I see :
chintal@longclaw:~$ checkoutmanager up
------------------------------------------------------------
Collected Reports on 80 Repositories
None of the repositories could be updated
------------------------------------------------------------
chintal@longclaw:~$ checkoutmanager cu
------------------------------------------------------------
Collected Reports on 80 Repositories
None of the repositories could be checked for updates
------------------------------------------------------------
chintal@longclaw:~$
When I am connected to the network, I get one line per repository that got an update / has an update that can be pulled :
chintal@longclaw:~$ checkoutmanager cu
------------------------------------------------------------
Collected Reports on 80 Repositories
Out of 80 successful checks, 2 repositories have new remote revisions
/home/chintal/quazar/svn/QDA/DAU/QDAL412B/software : 111 (Local) vs 142 (Remote)
/home/chintal/quazar/svn/Stock : 203 (Local) vs 206 (Remote)
------------------------------------------------------------
chintal@longclaw:~$ checkoutmanager up
------------------------------------------------------------
Collected Reports on 80 Repositories
Out of 80 successful updates, 2 repositories had new remote revisions which have been pulled
/home/chintal/quazar/svn/QDA/DAU/QDAL412B/software : 111 (Local) to 142 (Remote)
/home/chintal/quazar/svn/Stock : 203 (Local) to 206 (Remote)
------------------------------------------------------------
chintal@longclaw:~$
See #14