[Svnmerge] [PATCH] Performance patch for merging

Raman Gupta rocketraman at fastmail.fm
Tue Feb 28 20:42:41 PST 2006


The attached patch fixes a performance issue with the merge command. In
the current version, the merge command does not remove phantom revisions
from the list of revs that are used for 1) merging itself, and 2)
obtaining the log messages for each merged revision to build the commit
log message.

For the first use, there is no real difference to subtracting the
phantom revisions because the minimal_merge_intervals() method re-adds
the phantom revisions so that as few merge operations are executed as
possible. So the end result, after minimal_merge_intervals is called is
exactly the same.

For the second use, which is to obtain the log messages for each merged
revision, an "svn log" operation was executed for every phantom
revision, in addition to the real revisions. This can be a significant
source of wasted time and also results in empty lines in the final
commit message (at least it does if you have the indent patch).
Therefore, subtracting the phantom_revs from the revs list results in a
significantly faster merge operation when there are even just a few
phantom revs, because each svn log is a network operation.

Note that we still want the commit message to contain the consolidated
ranges (that include the phantom_revs), so revs | phantom_revs is used
for printing the merged ranges.

Here is a candidate commit log message:

Improved merge command performance by eliminating svn log operations on
phantom revisions.

Patch by: Raman Gupta <rocketraman at fastmail.fm>

* contrib/client-side/svnmerge.py
  (action_merge):
    Remove phantom_revs from the revs list used for getting the merge
      intervals, and obtaining logs for writing the commit log message.
      For the first use, this change has no detrimental effect, because
      the minimal_merge_intervals() function accounts for the phantom
      revisions. For the second use, this improves performance because
      now svnmerge does not execute an "svn log" for every phantom
      revision.
    Modified the range printing for the commit log message to re-add
      the phantom revs, so the range prints with the phantom revs,
      as is the current functionality.

Cheers,
Raman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge-ignore-phantom.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
Url : /pipermail/svnmerge/attachments/20060228/687262a1/attachment.bin 


More information about the Svnmerge mailing list