As per my earlier suggestion, and conceptual +1's from Daniel and
Giovanni, I am submitting the following patch for review.
[[[
Eliminate need for --bidirectional flag. Detect sources that
have integration info for the target, and automatically enable
reflected rev detection in this case. The automatic detection is
skipped if --bidirectional is explicitly set.
* contrib/client-side/svnmerge.py: Update help for global options.
(should_find_reflected): New method to determine whether to find
reflected revs or not.
(action_avail),
(action_merge): Call should_find_reflected.
* contrib/client-side/svnmerge_test.py
(testBidirectionalMerges),
(testBidirectionalMergesMultiBranch): Test avail with and
without --bidirectional. Remove test for non-reflected default,
and test merges without --bidirectional.
Patch by: Raman Gupta <[EMAIL PROTECTED]>
Review by: ?
]]]
Cheers,
Raman Gupta
Index: svnmerge_test.py
===================================================================
--- svnmerge_test.py (revision 29395)
+++ svnmerge_test.py (working copy)
@@ -909,8 +909,8 @@
# test-branch was copied from trunk's r6. So non-phantom revs
# since that point should still be available to merge from
# trunk to test-branch:
- self.svnmerge("avail -vv --bidirectional", match=r"\n9-10,16$")
- self.svnmerge("merge -vv --bidirectional", match=r"svn --non-interactive merge --force -r 15:16")
+ self.svnmerge("avail -vv", match=r"\n9-10,16$")
+ self.svnmerge("merge -vv", match=r"svn --non-interactive merge --force -r 15:16")
p = self.getproperty()
self.assertEqual("/trunk:1-16", p)
self.svnmerge("integrated", match=r"^3-16$")
@@ -930,13 +930,13 @@
# Not using switch, so must update to get latest repository rev.
self.launch("svn update", match=r"At revision 18")
- # Ensure default is not to check for reflected revisions.
- self.svnmerge("avail -vv", match=r"\n17-18$")
-
- # Now check reflected revision is excluded with --bidirectional flag.
+ # Check reflected revision is excluded with --bidirectional
self.svnmerge("avail -vv --bidirectional", match=r"\n18$")
- self.svnmerge("merge -vv --bidirectional", match=r"svn --non-interactive merge --force -r 17:18")
+ # and without --bidirectional.
+ self.svnmerge("avail -vv", match=r"\n18$")
+
+ self.svnmerge("merge -vv", match=r"svn --non-interactive merge --force -r 17:18")
p = self.getproperty()
self.assertEqual("/branches/test-branch:1-18", p)
@@ -1018,13 +1018,16 @@
self.launch("svn update", match=r"At revision 20")
# Initialized revs should not be available for merge
- self.svnmerge("avail -v --bidirectional", match=r"initialized.*17-18")
+ self.svnmerge("avail -v", match=r"initialized.*17-18")
# Latest revision on trunk which was merged from test-branch2
# should be available for test-branch with --bidirectional flag.
self.svnmerge("avail -vv --bidirectional", match=r"merged are:\n20$")
- self.svnmerge("merge -vv --bidirectional", match=r"merge --force -r 19:20")
+ # and also without the --bidirectional flag.
+ self.svnmerge("avail -vv", match=r"merged are:\n20$")
+
+ self.svnmerge("merge -vv", match=r"merge --force -r 19:20")
p = self.getproperty()
self.assertEqual("/trunk:1-20", p)
Index: svnmerge.py
===================================================================
--- svnmerge.py (revision 29395)
+++ svnmerge.py (working copy)
@@ -1010,6 +1010,17 @@
(opts["prop"], format_merge_props(fixed), branch_target)
error(err_msg)
+def should_find_reflected(branch_dir):
+ should_find_reflected = opts["bidirectional"]
+
+ # If the source has integration info for the target, set find_reflected
+ # even if --bidirectional wasn't specified
+ if not should_find_reflected:
+ source_props = get_merge_props(opts["source-url"])
+ should_find_reflected = source_props.has_key(target_to_pathid(branch_dir))
+
+ return should_find_reflected
+
def analyze_revs(target_pathid, url, begin=1, end=None,
find_reflected=False):
"""For the source of the merges in the source URL being merged into
@@ -1221,7 +1232,8 @@
"""Show commits available for merges."""
source_revs, phantom_revs, reflected_revs, initialized_revs = \
analyze_source_revs(branch_dir, opts["source-url"],
- find_reflected=opts["bidirectional"])
+ find_reflected=
+ should_find_reflected(branch_dir))
report('skipping phantom revisions: %s' % phantom_revs)
if reflected_revs:
report('skipping reflected revisions: %s' % reflected_revs)
@@ -1281,7 +1293,8 @@
source_revs, phantom_revs, reflected_revs, initialized_revs = \
analyze_source_revs(branch_dir, opts["source-url"],
- find_reflected=opts["bidirectional"])
+ find_reflected=
+ should_find_reflected(branch_dir))
if opts["revision"]:
revs = RevisionSet(opts["revision"])
@@ -1846,7 +1859,8 @@
Option("-b", "--bidirectional",
value=True,
default=False,
- help="remove reflected and initialized revisions from merge candidates"),
+ help="remove reflected and initialized revisions from merge candidates. "
+ "Not required but may be specified to speed things up slightly"),
OptionArg("-f", "--commit-file", metavar="FILE",
default="svnmerge-commit-message.txt",
help="set the name of the file where the suggested log message "
@@ -1899,9 +1913,8 @@
forth and back: e.g., if you committed a merge of a certain
revision of the branch into the source, 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 not show these
- so-called "reflected" revisions if you specify the --bidirectional
- or -b command line option.""",
+ originated in the branch itself!). svnmerge will automatically
+ exclude these so-called "reflected" revisions.""",
[
Option("-A", "--all",
dest="avail-showwhat",
@@ -1976,9 +1989,8 @@
forth and back: e.g., if you committed a merge of a certain
revision of the branch into the source, 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 if you specify the --bidirectional
- or -b command line option.
+ originated in the branch itself!). svnmerge will automatically
+ exclude these so-called "reflected" revisions.
When manually merging changes across branches, --record-only can
be used to instruct %s that a manual merge of a certain revision
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge