[Svnmerge] [PATCH] fix for rev printing bug in svn status

lsuvkne at onemodel.org lsuvkne at onemodel.org
Tue Jun 19 15:15:55 PDT 2007


Hi. I'm presenting the patch to this list for feedback, before deciding if I 
should send it on to the subversion dev list.

I've updated svnmerge.py and svnmerge_test.py with a workaround to handle at
least some variants of the lack of atomic renames (bug #898; much detail
linked from here: 
http://subversion.tigris.org/servlets/ReadMsg?listName=dev&msgNo=127146): 
these changes to svnmerge.py cause it to notice when a rename is being merged
in, capture historical changes in local files that would be lost, and after
the merge (i.e., after the overwriting copy) to reapply those changes,
including adding the otherwise lost log messages to the file
svnmerge-commit-message.txt. I also made some changes so the regression tests
would pass on Windows (XP).

It's not perfect, needing refactoring, style uniformity, more tests, 
and other things, but I think this is far better than without it.  
I may or may not have time to make the other improvements that I'd like. 
Close review would be good.  We have started using this internally.

Some key things to know:  It requires at least Python 2.4.  This is
because in order to fix a performance problem (severe on Suse 10.0--1 min to
run a merge vs. 1 second after the fix), I had to switch from using popen to
the subprocess module.  It also requires that a gnu patch utility be
installed, and provides a helpful error message when someone does not have it
installed (tailored for Windows users; I don't know how it would work out,
outside of windows or *nix).  My invocation of patch uses the gnu syntax; I
suppose it could be changed to POSIX if that's important.

There are 3 tests that fail, but they seem to also have been failing in the
version currently in trunk, and I didn't address them.

I'm new to python, and any/all corrections are welcome.

It intentionally does not support the -F (--force) switch, and perhaps should
emit a big warning when you use that (because several times during coding I
thought "uh-oh, I see a problem...wait that's won't happen because you have to
have a clean local sandbox first"--and later I realized the -F/--force switch
could override that behavior that saved me, but unfortunately I don't remember
what those concerns were).

There are a few other known things it does not support, some best practices
given the new behavior, and also miscellaneous tips that I can provide, if
there is interest.  Personally now, I wouldn't want to do a merge without it. 
(I looked at SVK, but ran into problems, and it seems that it would require
our developers to discard all other subversion clients, even for non-merge
work.)  One of things my svnmerge.py changes don't address is a related issue
that I'll call the "update problem": if Bob edits a file, and Nancy renames
the file on the same branch and checks in, then Bob does an update before
checking in, he loses his changes and might not notice, unless he always
checks for files not under version control (question marks in svn status), and
knows what to do about them; there is a more apparent but still unfriendly
issue if Bob had checked in his changes first and Nancy did an update (it
can't find the file to update).  But while there are merge scenarios that this
patch to svnmerge.py doesn't address, it DOES address some basic cases, such
as where Bob renames files or directories on a branch, Nancy modifies those
files on another branch then merges in Bob's renames--it will prevent loss of
Nancy's changes and the attendant comments.


[[[
Workarounds to issue #898: many changes to preserve file modifications and comments across merging in of files renamed on another branch.

* contrib/client-side/svnmerge/svnmerge.py
* contrib/client-side/svnmerge/svnmerge_test.py
]]]

Thanks,
-Luke Call
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: svnmerge_test.py-patch.txt
URL: </pipermail/svnmerge/attachments/20070619/f602f709/attachment-0004.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: svnmerge.py-patch.txt
URL: </pipermail/svnmerge/attachments/20070619/f602f709/attachment-0005.txt>


More information about the Svnmerge mailing list