Giovanni Bajo <> (giovannibajo)

Found Patch Review Suggested
r859655 r867864, r866107, r866105, r866101, r865889, r865100, r860861, r859720, r859705, r859704, r859701, r859700, r859699, r859698, r858757, r858669, r858649, r858643, r858419, r858418, r858417, r858416, r858415, r858087, r858086, r858085, r858084, r858083, r858082, r858081, r857214, r857213, r857204, r857203, r856934 r872931, r870254, r869889, r867904, r867422, r866957, r866106, r865997, r865947, r865946, r865945, r865893, r865889, r865888, r865887, r865886, r865758, r865757, r863126, r859874, r859727, r859412, r859186, r859142, r859125, r858759, r858688 r876592, r861582, r858770

r856934 | blair | 2005-10-20 18:58:08 +0000 (Thu, 20 Oct 2005)

Initial commit of the Python version of, primarily written
by Giovanni Bajo <> with contributions by John
Belmonte and myself, which is a much enhanced version of the Bourne
shell, primarily written by Archie Cobbs
<>.  There, got all my attributions right :)

Imported from svn://
revision 180.

Patch by: Giovanni Bajo <>
Review by: me

* contrib/client-side/svnmerge.README:
  Remove note that development is occurring at
  Set svn:keywords.

* contrib/client-side/
  New file imported from
    svn:// revision 180.

* contrib/client-side/
  New file imported from
    svn:// revision
    180.  Note that I changed the name of the file.
  This tests the revision range and merge interval code.

r857203 | giovannibajo | 2005-11-01 17:23:55 +0000 (Tue, 01 Nov 2005)

Remove bogus keyword expansion which was corrupting the tests.

* contrib/client-side/
  Remove svn:keyword property.
  Fix keywords in test code to match the expected results.

r857204 | giovannibajo | 2005-11-01 17:32:38 +0000 (Tue, 01 Nov 2005)

Nominate r17129

r857213 | giovannibajo | 2005-11-01 20:27:46 +0000 (Tue, 01 Nov 2005)

Two bugfixes in case of command line errors, and error message

* contrib/client-side/
  Update todo list.
  (OptionParser._add_builtins): Add -V alias for --version.
  (OptionParser._fancy_getopt): Remove dead code.
  (OptionParser.parse): Fix bug when no command is specified.  
  (OptionParser.error): Improve error message for wrong options
  without command.
  (main): Improve error message when there is no copy-from
  information. Fix variable name in internal assertion.

* contrib/client-side/
  Add new command line coverage tests.

r857214 | giovannibajo | 2005-11-01 20:31:26 +0000 (Tue, 01 Nov 2005)

Nominate r17139

r858081 | giovannibajo | 2006-01-07 16:28:27 +0000 (Sat, 07 Jan 2006)

Miscellanous fixes: word-wrap lines at 80th column, try and achieve
compatibility with older Python versions (2.0+).

* contrib/client-side/
  (console_width, get_default_head, action_avail, action_merge,
  CommandOpts.print_small_help, global_opts, common_opts, main): Word-wrap.
  (SRCREV, SRCDATE): Rename to...
  (__revision__, __date__): New.
  (action_avail): Avoid printing an empty list of revisions in verbose mode.
  (RevisionList.__nonzero__): Avoid 'bool'.
  (RevisionList.sorted): New.
  (RevisionList.normalized, RevisionList.__iter__): Use new sorted method.
  (construct_merged_log_message): Avoid using '__iter__' method.
  (get_svn_info): Avoid 'key in dict'.
  (OptBase.__init__, Option.__init__, OptionArg.__init__): Avoid 'key in
  dict' and 'dict.pop'.
  (CommandOpts.__init__): Avoid 'types.StringTypes'.
  (CommandOpts.print_command_help): Avoid nested scopes.

r858082 | giovannibajo | 2006-01-07 16:43:05 +0000 (Sat, 07 Jan 2006)

When trying to get the width of the console, also try parsing the output
of "stty -a" which usually contains this information.

* contrib/client-side/
  (console_width): Try parsing 'stty -a' output.

r858083 | giovannibajo | 2006-01-07 16:47:50 +0000 (Sat, 07 Jan 2006)

Do not be fooled by external directories in the tree.

* contrib/client-side/
  (check_dir_clean): Improve logic to find if the tree has local modifies.

r858084 | giovannibajo | 2006-01-07 16:53:15 +0000 (Sat, 07 Jan 2006)

Improve tree's copy-from revision extraction from "svn log --xml" output.
Avoid being fooled by copy-from information in single files.

* contrib/client-side/
  (get_copyfrom): Improve error-recovery.

r858085 | giovannibajo | 2006-01-07 17:15:29 +0000 (Sat, 07 Jan 2006)

Set properties using "-F" and a temporary file to avoid hitting command
line length limits.

* contrib/client-side/
  (_run_propset): New.
  (set_merge_props, set_blocked_revs): Use _run_propset.

r858086 | giovannibajo | 2006-01-07 17:22:05 +0000 (Sat, 07 Jan 2006)

Miscellaneous compatibility fixes. Allow running svnmerge.main multiple
times with a single import (will be useful for the testsuite).

* contrib/client-side/
  (CommandOpts.__init__): Duplicate external data structures.
  (CommandOpts.__init__, CommandOpts._command): Avoid using 'key in dict'.

r858087 | giovannibajo | 2006-01-07 17:36:59 +0000 (Sat, 07 Jan 2006)

Allow command line options to be specified in any order, even before the
command name. Eg. we now allow "svnmerge -r123 merge" which was forbidden

* contrib/client-side/
  (CommandOpts._fancy_getopt): Split out functionalities into...
  (CommandOpts._compute_flags): New.
  (CommandOpts._extract_command): New.
  (CommandOpts.parse): First extract command name, then validate the options.
  Rename "opts" to "state" for improved readability.

r858415 | giovannibajo | 2006-02-04 16:11:40 +0000 (Sat, 04 Feb 2006)

Fix the regular expression used to parse the XML produced by "svn log" to
extract the copy-from information: it was too broad and was allowing spurious
matches (eg. when used on the GCC repository).

* contrib/client-side/
  (get_copyfrom): Make the regexp more strict.

r858416 | giovannibajo | 2006-02-04 16:24:26 +0000 (Sat, 04 Feb 2006)

Import a new testsuite which does a complete check of svnmerge
functionalities. The previous testsuite was just unittesting small pieces of
code, while this new testsuite setups a test repository, actually performs
svnmerge operations in it, and check the results.
Moreover, the testsuite is now Python 2.0-friendly.

* contrib/client-side/
  (True,False): Define for compatibility if not defined already.
  (TestCase_kwextract.test_failure): Test also without space at the end of
  the string.
  (TestCase_RevisionList.test_iter): Disable if iter is not available (pre
  (TestCase_SvnMerge): New base classes for tests which need to call svnmerge.
  Also provide support for regexp matching on the generated output.
  (TestCase_CommandLineOptions.test_help_commands): Test more forms of the
  (TestCase_CommandLineOptions.test_version): Make it work on pre-2.2.
  (TestCase.testOptionOrder): New test, verify that options can be intermixed
  with positional arguments in any order.
  (temp_path, rmtree, template_path): New support functions.
  (TestCase_TestRepo): New complete testsuite, which setups a test repository
  and use it to test real svnmerge execution. The generated output is then
  tested to verify the functionalities.

r858417 | giovannibajo | 2006-02-04 16:31:24 +0000 (Sat, 04 Feb 2006)

Another small batch of compatibility fixes: after this, svnmerge is finally
fully compatible with Python 2.0.

* contrib/client-side/
  (_run_propset): Use open, not file
  (CommandOpts._fancy_getopt, CommandOpts.parse): Adjust for Python before 2.3
  which didn't have gnu_getopt.

r858418 | giovannibajo | 2006-02-04 16:41:04 +0000 (Sat, 04 Feb 2006)

Fix a problem when parsing the output of "svn status" in a working copy
with external directories: there are blank lines in the output which were
confusing the code.

* contrib/client-side/
  (check_dir_clean): Robustify for blank lines.

r858419 | giovannibajo | 2006-02-04 18:12:32 +0000 (Sat, 04 Feb 2006)

In avail and merge, trim the range of search for phantom revisions with the
command-line specified revision list. Before this patch, svnmerge was always
trying to look for phantom revisions in head up to HEAD (last revision in
repository), which was too much and slowed down simple operations (like
merging a single revision) too much.

* contrib/client-side/
  (analyze_revs): Avoid calling "svn log" at all if the range is empty.

  (analyze_head_revs): Trim range of "svn log" to range specified on the
   command line.

* contrib/client-side/
  (TestCase_TestRepo.testTrimmedAvailMerge): New test.

r858643 | blair | 2006-02-23 01:05:05 +0000 (Thu, 23 Feb 2006)

Forgot that I already added the file from Giovanni
Bajo's repository, I just renamed it to  However,
the new did have some changes, so copy its contents
into and then delete it.

Patch by: Giovanni Bajo <>

* contrib/client-side/
  Contents copied from contrib/client-side/

* contrib/client-side/

r858649 | blair | 2006-02-23 18:28:17 +0000 (Thu, 23 Feb 2006)

Fixes and improvements in's test suite to prepare for
bidirectional merge support.

Patch by: Giovanni Bajo <>
          Raman Gupta <>
(Tweaked by me.)

* contrib/client-side/
    At script start time, always delete an existing template directory
      to force TestCase_TestRepo.setUp() to create a fresh template.
    Always clear svnmerge's internal cache before running svnmerge.
      This is needed for the bidirectional merge testing in a future
    Add to the template repository another branch of trunk which is
      then immediately renamed.  The new branch is not used in any
      tests currently.  I'm adding it now so that the tests for the
      bidirectional merge support that checks the expected revision
      numbers will not have to be renumbered in the future.  This
      change is from r238 from Giovanni Bajo's repository.
    Update the expected result to take into account the two additional
      commits in the template repository.  This change is from r238
      from Giovanni Bajo's repository.

r858669 | blair | 2006-02-24 00:53:14 +0000 (Fri, 24 Feb 2006)

Add utility functions to's test suite to enable the
running of a single command and checking its output against regular
expressions.  The ability to check for the presence of or the lack of
presence text is available.

Code pulled from Giovanni Bajo's repository, revision 272.

Patch by: Giovanni Bajo <>

* contrib/client-side/
    New method to check the output of a command against regular
    New method to run a single command.  Uses _parseoutput().
    New method that applies a dictionary to the command string and
      then calls TestCase_SvnMerge.launch.

r858688 | blair | 2006-02-24 22:49:13 +0000 (Fri, 24 Feb 2006)

When is used to bidirectionally merge changes between a
branch and its head, it is necessary to not merge the same changes
forth and back: e.g., if you committed a merge of a certain revision
of the branch into the head, you do not want that commit to appear as
available to merged into the branch (as the code originated in the
branch itself!).  svnmerge can skip these so-called "reflected"
revisions with the new --bidirectional or -b command line option.

Patch by: Raman Gupta <>
Reviewed by: Giovanni Bajo <>
(Tweaked by me.)

* contrib/client-side/
    Take a new argument, the target directory receiving the merges.
    If the opts["bidirectional"] is True, then pass --verbose to 'svn
      log --quiet' to get a lit of all the changed paths in the head
      URL.  Look for any changed paths that exactly match the target
      directory and look for property changes on the directory in the
      svnmerge-integrated property for the target directory.
    Return an additional RevisionSet containing the reflected
    Pass the target directory receiving the merges down to
    Use the new returned RevisionSet from analyze_head_revs() to
      remove from the set of available revisions the reflected ones.
    Use the new returned RevisionSet from analyze_head_revs() to
      remove from the set of available revisions the reflected ones.
    Add a new -b and --bidirectional flag to this, which defaults to
    Add documentation about the bidirectional merge support to the
      'avail' and 'merge' commands.
    Enable the -b and --bidirectional command line options for the
      'avail' and 'merge' subcommands.

* contrib/client-side/
    New test method to check that reflected revisions are recognized
      properly for bidirectional merges.
    New test method to check that merges from a second branch are not
      considered reflected for other branches.

r858757 | giovannibajo | 2006-03-02 14:14:09 +0000 (Thu, 02 Mar 2006)

The global opts dictionary is a relic of the old svnmerge shell script. I'd
like it to go as it is bug-prone. For instance, analyze_revs should not use
opts["bidirectional"] as an implicit parameter, but just declare an explicit
additional parameter if it needs it.

* contrib/client-side/
  (analyze_revs): Do not use opts["bidirectional"] anymore. Accepts a new
      "find_reflected" parameter.
  (analyze_head_revs): Forward keyword arguments to analyze_revs.
  (action_avail, action_merge, action_block): Update accordingly.

r858759 | giovannibajo | 2006-03-02 14:45:28 +0000 (Thu, 02 Mar 2006)

Patch by: Alan Barrett <>
          Raman Gupta <>
Reviewed by: Giovanni Bajo <>

* contrib/client-side/
    New method to take a string and prepend each line of the string
    with a specified string. Lines are delimited by newline
    characters, and the entire string is asserted to be newline
    Added indentation for each commit message. Added check for empty
    log messages, which should never happen but doesn't hurt.

* contrib/client-side/
     New test for the prefix_lines functionality.

r858770 | djames | 2006-03-03 02:11:38 +0000 (Fri, 03 Mar 2006)

Simplify find_changes and analyze_revs.

* contrib/client-side/
  (find_changes): Rename show_merges parameter to find_merges. Move initialization of loop parameters
  closer to loop.
  (analyze_revs): Simplify calculation of reflected revisions.

Suggested by: giovannibajo

r859125 | dlr | 2006-03-27 22:33:52 +0000 (Mon, 27 Mar 2006)

Add the ability to mark revisions as merged via 'merge --record-only',
effectively a way to manipulate the merge memory stored in the
"svnmerge-integrated" property.  This is the converse of the 'block'
concept (which marks revisions which shouldn't be merged).

* contrib/client-side/
  (action_merge): When the "--record-only" argument is specified,
   avoid executing the 'svn merge' command, and adjust output

  (common_opts): Add a new "-M"/"--record-only" Option.

  (command_table): Add support for "--record-only" to "merge", and
   expand "merge" help to cover it, and "block" help to mention it.

* contrib/client-side/
  (testMergeRecordOnly): New test method for ' merge --record-only'.

Review by: djames

r859142 | dlr | 2006-03-28 21:05:05 +0000 (Tue, 28 Mar 2006)

Remove's undocumented long flag name processing behavior,
which was replacing embedded "-" characters with "_".  Giovanni Bajo
indicates that this was an artifact of some uncommitted code which
followed the idiom of the Python optparse module, which actually
creates an instance field on the options object
(e.g. "opts.flag_name"), as opposed to using a dictionary-like object
for the options (the current behavior).

(Subsequent commits r19072 and r19073 made the same naming convention
change for other elements in the "opts" dictionary.)

* contrib/client-side/
  Throughout, replace "_" with "-" in the flag names "avail_showwhat",
  "avail_display", "dry_run", "show_changes", "commit_file",

  (OptBase.__init__): Remove replace of "-" with "_" in long flag names.

Review by: giovannibajo

r859186 | dlr | 2006-03-31 18:33:54 +0000 (Fri, 31 Mar 2006)

Use's error() function for all its error handling.

* contrib/client-side/
  (global, main, check_old_prop_version): Replace code to print error
   message and exit with call to error().

Patch by: Madan U S <>
(Tweaked by me.)

Review by: giovannibajo

r859412 | dlr | 2006-04-13 00:09:03 +0000 (Thu, 13 Apr 2006)

Make's "multiple heads found" error message more

* contrib/client-side/
  (get_default_head): Change the error message printed when multiple
   source URLs are found by listing all available URLs.

Patch by: Madan U S <>
Review by: giovannibajo

r859655 | dlr | 2006-05-09 18:07:48 +0000 (Tue, 09 May 2006)

* subversion/svn/main.c
  (svn_cl__cmd_table): Document that 'info' and 'log' accept a peg rev.

Found by: giovannibajo

r859698 | giovannibajo | 2006-05-12 16:11:06 +0000 (Fri, 12 May 2006)

Fix computation of local URL (file://) from local path, under Windows. Given an
absolute path, it is not sufficient to replace backslashes with forward
slashes, as an absolute path under Windows does not start with any slash, but
rather the driver latter.

 * contrib/client-side/
   (abspath_to_url): New function.
   (TestCase_TestRepo.setUp): Use it.

r859699 | giovannibajo | 2006-05-12 16:31:05 +0000 (Fri, 12 May 2006)

Speedup common paths in using the Repository Root information
returned by "svn info" even on local paths since SVN 1.3. needs to compute the repository root several times. Right now
the flow of code is very contorted, and I plan to clean it up so that it
computes it once and reuse it everywhere (instead of relying on memoization).
Anyway, this path cleans up many paths of code so to request the repository
root through a local path when possible, so that it can be computed without
remote access.

 * contrib/client-side/
   (get_repo_root): Instead of converting immediately to URL, try running
   "svn info" on a local directory before, since it is faster.
   (url_to_rlpath): Rename to...
   (target_to_rlpath): New function. Accepts both an URL and a local directory,
   and convert it to repository-relative path. If a local directory is
   provided (and the client is at least 1.3), this can be done without any
   remote access.
   (RevisionLog.__init__, get_copyfrom, get_default_head, analyze_head_revs,
   main): Use target_to_rlpath, and provide a local directory instead of
   an URL when available.

r859700 | giovannibajo | 2006-05-12 16:33:18 +0000 (Fri, 12 May 2006)

Fix a bug with XML regexp parsing: the path information interpolated within
the regular expression must be correctly escaped.

 * contrib/client-side/
   (get_copyfrom): Use re.escape to interpolate the path within the regular

r859701 | giovannibajo | 2006-05-12 16:36:46 +0000 (Fri, 12 May 2006)

Document requisites (SVN client/server 1.1).

 * contrib/client-side/
   Document requisites in top comment.

r859704 | giovannibajo | 2006-05-12 17:10:59 +0000 (Fri, 12 May 2006)

Accept unambiguous substrings of a repository-relative path as head arguments.

When merging across multiple branches, it is often necessary to specify on
which of the multiple heads the operation must be performed (through
-S/--head). Until today, this parameter accepted either a working copy
directory or a full URL. This is unfortunate since the user really only wants
to specify one of a few possible heads.

This patch makes svnmerge accepts unambiguous substrings (of any length) of
one of the repository-relative paths recorded as head. For instance, it is
now possible to say: " avail -S trunk".

Notice that this does not help in the case of " init", because
you will probably need to specify a new head (as a full URL), not a previously
initialized one.

 * contrib/client-side/
   (main): Check if the head argument is a unambiguous substring of one the
   paths in the branch properties.
   (command_opts, OptionArg("-S")): modify the help string to specify that
   a substring is allowed.

 * contrib/client-side/
   (TestCase_TestRepo.testBidirectionalMergesMultiBranch): Use substrings
   for head parameters so to check the new feature.

r859705 | giovannibajo | 2006-05-12 17:18:19 +0000 (Fri, 12 May 2006)

After r19630, when no head is specified and multiple heads are found,
it is not necessary to print the full URLs in the error message: in fact,
the repository relative path (and any unambigous substring) can be specified.

 * contrib/client-side/
   (get_default_head): Do not print the full URL, since the repository-relative
   path is accepted by the --head option.

r859720 | giovannibajo | 2006-05-15 18:05:13 +0000 (Mon, 15 May 2006)

As discussed on the svnmerge mailing list, there is no actual reason to block
a merge just because there are pending updates on the repository. A merge
does not do any commit, it just modifies the working copy. And it is normal
to perform updates before committing. Also, the check is actually meaningless,
because by the time the merge is finished, it might well be that there are
new pending updates on the repository.

It makes sense, instead, to make sure the working copy is clean, so not to
mistakenly commit unrelated modifies together with a merge. This check can
be disabled with --force.

A nice side effect of this patch is that it speeds out merge operations as
one less server/client round-trip is required.

 * contrib/client-side/
   (check_dir_clean): Do not check for pending updates.

r859727 | giovannibajo | 2006-05-16 12:19:43 +0000 (Tue, 16 May 2006)

Add the uninit command, which removes merge tracking information for a given
head URL, including blocked revision information. This is especially useful
if multiple heads are being tracked -- without uninit, this situation requires
the new property value to be manually set by the user via svn propset.

* Added uninit to command table.
  (action_uninit): New method for uninitialization of merge tracking info.

  (TestCase_TestRepo.testUninit): New test case, checking that uninit works.
  (TestCase_TestRepo.testUninitForce): New test case.
  (TestCase_TestRepo.getproperty): Prevent array index errors when
    retrieving a property with no value.
  (TestCase_TestRepo.getBlockedProperty): New method to get the value
    of the svnmerge blocked property.

Patch by: Raman Gupta <>
Review by: Daniel Rall <>
           Madan U Sreenivasan <>
           Giovanni Bajo <>

r859874 | djames | 2006-05-24 00:44:06 +0000 (Wed, 24 May 2006)

Implement `svnmerge rollback'.
The `rollback' sub-command can be used to rollback previously integrated

Patch by: Madan U Sreenivasan <>

Review by: David James <>
           Daniel Rall <>
           Giovanni Bajo <>

* contrib/client-side/
  (TestCase_TestRepo.testBlockMergeAndRollback): New tests for rollback

* contrib/client-side/
  (warn): New function to print warning message to stdout.
  (action_rollback): New function. Used to rollback the merges between
   the given revision numbers.
  (command_table): New entry for `rollback'.

r860861 | blair | 2006-07-20 03:41:28 +0000 (Thu, 20 Jul 2006)

Strip leading and trailing whitespace from property names and values
after splitting on ; and =.  Use String.split() instead of regular
expressions to remove the leading and trailing whitespace since it is
faster and easier to read.

Patch by: Giovanni Bajo <>

* contrib/client-side/
  Update copyright year.
    Remove these constants as String.split() does the job.
    Use String.strip() on all strings after splitting on ; and =.

r861582 | rooneg | 2006-09-15 13:59:22 +0000 (Fri, 15 Sep 2006)

Remove note about lack of Python 2.4 bindings for Windows, as we have
some now.

Suggested by: Giovanni Bajo <>

* www/project_packages.html: Remove python 2.4 on windows note.

r863126 | dlr | 2007-01-16 23:37:56 +0000 (Tue, 16 Jan 2007)

Make multiple invocations of 'svn merge' from an invocation of
' merge' behave like the combined merge in cases where an
'svn merge' produces a local modifications which interfere with a
subsequent 'svn merge'.

As runs only in clean working copies, the only possible
local modifications are those produed by itself: here we
*REALLY* want --force.  See the following message and surrounding
email thread:

Date: Thu, 11 Jan 2007 00:03:17 +0100
From: Giovanni Bajo <>
Subject: Re: [Svnmerge] Bugs when merging revisions that modify and deletefiles
Message-ID: <>

* contrib/client-side/
  (action_merge, action_rollback): Add the --force to invocation of
   the Subversion command-line binary's 'merge' command.

Patch by: Tilmann Singer <>
(Tweaked by me.)
Reviewed by: giovannibajo

r865100 | giovannibajo | 2007-05-15 18:39:03 +0000 (Tue, 15 May 2007)

* STATUS: add +0 for backport of fix for Issue 2689

r865757 | dustin | 2007-07-08 01:19:36 +0000 (Sun, 08 Jul 2007)

Prevent spurious conflicts on the merge and blocked property
when the source branch contains merge property information for
other branches i.e. a transitive merge A -> B -> C is executed.
Previously, this caused a property conflict because the initial
value on the source branch did not match the initial value on
the target branch.

This patch also prevents extra merge property information from
uninitialized branches being merged into the target. If merging
to those other branches was never initialized on the target by
the user, then the user probably does not expect to see that
information. Note that if that information *was* initialized by
the user, then the user is attempting to do graph-based merging
i.e. A -> B -> C -> A which is currently unsupported.

* contrib/client-side/ 
  (testTransitiveMerge): test a transitive merge
* contrib/client-side/
  (action_merge): Before each merge, clear the integrated/blocked
    properties. Reset these properties to known values after the
    merge is complete.

Patch by:  Raman Gupta <>
           Dustin J. Mitchell <>
Review by: Giovanni Bajo <>

r865758 | dustin | 2007-07-08 01:30:13 +0000 (Sun, 08 Jul 2007)

Move the post-merge merge_props and blocked_props update to *before*
the generation of the commit message. This allows a CTRL+C interrupt
to break the generation of the commit message, without leaving the
working copy in an inconsistent state. Requested by Giovanni Bajo.

* contrib/client-side/
  (action_merge): Move the commit log generation to the end of the

Patch by:  Raman Gupta <>
Review by: Giovanni Bajo <>

r865886 | dustin | 2007-07-22 02:28:29 +0000 (Sun, 22 Jul 2007)

* contrib/client-side/svnmerge/ fix testUninit,
  testBidirectionalMerges, and testBidirectionalMergesMultiBranches,
  which began failing in r22788, by forcing revisions at 'init' time
  and ignoring '--force' in the 'svn merge' commands generated by
  'svnmerge merge'.

Review by: Giovanni Bajo <>

r865887 | dustin | 2007-07-22 03:00:25 +0000 (Sun, 22 Jul 2007)

Uses new subprocess module for in launch(), when python version allows, for a 
big performance benefit on some operating systems.  Faster because doesn't 
try to close all (unused) file descriptors. 

* svnmerge/
  (launch):  Use subprocess module when possible for better performance.
* svnmerge/
  (multilaunch):  No longer passing empty cmd strings.
  (testBlockMergeAndRollback, testMergeAndRollbackEmptyRevisionRange,
  testMergeAndRollback, testMergeWithPotentialPropertyConflict): Change
  quoting of log comment arguments for windows command parser, so they
  are kept together.

Patch by: Luke Call <>
Review by: Dustin J. Mitchell <>
           Giovanni Bajo <>
(Dustin clarified comments; Dustin and Giovanni made helpful suggestions.)

r865888 | dustin | 2007-07-22 03:04:38 +0000 (Sun, 22 Jul 2007)

No logic change; a cleanup to use xml instead of regular expression

* contrib/client-side/svnmerge/
  (SvnLogParser):  New class.
  (get_copyfrom):  Use xml instead of regular expression to
  parse information from logs.

Patch by: Giovanni Bajo <> and Luke Call <>
Review by: Giovanni Bajo <>

r865889 | dustin | 2007-07-22 03:10:58 +0000 (Sun, 22 Jul 2007)

* contrib/client-side/svnmerge/
  (block_metadata): New function
  (analyze_revs): Consider changes to blocked-prop as reflected revisions.

Patch by:  Giovanni Bajo <>
Review by: Raman Gupta <>
           Giovanni Bajo <>

r865893 | dustin | 2007-07-22 15:41:49 +0000 (Sun, 22 Jul 2007)

clearly differentiate urls, directories, and repo-relative paths

* svn/trunk/contrib/client-side/svnmerge/
 fix comments, variable names for urls, directories, and
 "repostitory-relative paths" to be more explicit and call the
 repo-relative paths "path identifiers"

Reviewed by: Giovanni Bajo <>

r865945 | dustin | 2007-07-28 15:45:03 +0000 (Sat, 28 Jul 2007)

Clarify uses of xml.dom.

* contrib/client-side/svnmerge/
  (getAttributeOrNone): New function.
  (SvnLogParser): provide more informative error message if expected name is
    not found.
  (SvnLogRevision): call getAttributeOrNone instead of
    xml.dom.Element.getAttribute directly, to integrate more cleanly with
    get_copyfrom() by returning None instead of an empty string.

Patch by: Luke Call <>
Review by: Giovanni Bajo <>

r865946 | dustin | 2007-07-28 15:48:25 +0000 (Sat, 28 Jul 2007)

Clarify action_init by changing nomenclature from "branch" to "target".

* contrib/client?side/svnmerge/
  (action_init): changing nomenclature from "branch" to "target",
    since the merge target could be either a trunk or a branch.  This
    helps prepare for a subsequent patch that corrects & adds logic to
    this function and uses the term "target" consistently.

Patch by:  Luke Call <>
Review by: Giovanni Bajo <>

r865947 | dustin | 2007-07-28 15:52:49 +0000 (Sat, 28 Jul 2007)

Finish work begun by r22788, to improve default revision range set by "svnmerge
init" if none provided by user, for scenario where merge source is a copy of
the merge target (i.e., merging from branch back to trunk) or vice-versa.

* contrib/client-side/svnmerge/
  (get_copyfrom): Add copy_committed_in_rev to returned values; add comments.
  (action_init): Use copy_committed_in_rev from get_copyfrom call for 
    correct conditional default revision range; added logic to auto-calculate 
    revision range depending on merge source and target copy relationship; add

* contrib/client-side/svnmerge/
  (testUninitForce): Change test so does not depend on specific initialized
    revision number, as that is not the point of the test and this is
    now handled in testInitScenarios.  This was broken by the other
    changes, thus fixed here.
  (testInitScenarios): Added function to test how action_init behaves in 
    different circumstances.
  (testCheckInitializeEverything): Removed (now redundant, and not testing for 
    the right behavior).
  (testBidirectionalMerges):  Changed to pass with newly correct init behavior.

Patch by:  Luke Call <>
Review by: Dustin J. Mitchell <>
           Giovanni Bajo <>

r865997 | dustin | 2007-08-01 20:41:12 +0000 (Wed, 01 Aug 2007)

* contrib/client-side/svnmerge/
  (initialized_revs): New function
  (analyze_revs, action_avail, action_merge, action_block): Exclude
    initialized revisions when considering candidates, if
    --bidirectional is specified
* contrib/client-side/svnmerge/
  (testBidirectionalMergesMultiBranch): test initialized revision detection
Patch by:  Rich Williams <>
Patch by:  Michael Willmott <>
Review by: Giovanni Bajo <>

r866101 | giovannibajo | 2007-08-10 13:13:48 +0000 (Fri, 10 Aug 2007)

Misc fixes: restore Python 2.0 compatibility and wrap text into 80 columns.
  (TestCase_TestRepo.command_dict): use dictionary literal (for 2.0)
  (TestCase_TestRepo.testUninit, TestCase_TestRepo.testUninitForce,
  testMergeWithPotentialPropertyConflict): Avoid interspersed arguments,
    they are not supported by getopt in 2.0). Avoid assertTrue/assertFalse,
    they did not exist in 2.0.
  (SvnLogParser): Add docstring.
  (SvnLogParser.SvnLogRevision, SvnLogParser.SvnLogRevision.SvnLogPath):
    Rename self._node into self.n. Avoid using getAttributeOrNone(), which
    relied on hasAttribute() not present in 2.0. For optional attributes,
    use a try/except block.
  (SvnLogParser.SvnLogRevision.paths): Use list comprehension.
  (getAttributeOrNone): Remove.

r866105 | giovannibajo | 2007-08-10 18:31:26 +0000 (Fri, 10 Aug 2007)

Improve performance by avoiding redundant server round-trips when
using -S.

This patch introduces an internal cache in get_repo_root() which
allows the function to automatically detect if a given URL is part
of an already analyzed repository without doing a server roundtrip.

Since I was at it, I also removed a useless global declaration for
the other similar cache used by get_svninfo().

  (get_svninfo): Remove global declaration.
  (get_repo_root): Update and use the new _cache_reporoot,
    storing repository roots that were already found.

  (TestCase_SvnMerge.svnmerge2): empty the new cache.

r866106 | giovannibajo | 2007-08-10 18:34:45 +0000 (Fri, 10 Aug 2007)

analyze_source_revs() gets the latest revision of the *branch*
repository, then proceeds to use that value against the *source*
repository; it should get the latest revision of the *source*.

This of course is not a bug in the common scenario of merges
within the same repository, but it is blocking our way to
inter-repository merges.

  (analyze_source_revs): Get latest rev of source_url.
Patch by: Dustin J. Mitchell <>  
Review by: Giovanni Bajo <>

r866107 | giovannibajo | 2007-08-10 18:54:14 +0000 (Fri, 10 Aug 2007)

Rewrite the constructor of RevisionLog to use the new SvnLogParser
(parsing the XML), instead of screenscaping the output with regular

Also, fix a typo in a codepath which is currently unused.

  (RevisionLog.__init__): Use SvnLogParser to parse the log.

r866957 | glasser | 2007-10-01 22:53:32 +0000 (Mon, 01 Oct 2007) Because 'svn merge' in 1.5 can trigger interactive
conflict resolution, pass --non-interactive to it.  For good measure,
pass --non-interactive to *all* svn invocations (all commands that currently invokes do accept --non-interactive).

(Ideally, should invoke svn in such a way that the user
could actually interact with the interaction prompt; this patch at
least prevents the script from hanging.)

* contrib/client-side/svnmerge/
  (launchsvn): Pass --non-interactive to all svn commands.

Review by: giovannibajo

r867422 | dustin | 2007-10-24 14:36:27 +0000 (Wed, 24 Oct 2007)

* contrib/client-side/svnmerge/
  (display_revisions, command_table): add '--summarize' option,
   pass it to 'svn diff'.

Patch by: Archie Cobbs <>
Review by: Giovanni Bajo <>
           Jon Schewe <>

r867864 | giovannibajo | 2007-11-13 19:07:55 +0000 (Tue, 13 Nov 2007)

Fix an extra whitespace.

 * (launchsvn): Remove extra whitespace.

r867904 | rocketraman | 2007-11-15 16:31:00 +0000 (Thu, 15 Nov 2007)

* contrib/client-side/svnmerge/
  (VersionedProperty.load): While looping through the revisions in which
    there are property changes, properly cache the old value for the
    next loop. Not a correctness issue, buy may improve performance

Patch by: anonymous
Review by: Giovanni Bajo <>
           Raman Gupta <>

r869889 | rocketraman | 2008-03-09 21:06:52 +0000 (Sun, 09 Mar 2008)

Fix regression error in r29666 for non-english locales that was causing a 
KeyError when commands were executed, since the output of svn 
info was non-english and therefore non-parseable.

* contrib/client-side/ Set the environment in which the script
    operates to set LC_MESSAGES = C (to force svn messages, such as those
    for svn info to be in english, and thus parseable by, while
    also removing any pre-existing setting for LC_ALL (since setting LC_ALL 
    to C causes log output to not be internationalized).

Patch by:  me
           Laurent Petit <>
Review by: Giovanni Bajo <>
Found by:  Hernán Martínez Foffani <>

r870254 | rocketraman | 2008-04-02 13:39:25 +0000 (Wed, 02 Apr 2008) Fix a problem occasionally causing conflicts in the integrated
property due to some revisions being treated by as unicode
strings, and others as int's.

* contrib/client-side/svnmerge/
  (SvnLogParser): Always return revisions as ints.
  (action_init): Cast revision to str before concatenation.

Found by: Horst Hermanns <>
Patch by: Horst Hermanns <>
Review by: Giovanni Bajo <>

r872931 | dustin | 2008-09-02 17:07:08 +0000 (Tue, 02 Sep 2008)

Fix svnmerge to run when input is not from a tty.

* contrib/client-side/svnmerge/
  (console_width): Condition on isatty().

Patch by: Simon Brunning <>
Reviewed by: Dustin J. Mitchell <>
             Giovanni Bajo <>

r876592 | dustin | 2009-03-12 20:51:56 +0000 (Thu, 12 Mar 2009)

* contrib/client-side/svnmerge/
  move import of popen2 to the version of launch() used when subprocess
  is not available, since popen2 is deprecated in Python-2.6

Suggested by: giovannibajo
Patch by: Jon Schewe <>
Review by: me