[Svnmerge] svnmerge and externals

William Baum bill at thebaums.org
Sun Jan 15 13:58:42 PST 2012


Sorry for the delay.  Was out of town in meetings all week..

On Sun, Jan 8, 2012 at 5:49 PM, Dustin J. Mitchell <dustin at v.igoro.us> wrote:
> As for is_wc -- its use is not entirely cosmetic:

Agreed.  I have updated is_wc() to also look in parent directories for metadata.

> I'll be happy to merge the first and last portions as suggested, if
> you can roll them up into a patch and include a log message in
> accordance with
>  http://subversion.apache.org/docs/community-guide/conventions.html#log-messages
>
> If you revise the is_wc change, I'll be happy to look at the revised patch.

Thanks!

Here's an updated patch, and log message (also attached):

###########
Index: svnmerge.py
===================================================================
--- svnmerge.py	(revision 1228757)
+++ svnmerge.py	(working copy)
@@ -343,8 +343,13 @@
     # directories.  Though it displays a debug message for external
     # directories, after a blank line.  So, practically, the first line
     # matters: if it's non-empty there is a modification.
-    out = launchsvn("status -q %s" % dir)
+    out = launchsvn("status -q --ignore-externals %s" % dir)
+    # In 1.7, -q does show externals, so we need to strip them.
+    out = [x for x in out if not re.match(r'^X',x)]
     if out and out[0].strip():
+        if opts["verbose"]>=1:
+            for ln in out:
+                report(ln.strip())
         error('"%s" has local modifications; it must be clean' % dir)

 class PathIdentifier:
@@ -946,8 +951,17 @@

 def is_wc(dir):
     """Check if a directory is a working copy."""
-    return os.path.isdir(os.path.join(dir, ".svn")) or \
-           os.path.isdir(os.path.join(dir, "_svn"))
+    report("Working copy check: %s" % dir)
+    dir=os.path.abspath(dir)
+    while not os.path.isdir(os.path.join(dir, ".svn")) or \
+           os.path.isdir(os.path.join(dir, "_svn")):
+        lastdir=dir
+        dir=os.path.dirname(dir)
+        if dir==lastdir:
+            return False
+    else:
+        report("Working copy base dir: %s" % dir)
+        return True

 _cache_svninfo = {}
 def get_svninfo(target):
@@ -1552,14 +1566,12 @@
     if opts["commit-file"]:
         f = open(opts["commit-file"], "w")
         if record_only:
-            print >>f, 'Recorded merge of revisions %s via %s from ' % \
-                  (revs, NAME)
+            print >>f, 'Recorded merge of revisions %s via %s from %s' % \
+                  (revs, NAME, opts["source-pathid"])
         else:
-            print >>f, 'Merged revisions %s via %s from ' % \
-                  (revs, NAME)
-        print >>f, '%s' % opts["source-url"]
+            print >>f, 'Merged revisions %s via %s from %s' % \
+                  (revs, NAME, opts["source-pathid"])
         if opts["commit-verbose"]:
-            print >>f
             print >>f, construct_merged_log_message(opts["source-url"], revs),

         f.close()
###########

log-message:
###########
Improved svnmerge.py compatibility with subversion 1.7.

* contrib/client-side/svnmerge/svnmerge.py
  (check_dir_clean): Prevent externals from causing check_dir_clean to
fail with subversion 1.7. Added verbose output of offending local
mods.
  (is_wc): Now checks current and parent directories for .svn or _svn
metadata directory. Added additional verbose report output.
  (action_merge): Commit messages are more compact and use relative
paths, if available, instead of the full URL.

Patch by: William Baum <wmbaum at gmail.com>
###########

Let me know if any additional changes are necessary.

Thanks,

--Bill
-------------- next part --------------
Improved svnmerge.py compatibility with subversion 1.7.

* contrib/client-side/svnmerge/svnmerge.py
  (check_dir_clean): Prevent externals from causing check_dir_clean to fail with subversion 1.7. Added verbose output of offending local mods.
  (is_wc): Now checks current and parent directories for .svn or _svn metadata directory. Added additional verbose report output.
  (action_merge): Commit messages are more compact and use relative paths, if available, instead of the full URL.

Patch by: William Baum <wmbaum at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svnmerge.py-120115-wmbaum.patch
Type: application/octet-stream
Size: 2254 bytes
Desc: not available
URL: </pipermail/svnmerge/attachments/20120115/8a3d569f/attachment.obj>


More information about the Svnmerge mailing list