Patchwork splicemap: support for path with spaces in splicemap (issue3844)

login
register
mail settings
Submitter Szymon Wróblewski
Date May 3, 2013, 2:28 a.m.
Message ID <CAF-_pHj_+wWLJwgsnUcpDfymq8hYBQ+H1_cFf5m6-FsPXwb+6Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/1539/
State Changes Requested
Headers show

Comments

Patch

diff -r 4cdec37f0018 -r 084dfca47663 hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py Sat Apr 27 23:49:34 2013 -0700
+++ b/hgext/convert/convcmd.py Fri May 03 04:16:36 2013 +0200
@@ -17,7 +17,7 @@ 
 from p4 import p4_source
 import filemap

-import os, shutil
+import os, shutil, shlex
 from mercurial import hg, util, encoding
 from mercurial.i18n import _

@@ -142,26 +142,18 @@ 
                 if not line:
                     # Ignore blank lines
                     continue
-                try:
-                    child, parents = line.split(' ', 1)
-                    self.source.checkrevformat(child)
-                    parents = parents.replace(',', ' ').split()
-                    # check if number of parents are upto 2 max
-                    if (len(parents) > 2):
-                        raise util.Abort(_('syntax error in %s(%d): child
'\
-                                            'parent1[,parent2] expected') \
-                                            % (path, i + 1))
-                    for parent in parents:
-                        self.source.checkrevformat(parent)
-                except ValueError:
-                    raise util.Abort(_('syntax error in %s(%d): child '\
-                                        'parent1[,parent2] expected') \
-                                        % (path, i + 1))
-                pp = []
-                for p in parents:
-                    if p not in pp:
-                        pp.append(p)
-                m[child] = pp
+                line = shlex.split(line.replace(',', ' '))
+                # check number of parents
+                if not (2 <= len(line) <= 3):
+                    raise util.Abort(_('syntax error in %s(%d): child
parent1'
+                                       '[,parent2] expected') % (path, i +
1))
+                for part in line:
+                    self.source.checkrevformat(part)
+                child, p1, p2 = line[0], line[1:2], line[2:]
+                if p1 == p2:
+                    m[child] = p1
+                else:
+                    m[child] = p1 + p2