changeset 1456:77da55e0baa4

externals: support peg revisions in URLs I saw this some time ago -- according to the Subversion documentation peg revisions this is quite valid. Not entirely sure how to test this... (While at it, I raised our externals-related logging from debug to verbose as it's vaguely meaningful to users.) http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 22 Apr 2014 15:40:39 +0200
parents 8cfe074cd463
children 019c3e194fba
files hgsubversion/svnexternals.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnexternals.py
+++ b/hgsubversion/svnexternals.py
@@ -88,7 +88,7 @@ class BadDefinition(Exception):
     pass
 
 re_defold = re.compile(r'^\s*(.*?)\s+(?:-r\s*(\d+|\{REV\})\s+)?([a-zA-Z+]+://.*)\s*$')
-re_defnew = re.compile(r'^\s*(?:-r\s*(\d+|\{REV\})\s+)?((?:[a-zA-Z+]+://|\^/).*)\s+(\S+)\s*$')
+re_defnew = re.compile(r'^\s*(?:-r\s*(\d+|\{REV\})\s+)?((?:[a-zA-Z+]+://|\^/)\S*)\s+(\S+)\s*$')
 re_scheme = re.compile(r'^[a-zA-Z+]+://')
 
 def parsedefinition(line):
@@ -303,7 +303,7 @@ class externalsupdater:
             if source == exturl:
                 if extrev != rev:
                     self.ui.status(_('updating external on %s@%s\n') %
-                                   (wpath, rev or 'HEAD'))
+                                   (wpath, rev or pegrev or 'HEAD'))
                     cwd = os.path.join(self.repo.root, path)
                     self.svn(['update'] + revspec, cwd)
                 return
@@ -316,7 +316,8 @@ class externalsupdater:
             pegrev = rev
         if pegrev:
             source = '%s@%s' % (source, pegrev)
-        self.ui.status(_('fetching external %s@%s\n') % (wpath, rev or 'HEAD'))
+        self.ui.status(_('fetching external %s@%s\n') %
+                       (wpath, rev or pegrev or 'HEAD'))
         self.svn(['co'] + revspec + [source, dest], cwd)
 
     def delete(self, wpath):
@@ -339,12 +340,12 @@ class externalsupdater:
 
     def svn(self, args, cwd):
         args = ['svn'] + args
-        self.ui.debug(_('updating externals: %r, cwd=%s\n') % (args, cwd))
+        self.ui.note(_('updating externals: %r, cwd=%s\n') % (args, cwd))
         shell = os.name == 'nt'
         p = subprocess.Popen(args, cwd=cwd, shell=shell,
                              stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         for line in p.stdout:
-            self.ui.note(line)
+            self.ui.debug(line)
         p.wait()
         if p.returncode != 0:
             raise hgutil.Abort("subprocess '%s' failed" % ' '.join(args))