##// END OF EJS Templates
convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard -
r8047:04c62275 default
parent child Browse files
Show More
@@ -0,0 +1,51 b''
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "convert=" >> $HGRCPATH
5 echo 'hgext.graphlog =' >> $HGRCPATH
6
7 glog()
8 {
9 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
10 }
11
12 hg init repo1
13 cd repo1
14 echo a > a
15 hg ci -Am adda
16 echo b > b
17 echo a >> a
18 hg ci -Am addb
19 PARENTID1=`hg id --debug -i`
20 echo c > c
21 hg ci -Am addc
22 PARENTID2=`hg id --debug -i`
23 cd ..
24
25 hg init repo2
26 cd repo2
27 echo b > a
28 echo d > d
29 hg ci -Am addaandd
30 CHILDID1=`hg id --debug -i`
31 echo d >> d
32 hg ci -Am changed
33 CHILDID2=`hg id --debug -i`
34 echo e > e
35 hg ci -Am adde
36 cd ..
37
38 echo '% test invalid splicemap'
39 cat > splicemap <<EOF
40 $CHILDID2
41 EOF
42 hg convert --splicemap splicemap repo2 repo1
43
44 echo '% splice repo2 on repo1'
45 cat > splicemap <<EOF
46 $CHILDID1 $PARENTID1
47 $CHILDID2 $PARENTID2,$CHILDID1
48 EOF
49 hg clone repo1 target1
50 hg convert --splicemap splicemap repo2 target1
51 glog -R target1
@@ -0,0 +1,31 b''
1 adding a
2 adding b
3 adding c
4 adding a
5 adding d
6 adding e
7 % test invalid splicemap
8 abort: syntax error in splicemap(1): key/value pair expected
9 % splice repo2 on repo1
10 updating working directory
11 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 scanning source...
13 sorting...
14 converting...
15 2 addaandd
16 spliced in ['6d4c2037ddc2cb2627ac3a244ecce35283268f8e'] as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db
17 1 changed
18 spliced in ['e55c719b85b60e5102fac26110ba626e7cb6b7dc', '527cdedf31fbd5ea708aa14eeecf53d4676f38db'] as parents of e4ea00df91897da3079a10fab658c1eddba6617b
19 0 adde
20 o 5 "adde" files: e
21 |
22 o 4 "changed" files: d
23 |\
24 | o 3 "addaandd" files: a d
25 | |
26 @ | 2 "addc" files: c
27 |/
28 o 1 "addb" files: a b
29 |
30 o 0 "adda" files: a
31
@@ -333,8 +333,12 b' class mapfile(dict):'
333 if err.errno != errno.ENOENT:
333 if err.errno != errno.ENOENT:
334 raise
334 raise
335 return
335 return
336 for line in fp:
336 for i, line in enumerate(fp):
337 key, value = strutil.rsplit(line[:-1], ' ', 1)
337 try:
338 key, value = strutil.rsplit(line[:-1], ' ', 1)
339 except ValueError:
340 raise util.Abort(_('syntax error in %s(%d): key/value pair expected')
341 % (self.path, i+1))
338 if key not in self:
342 if key not in self:
339 self.order.append(key)
343 self.order.append(key)
340 super(mapfile, self).__setitem__(key, value)
344 super(mapfile, self).__setitem__(key, value)
General Comments 0
You need to be logged in to leave comments. Login now