Hello!
Here is what the patch look like now with some of the changes suggested
by Madan.
:.:: mattias
Index: svnmerge_test.py
===================================================================
--- svnmerge_test.py (revision 19649)
+++ svnmerge_test.py (working copy)
@@ -475,6 +475,23 @@
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"is not a subversion working directory")
+ self.svnmerge("block " + url, error=True, \
+ match=r"is not a subversion working directory")
+ self.svnmerge("unblock " + url, error=True, \
+ match=r"is not a subversion working directory")
+
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 19649)
+++ svnmerge.py (working copy)
@@ -248,7 +248,7 @@
print out
def check_dir_clean(dir):
- """Check the current status of dir for local mods."""
+ """Check the current status of dir for up-to-dateness and local mods."""
if opts["force"]:
report('skipping status check because of --force')
return
@@ -261,6 +261,9 @@
out = launchsvn("status -q %s" % dir)
if out and out[0].strip():
error('"%s" has local modifications; it must be clean' % dir)
+ for L in launchsvn("status -u %s" % dir):
+ if len(L) > 7 and L[7] == '*':
+ error('"%s" is not up to date; please "svn update" first' % dir)
class RevisionLog:
"""
@@ -1276,7 +1279,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):
@@ -1313,6 +1317,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):
@@ -1549,6 +1554,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
]),
@@ -1567,6 +1573,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",
@@ -1597,6 +1604,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",
@@ -1631,6 +1639,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
]),
@@ -1645,6 +1654,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
]),
@@ -1653,6 +1663,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
]),
@@ -1692,7 +1703,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
Sub-commands avail and integrated now accept either URL or
working-copy path as argument.
* contrib/client-side/svnmerge.py:
(CommandOpts#__init__): Accepts an extra argument indicating if this
command accepts an URL as argument. This argument is assigned to
self.accepts_url.
(CommandOpts#_add_builtins): When command help is added to the command
table we need to also provide an "accepts url" flag in the tuple.
(command_table): New flag added to the tuple describing the commands. This
flag is set to True if the command accepts a URL as argument.
(main): Change in validating the branch_dir. If cmd.accepts_url is true
then a URL is also accepted as a branch_dir.
* contrib/client-side/svnmerge_test.py:
(TestCase_TestRepo#testAcceptsURL)Added test case for this feature.
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge