Giovanni Bajo <rasky@develer.com> (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

r876592 | dustin | 2009-03-12 15:51:56 -0500 (Thu, 12 Mar 2009)

* contrib/client-side/svnmerge/svnmerge.py
  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 <jpschewe@mtu.net>
Review by: me


r872931 | dustin | 2008-09-02 12:07:08 -0500 (Tue, 02 Sep 2008)

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

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

Patch by: Simon Brunning <simon@brunningonline.net>
Reviewed by: Dustin J. Mitchell <dustin@zmanda.com>
             Giovanni Bajo <rasky@develer.com>


r870254 | rocketraman | 2008-04-02 08:39:25 -0500 (Wed, 02 Apr 2008)

svnmerge.py: Fix a problem occasionally causing conflicts in the integrated
property due to some revisions being treated by svnmerge.py as unicode
strings, and others as int's.

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

Found by: Horst Hermanns <h.hermanns@telekom.de>
Patch by: Horst Hermanns <h.hermanns@telekom.de>
          me
Review by: Giovanni Bajo <rasky@develer.com>


r869889 | rocketraman | 2008-03-09 16:06:52 -0500 (Sun, 09 Mar 2008)

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

* contrib/client-side/svnmerge.py: 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 svnmerge.py), 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 <laurent.petit@gmail.com>
Review by: Giovanni Bajo <rasky@develer.com>
Found by:  Hernán Martínez Foffani <hernan.martinez@ecc.es>


r867904 | rocketraman | 2007-11-15 10:31:00 -0600 (Thu, 15 Nov 2007)

* contrib/client-side/svnmerge/svnmerge.py
  (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
    slightly.

Patch by: anonymous
Review by: Giovanni Bajo <rasky@develer.com>
           Raman Gupta <rocketraman@fastmail.fm>


r867864 | giovannibajo | 2007-11-13 13:07:55 -0600 (Tue, 13 Nov 2007)

Fix an extra whitespace.

 * svnmerge.py (launchsvn): Remove extra whitespace.


r867422 | dustin | 2007-10-24 09:36:27 -0500 (Wed, 24 Oct 2007)

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

Patch by: Archie Cobbs <archie@dellroad.org>
Review by: Giovanni Bajo <rasky@develer.com>
           Jon Schewe <jpschewe@mtu.net>


r866957 | glasser | 2007-10-01 17:53:32 -0500 (Mon, 01 Oct 2007)

svnmerge.py: 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
svnmerge.py currently invokes do accept --non-interactive).

(Ideally, svnmerge.py 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/svnmerge.py
  (launchsvn): Pass --non-interactive to all svn commands.

Review by: giovannibajo
           dlr


r866107 | giovannibajo | 2007-08-10 13:54:14 -0500 (Fri, 10 Aug 2007)

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

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

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


r866106 | giovannibajo | 2007-08-10 13:34:45 -0500 (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.

* svnmerge.py
  (analyze_source_revs): Get latest rev of source_url.
  
Patch by: Dustin J. Mitchell <dustin@zmanda.com>  
Review by: Giovanni Bajo <rasky@develer.com>


r866105 | giovannibajo | 2007-08-10 13:31:26 -0500 (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().

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

* svnmerge_test.py
  (TestCase_SvnMerge.svnmerge2): empty the new cache.


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

Misc fixes: restore Python 2.0 compatibility and wrap text into 80 columns.

svnmerge_test.py
  (TestCase_TestRepo.command_dict): use dictionary literal (for 2.0)
  (TestCase_TestRepo.testUninit, TestCase_TestRepo.testUninitForce,
  TestCase_TestRepo.testInitScenarios,
  TestCase_TestRepo.testBidirectionalMerges,
  TestCase_TestRepo.testBidirectionalMergesMultiBranch,
  testMergeWithPotentialPropertyConflict): Avoid interspersed arguments,
    they are not supported by getopt in 2.0). Avoid assertTrue/assertFalse,
    they did not exist in 2.0.

  
svnmerge.py
  (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.


r865997 | dustin | 2007-08-01 15:41:12 -0500 (Wed, 01 Aug 2007)

* contrib/client-side/svnmerge/svnmerge.py
  (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/svnmerge_test.py
  (testBidirectionalMergesMultiBranch): test initialized revision detection
Patch by:  Rich Williams <perldog@gmail.com>
Patch by:  Michael Willmott <mwillmott@leadgenpro.co.uk>
Review by: Giovanni Bajo <rasky@develer.com>


r865947 | dustin | 2007-07-28 10:52:49 -0500 (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/svnmerge.py
  (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
    comments.

* contrib/client-side/svnmerge/svnmerge_test.py:
  (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 <lsuvkne@onemodel.org>
Review by: Dustin J. Mitchell <dustin@zmanda.com>
           Giovanni Bajo <rasky@develer.com>


r865946 | dustin | 2007-07-28 10:48:25 -0500 (Sat, 28 Jul 2007)

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

* contrib/client?side/svnmerge/svnmerge.py
  (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 <lacall186@onemodel.org>
Review by: Giovanni Bajo <rasky@develer.com>


r865945 | dustin | 2007-07-28 10:45:03 -0500 (Sat, 28 Jul 2007)

Clarify uses of xml.dom.

* contrib/client-side/svnmerge/svnmerge.py
  (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 <lacall186@onemodel.org>
Review by: Giovanni Bajo <rasky@develer.com>


r865893 | dustin | 2007-07-22 10:41:49 -0500 (Sun, 22 Jul 2007)

clearly differentiate urls, directories, and repo-relative paths

* svn/trunk/contrib/client-side/svnmerge/svnmerge.py
 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 <rasky@develer.com>


r865889 | dustin | 2007-07-21 22:10:58 -0500 (Sat, 21 Jul 2007)

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

Patch by:  Giovanni Bajo <rasky@develer.com>
Review by: Raman Gupta <rocketraman@fastmail.fm>
           Giovanni Bajo <rasky@develer.com>


r865888 | dustin | 2007-07-21 22:04:38 -0500 (Sat, 21 Jul 2007)

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

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

Patch by: Giovanni Bajo <rasky@develer.com> and Luke Call <lsuvkne@onemodel.org>
Review by: Giovanni Bajo <rasky@develer.com>


r865887 | dustin | 2007-07-21 22:00:25 -0500 (Sat, 21 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/svnmerge.py
  (launch):  Use subprocess module when possible for better performance.
* svnmerge/svnmerge_test.py
  (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 <lsuvkne@onemodel.org>
Review by: Dustin J. Mitchell <dustin@zmanda.com>
           Giovanni Bajo <rasky@develer.com>
(Dustin clarified comments; Dustin and Giovanni made helpful suggestions.)


r865886 | dustin | 2007-07-21 21:28:29 -0500 (Sat, 21 Jul 2007)

* contrib/client-side/svnmerge/svnmerge_test.py: 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 <rasky@develer.com>


r865758 | dustin | 2007-07-07 20:30:13 -0500 (Sat, 07 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/svnmerge.py:
  (action_merge): Move the commit log generation to the end of the
    method.

Patch by:  Raman Gupta <rocketraman@fastmail.fm>
Review by: Giovanni Bajo <rasky@develer.com>


r865757 | dustin | 2007-07-07 20:19:36 -0500 (Sat, 07 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/svnmerge_test.py 
  (testTransitiveMerge): test a transitive merge
* contrib/client-side/svnmerge.py:
  (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 <rocketraman@fastmail.fm>
           Dustin J. Mitchell <dustin@zmanda.com>
Review by: Giovanni Bajo <rasky@develer.com>


r865100 | giovannibajo | 2007-05-15 13:39:03 -0500 (Tue, 15 May 2007)

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

r863126 | dlr | 2007-01-16 17:37:56 -0600 (Tue, 16 Jan 2007)

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

As svnmerge.py runs only in clean working copies, the only possible
local modifications are those produed by svnmerge.py 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 <rasky@develer.com>
Subject: Re: [Svnmerge] Bugs when merging revisions that modify and deletefiles
Message-ID: <45A570B5.1040100@develer.com>


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

Patch by: Tilmann Singer <tils@tils.net>
(Tweaked by me.)
Reviewed by: giovannibajo
             archiecobbs


r861582 | rooneg | 2006-09-15 08:59:22 -0500 (Fri, 15 Sep 2006)

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

Suggested by: Giovanni Bajo <rasky@develer.com>

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


r860861 | blair | 2006-07-19 22:41:28 -0500 (Wed, 19 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 <rasky@develer.com>
          me

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


r859874 | djames | 2006-05-23 19:44:06 -0500 (Tue, 23 May 2006)

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

Patch by: Madan U Sreenivasan <madan@collab.net>

Review by: David James <djames@collab.net>
           Daniel Rall <dlr@collab.net>
           Giovanni Bajo <rasky@develer.com>

* contrib/client-side/svnmerge_test.py
  (TestCase_TestRepo.testRollbackWithoutInit):
  (TestCase_TestRepo.testRollbackOutsidePossibleRange):
  (TestCase_TestRepo.testRollbackWithoutRevisionOpt):
  (TestCase_TestRepo.testInitAndRollbackRecordOnly):
  (TestCase_TestRepo.testInitAndRollback):
  (TestCase_TestRepo.testMergeAndRollbackEmptyRevisionRange):
  (TestCase_TestRepo.testBlockMergeAndRollback):
  (TestCase_TestRepo.testMergeAndRollback):
  (TestCase_TestRepo.testBlockMergeAndRollback): New tests for rollback
   functionality.

* contrib/client-side/svnmerge.py
  (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'.



r859727 | giovannibajo | 2006-05-16 07:19:43 -0500 (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.

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

* svnmerge_test.py
  (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 <rocketraman@fastmail.fm>
Review by: Daniel Rall <dlr@collab.net>
           Madan U Sreenivasan <madan@collab.net>
           Giovanni Bajo <rasky@develer.com>


r859720 | giovannibajo | 2006-05-15 13:05:13 -0500 (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/svnmerge.py:
   (check_dir_clean): Do not check for pending updates.


r859705 | giovannibajo | 2006-05-12 12:18:19 -0500 (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/svnmerge.py:
   (get_default_head): Do not print the full URL, since the repository-relative
   path is accepted by the --head option.


r859704 | giovannibajo | 2006-05-12 12:10:59 -0500 (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: "svnmerge.py avail -S trunk".

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

 * contrib/client-side/svnmerge.py:
   (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/svnmerge_test.py:
   (TestCase_TestRepo.testBidirectionalMergesMultiBranch): Use substrings
   for head parameters so to check the new feature.


r859701 | giovannibajo | 2006-05-12 11:36:46 -0500 (Fri, 12 May 2006)

Document svnmerge.py requisites (SVN client/server 1.1).

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


r859700 | giovannibajo | 2006-05-12 11:33:18 -0500 (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/svnmerge.py:
   (get_copyfrom): Use re.escape to interpolate the path within the regular
   expression.


r859699 | giovannibajo | 2006-05-12 11:31:05 -0500 (Fri, 12 May 2006)

Speedup common paths in svnmerge.py using the Repository Root information
returned by "svn info" even on local paths since SVN 1.3.

svnmerge.py 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/svnmerge.py:
   (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.


r859698 | giovannibajo | 2006-05-12 11:11:06 -0500 (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/svnmerge_test.py:
   (abspath_to_url): New function.
   (TestCase_TestRepo.setUp): Use it.


r859655 | dlr | 2006-05-09 13:07:48 -0500 (Tue, 09 May 2006)

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

Found by: giovannibajo


r859412 | dlr | 2006-04-12 19:09:03 -0500 (Wed, 12 Apr 2006)

Make svnmerge.py's "multiple heads found" error message more
informative.

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

Patch by: Madan U S <madan@collab.net>
Review by: giovannibajo
           dlr
           djames


r859186 | dlr | 2006-03-31 12:33:54 -0600 (Fri, 31 Mar 2006)

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


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


Patch by: Madan U S <madan@collab.net>
(Tweaked by me.)

Review by: giovannibajo


r859142 | dlr | 2006-03-28 15:05:05 -0600 (Tue, 28 Mar 2006)

Remove svnmerge.py'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/svnmerge.py
  Throughout, replace "_" with "-" in the flag names "avail_showwhat",
  "avail_display", "dry_run", "show_changes", "commit_file",
  "record_only".

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


Review by: giovannibajo


r859125 | dlr | 2006-03-27 16:33:52 -0600 (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/svnmerge.py
  (action_merge): When the "--record-only" argument is specified,
   avoid executing the 'svn merge' command, and adjust output
   accordingly.

  (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/svnmerge_test.py
  (testMergeRecordOnly): New test method for 'svnmerge.py merge --record-only'.


Review by: djames
           giovannibajo


r858770 | djames | 2006-03-02 20:11:38 -0600 (Thu, 02 Mar 2006)

Simplify find_changes and analyze_revs.

* contrib/client-side/svnmerge.py
  (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



r858759 | giovannibajo | 2006-03-02 08:45:28 -0600 (Thu, 02 Mar 2006)

Patch by: Alan Barrett <apb@cequrux.com>
          Raman Gupta <rocketraman@fastmail.fm>
Reviewed by: Giovanni Bajo <rasky@develer.com>

* contrib/client-side/svnmerge.py
  (prefix_lines):
    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
    terminated.
  (construct_merged_log_message):
    Added indentation for each commit message. Added check for empty
    log messages, which should never happen but doesn't hurt.

* contrib/client-side/svnmerge_test.py
  (TestCase_PrefixLines.test_basic):
     New test for the prefix_lines functionality.



r858757 | giovannibajo | 2006-03-02 08:14:09 -0600 (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/svnmerge.py:
  (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.
	



r858688 | blair | 2006-02-24 16:49:13 -0600 (Fri, 24 Feb 2006)

When svnmerge.py 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 <rocketraman@fastmail.fm>
Reviewed by: Giovanni Bajo <rasky@develer.com>
(Tweaked by me.)

* contrib/client-side/svnmerge.py
  (analyze_revs):
    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
      revisions.
  (analyze_head_revs):
    Pass the target directory receiving the merges down to
      analyze_revs().
  (action_avail):
    Use the new returned RevisionSet from analyze_head_revs() to
      remove from the set of available revisions the reflected ones.
  (action_merge):
    Use the new returned RevisionSet from analyze_head_revs() to
      remove from the set of available revisions the reflected ones.
  (common_opts):
    Add a new -b and --bidirectional flag to this, which defaults to
      False.
  (command_table):
    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/svnmerge_test.py
  (TestCase_TestRepo.testBidirectionalMerges):
    New test method to check that reflected revisions are recognized
      properly for bidirectional merges.
  (TestCase_TestRepo.testBidirectionalMergesMultiBranch):
    New test method to check that merges from a second branch are not
      considered reflected for other branches.


r858669 | blair | 2006-02-23 18:53:14 -0600 (Thu, 23 Feb 2006)

Add utility functions to svnmerge.py'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 <rasky@develer.com>

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


r858649 | blair | 2006-02-23 12:28:17 -0600 (Thu, 23 Feb 2006)

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

Patch by: Giovanni Bajo <rasky@develer.com>
          Raman Gupta <rocketraman@fastmail.fm>
(Tweaked by me.)

* contrib/client-side/svnmerge_test.py
  (main):
    At script start time, always delete an existing template directory
      to force TestCase_TestRepo.setUp() to create a fresh template.
  (TestCase_SvnMerge.svnmerge2):
    Always clear svnmerge's internal cache before running svnmerge.
      This is needed for the bidirectional merge testing in a future
      patch.
  (TestCase_SvnMerge.setUp):
    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.
  (TestCase_TestRepo.testCheckInitializeEverything):
    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.


r858643 | blair | 2006-02-22 19:05:05 -0600 (Wed, 22 Feb 2006)

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

Patch by: Giovanni Bajo <rasky@develer.com>

* contrib/client-side/svnmerge_test.py:
  Contents copied from contrib/client-side/test_svnmerge.py.

* contrib/client-side/test_svnmerge.py:
  Delete.


r858419 | giovannibajo | 2006-02-04 12:12:32 -0600 (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/svnmerge.py:
  (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/svnmerge_test.py:
  (TestCase_TestRepo.testTrimmedAvailMerge): New test.


r858418 | giovannibajo | 2006-02-04 10:41:04 -0600 (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/svnmerge_test.py:
  (check_dir_clean): Robustify for blank lines.


r858417 | giovannibajo | 2006-02-04 10:31:24 -0600 (Sat, 04 Feb 2006)

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

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


r858416 | giovannibajo | 2006-02-04 10:24:26 -0600 (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/svnmerge_test.py:
  (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
  2.2).
  (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
  help.
  (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.
 


r858415 | giovannibajo | 2006-02-04 10:11:40 -0600 (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/svnmerge.py:
  (get_copyfrom): Make the regexp more strict.



r858087 | giovannibajo | 2006-01-07 11:36:59 -0600 (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
before.

* contrib/client-side/svnmerge.py:
  (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.


r858086 | giovannibajo | 2006-01-07 11:22:05 -0600 (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/svnmerge.py:
  (CommandOpts.__init__): Duplicate external data structures.
  (CommandOpts.__init__, CommandOpts._command): Avoid using 'key in dict'.


r858085 | giovannibajo | 2006-01-07 11:15:29 -0600 (Sat, 07 Jan 2006)

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

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


r858084 | giovannibajo | 2006-01-07 10:53:15 -0600 (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/svnmerge.py:
  (get_copyfrom): Improve error-recovery.


r858083 | giovannibajo | 2006-01-07 10:47:50 -0600 (Sat, 07 Jan 2006)

Do not be fooled by external directories in the tree.

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


r858082 | giovannibajo | 2006-01-07 10:43:05 -0600 (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/svnmerge.py:
  (console_width): Try parsing 'stty -a' output.


r858081 | giovannibajo | 2006-01-07 10:28:27 -0600 (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/svnmerge.py:
  (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.


r857214 | giovannibajo | 2005-11-01 14:31:26 -0600 (Tue, 01 Nov 2005)

Nominate r17139

r857213 | giovannibajo | 2005-11-01 14:27:46 -0600 (Tue, 01 Nov 2005)

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

* contrib/client-side/svnmerge.py:
  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/svnmerge_test.py:
  Add new command line coverage tests.


r857204 | giovannibajo | 2005-11-01 11:32:38 -0600 (Tue, 01 Nov 2005)

Nominate r17129

r857203 | giovannibajo | 2005-11-01 11:23:55 -0600 (Tue, 01 Nov 2005)

Remove bogus keyword expansion which was corrupting the tests.

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



r856934 | blair | 2005-10-20 13:58:08 -0500 (Thu, 20 Oct 2005)

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

Imported from svn://pyinstaller.hpcf.upr.edu/svnmerge/svnmerge.py
revision 180.

Patch by: Giovanni Bajo <rasky@develer.com>
Review by: me

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

* contrib/client-side/svnmerge.py:
  New file imported from
    svn://pyinstaller.hpcf.upr.edu/svnmerge/svnmerge.py revision 180.

* contrib/client-side/svnmerge_test.py:
  New file imported from
    svn://pyinstaller.hpcf.upr.edu/svnmerge/test_svnmerge.py revision
    180.  Note that I changed the name of the file.
  This tests the revision range and merge interval code.