[Svnmerge] svnmerge and externals

William Baum bill at thebaums.org
Thu Jan 5 16:46:43 PST 2012


Here is a patch against r1227877, with three independent sections.

The first section deals with externals breaking check_dir_clean in a
simpler manner than Lars' change to XML.  I also added a report of the
detail of offending files to the verbose output.

The second section forces the local working copy check to return true.
 One could implement a different check if there were a compelling
reason, but the risk of working on a non-working directory seems
minimal.

The third section formats commit messages in a way that I prefer.
It's more compact and readable, and uses relative paths, if available,
instead of the full url.

I've also attached patch files:

svnmerge.py-120105-02-svn17.patch (including log formatting changes)
svnmerge.py-120105-01-svn17.patch (without log formatting changes)


--Bill

###########
Index: svnmerge.py
===================================================================
--- svnmerge.py	(revision 1227877)
+++ 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,9 @@

 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"))
+    return True
+#    return os.path.isdir(os.path.join(dir, ".svn")) or \
+#           os.path.isdir(os.path.join(dir, "_svn"))

 _cache_svninfo = {}
 def get_svninfo(target):
@@ -1552,14 +1558,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()
###########
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svnmerge.py-120105-01-svn17.patch
Type: application/octet-stream
Size: 1208 bytes
Desc: not available
URL: </pipermail/svnmerge/attachments/20120105/4bac3d40/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svnmerge.py-120105-02-svn17.patch
Type: application/octet-stream
Size: 2004 bytes
Desc: not available
URL: </pipermail/svnmerge/attachments/20120105/4bac3d40/attachment-0001.obj>


More information about the Svnmerge mailing list