Giovanni Bajo wrote:
Mattias Brändström wrote:
I have written a small patch that makes avail and integrated accept a
URL as their PATH argument. No test case yet. I just wanted to show
the
patch early so that I might get some comments on the small changes it
introduces. I took Giovanni's advice and made the ability to accept
an
URL as PATH argument a flag in the command table.
Thanks.
Please put a comment on each line containing True/False in the options, so
that we know what the boolean flag means. It's not immediately obvious which
stands for "accepts URL". Another solution is to change it to a
whitespace-separated string, so that it is self-descriptive and allows other
variations in the future (eg: "WC", "WC URL"", "URL").
Ok. Here is my patch and a test case for it. I did not change the flag
to a string, I think it will be easy enough to change that if it is
needed in the future.
:.:: mattias
Index: svnmerge_test.py
===================================================================
--- svnmerge_test.py (revision 19623)
+++ svnmerge_test.py (working copy)
@@ -468,6 +468,20 @@
self.svnmerge("block", error=True, match=r"working dir")
self.svnmerge("unblock", error=True, match=r"working dir")
+ def testAcceptsURL(self):
+ url = self.test_repo_url + "/branches/test-branch"
+ self.svnmerge("init")
+ self.launch("svn commit -F svnmerge-commit-message.txt",
+ match=r"Committed revision")
+ self.svnmerge("avail", error=False, match=r"^9-10$")
+ self.svnmerge("avail " + url, error=False, match=r"^9-10$")
+ self.svnmerge("integrated", error=False, match=r"^3-6$")
+ self.svnmerge("integrated " + url, error=False, match=r"^3-6$")
+
+ self.svnmerge("merge " + url, error=True, match=r"working dir")
+ self.svnmerge("block " + url, error=True, match=r"working dir")
+ self.svnmerge("unblock " + url, error=True, match=r"working dir")
+
def testCheckNoIntegrationInfo(self):
self.svnmerge("avail", error=True, match=r"no integration")
self.svnmerge("integrated", error=True, match=r"no integration")
Index: svnmerge.py
===================================================================
--- svnmerge.py (revision 19623)
+++ svnmerge.py (working copy)
@@ -1262,7 +1262,8 @@
class CommandOpts:
class Cmd:
def __init__(self, *args):
- self.name, self.func, self.usage, self.help, self.opts = args
+ self.name, self.func, self.usage, self.help, self.accepts_url, \
+ self.opts = args
def short_help(self):
return self.help.split(".")[0]
def __str__(self):
@@ -1299,6 +1300,7 @@
"help [COMMAND]",
"Display help for a specific command. If COMMAND is omitted, "
"display brief command description.",
+ False,
[])
def _cmd_help(self, cmd=None, *args):
@@ -1533,6 +1535,7 @@
current working directory (searching back for the branch point); in this
case, %s assumes that no revision has been integrated yet since
the branch point (unless you teach it with --revision).""" % NAME,
+ False, # n/a (Does not accept URL)
[
"-f", "-r", # import common opts
]),
@@ -1551,6 +1554,7 @@
originated in the branch itself!). svnmerge can not show these
so-called "reflected" revisions if you specify the --bidirectional
or -b command line option.""",
+ True, # Accepts URL and WC
[
Option("-A", "--all",
dest="avail-showwhat",
@@ -1581,6 +1585,7 @@
"""Show merged revisions available for PATH as a revision list.
If --revision is given, the revisions shown will be limited to
those also specified in the option.""",
+ True, # Accepts URL and WC
[
Option("-d", "--diff",
dest="integrated-display",
@@ -1615,6 +1620,7 @@
already happened, so that it can record it and not offer that
revision for merge anymore. Conversely, when there are revisions
which should not be merged, use '%s block'.""" % (NAME, NAME),
+ False, # Only accepts WC
[
"-b", "-f", "-r", "-S", "-M", # import common opts
]),
@@ -1629,6 +1635,7 @@
into the branch. Instead, use '%s merge --record-only', which
records that a merge happened (as opposed to a merge which should
not happen).""" % NAME,
+ False, # Only accepts WC
[
"-f", "-r", "-S", # import common opts
]),
@@ -1637,6 +1644,7 @@
"unblock [OPTION...] [PATH]",
"""Revert the effect of '%s block'. If --revision is omitted, all the
blocked revisions are unblocked""" % NAME,
+ False, # Only accepts WC
[
"-f", "-r", "-S", # import common opts
]),
@@ -1676,7 +1684,9 @@
assert False, "command not handled: %s" % cmd
# Validate branch_dir
- if not is_wc(branch_dir):
+ if cmd.accepts_url and not (is_url(branch_dir) or is_wc(branch_dir)):
+ error('"%s" is not a subversion working directory or URL' % branch_dir)
+ elif not cmd.accepts_url and not is_wc(branch_dir):
error('"%s" is not a subversion working directory' % branch_dir)
# Extract the integration info for the branch_dir
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge