Dustin J. Mitchell wrote:
My understanding is that for a merge, you absolutely need a working copy
because you need to queue up the different SVN operations involved in the
merge. If you didn't, then you would have to make non-atomic commits of the
property changes separate from checking in the actual file changes.

But none of those changes happen in the branch_dir -- they all happen
in the current ("trunk") directory.

Right?  I know I'm still missing something.

Um... have you got things backwards? The first argument in all but the init directory refers to the branch directory, i.e. branch_dir.

That means something like:

svn merge http://dev.dummy/repos/someapp/branches/1.x

would not be able to make the modifications it needs.

Your new patch looks better, but:
  Why cast cmd to a string?

Two reasons, being consistent with the code above it (shown below), and I understood that cmd is returned as non-string type:

    if str(cmd) == "init":
        if len(args) == 1:
            source = args[0]
        elif len(args) > 1:
            optsparser.error("wrong number of parameters", cmd)
    elif str(cmd) in command_table.keys():
        if len(args) == 1:
            branch_dir = args[0]
        elif len(args) > 1:
            optsparser.error("wrong number of parameters", cmd)
    else:
        assert False, "command not handled: %s" % cmd

  Do all versions of 'svn info' produce the 'Node Kind' key?  Can you
check has_key first?

You are right, thanks. I've put in a has_key call, which eliminates the need to test for an empty dictionary. Please find this attached.

Regards,
Shaddy
[[[
* svnmerge.py
  (main): allow the use of the avail command against a URL instead of
  the current rigid requirement that a subversion working copy be
  referenced.
Patch by: Shaddy Baddah <[EMAIL PROTECTED]>
]]]
Index: svnmerge.py
===================================================================
--- svnmerge.py	(revision 31772)
+++ svnmerge.py	(working copy)
@@ -2085,7 +2085,23 @@
 
     # Validate branch_dir
     if not is_wc(branch_dir):
-        error('"%s" is not a subversion working directory' % branch_dir)
+        if str(cmd) == "avail":
+            info = None
+            # it should be noted here that svn info does not error exit
+            # if an invalid target is specified to it (as is
+            # intuitive). so the try, except code is not absolutely
+            # necessary. but, I retain it to indicate the intuitive
+            # handling.
+            try:
+                info = get_svninfo(branch_dir)
+            except LaunchError:
+                pass
+            # test that we definitely targeted a subversion directory,
+            # mirroring the purpose of the earlier is_wc() call
+            if info is None or not info.has_key("Node Kind") or info["Node Kind"] != "directory":
+                error('"%s" is neither a valid URL, nor a working directory' % branch_dir)
+        else:
+            error('"%s" is not a subversion working directory' % branch_dir)
 
     # Extract the integration info for the branch_dir
     branch_props = get_merge_props(branch_dir)
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge

Reply via email to