Show More
@@ -365,7 +365,7 b' class mapfile(dict):' | |||||
365 | return |
|
365 | return | |
366 | for i, line in enumerate(fp): |
|
366 | for i, line in enumerate(fp): | |
367 | try: |
|
367 | try: | |
368 |
key, value = line[ |
|
368 | key, value = line.splitlines()[0].rsplit(' ', 1) | |
369 | except ValueError: |
|
369 | except ValueError: | |
370 | raise util.Abort(_('syntax error in %s(%d): key/value pair expected') |
|
370 | raise util.Abort(_('syntax error in %s(%d): key/value pair expected') | |
371 | % (self.path, i+1)) |
|
371 | % (self.path, i+1)) |
@@ -85,6 +85,17 b' class darcs_source(converter_source, com' | |||||
85 | self.checkexit(fp.close()) |
|
85 | self.checkexit(fp.close()) | |
86 | return etree.getroot() |
|
86 | return etree.getroot() | |
87 |
|
87 | |||
|
88 | def manifest(self): | |||
|
89 | man = [] | |||
|
90 | output, status = self.run('show', 'files', no_directories=True, | |||
|
91 | repodir=self.tmppath) | |||
|
92 | self.checkexit(status) | |||
|
93 | for line in output.split('\n'): | |||
|
94 | path = line[2:] | |||
|
95 | if path: | |||
|
96 | man.append(path) | |||
|
97 | return man | |||
|
98 | ||||
88 | def getheads(self): |
|
99 | def getheads(self): | |
89 | return self.parents[None] |
|
100 | return self.parents[None] | |
90 |
|
101 | |||
@@ -107,18 +118,35 b' class darcs_source(converter_source, com' | |||||
107 | output, status = self.run('revert', all=True, repodir=self.tmppath) |
|
118 | output, status = self.run('revert', all=True, repodir=self.tmppath) | |
108 | self.checkexit(status, output) |
|
119 | self.checkexit(status, output) | |
109 |
|
120 | |||
110 | def getchanges(self, rev): |
|
121 | def getchanges(self, rev): | |
111 | self.pull(rev) |
|
|||
112 | copies = {} |
|
122 | copies = {} | |
113 | changes = [] |
|
123 | changes = [] | |
|
124 | man = None | |||
114 | for elt in self.changes[rev].find('summary').getchildren(): |
|
125 | for elt in self.changes[rev].find('summary').getchildren(): | |
115 | if elt.tag in ('add_directory', 'remove_directory'): |
|
126 | if elt.tag in ('add_directory', 'remove_directory'): | |
116 | continue |
|
127 | continue | |
117 | if elt.tag == 'move': |
|
128 | if elt.tag == 'move': | |
118 | changes.append((elt.get('from'), rev)) |
|
129 | if man is None: | |
119 | copies[elt.get('from')] = elt.get('to') |
|
130 | man = self.manifest() | |
|
131 | source, dest = elt.get('from'), elt.get('to') | |||
|
132 | if source in man: | |||
|
133 | # File move | |||
|
134 | changes.append((source, rev)) | |||
|
135 | changes.append((dest, rev)) | |||
|
136 | copies[dest] = source | |||
|
137 | else: | |||
|
138 | # Directory move, deduce file moves from manifest | |||
|
139 | source = source + '/' | |||
|
140 | for f in man: | |||
|
141 | if not f.startswith(source): | |||
|
142 | continue | |||
|
143 | fdest = dest + '/' + f[len(source):] | |||
|
144 | changes.append((f, rev)) | |||
|
145 | changes.append((fdest, rev)) | |||
|
146 | copies[fdest] = f | |||
120 | else: |
|
147 | else: | |
121 | changes.append((elt.text.strip(), rev)) |
|
148 | changes.append((elt.text.strip(), rev)) | |
|
149 | self.pull(rev) | |||
122 | self.lastrev = rev |
|
150 | self.lastrev = rev | |
123 | return sorted(changes), copies |
|
151 | return sorted(changes), copies | |
124 |
|
152 |
@@ -444,7 +444,14 b' def rename(src, dst):' | |||||
444 |
|
444 | |||
445 | temp = tempname(dst) |
|
445 | temp = tempname(dst) | |
446 | os.rename(dst, temp) |
|
446 | os.rename(dst, temp) | |
447 | os.unlink(temp) |
|
447 | try: | |
|
448 | os.unlink(temp) | |||
|
449 | except: | |||
|
450 | # Some rude AV-scanners on Windows may cause the unlink to | |||
|
451 | # fail. Not aborting here just leaks the temp file, whereas | |||
|
452 | # aborting at this point may leave serious inconsistencies. | |||
|
453 | # Ideally, we would notify the user here. | |||
|
454 | pass | |||
448 | os.rename(src, dst) |
|
455 | os.rename(src, dst) | |
449 |
|
456 | |||
450 | def unlink(f): |
|
457 | def unlink(f): |
@@ -51,7 +51,7 b' def has_cvsps():' | |||||
51 | return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True) |
|
51 | return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True) | |
52 |
|
52 | |||
53 | def has_darcs(): |
|
53 | def has_darcs(): | |
54 |
return matchoutput('darcs |
|
54 | return matchoutput('darcs --version', r'2\.[2-9]', True) | |
55 |
|
55 | |||
56 | def has_mtn(): |
|
56 | def has_mtn(): | |
57 | return matchoutput('mtn --version', r'monotone', True) and not matchoutput( |
|
57 | return matchoutput('mtn --version', r'monotone', True) and not matchoutput( |
@@ -1,19 +1,13 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" darcs || exit 80 |
|
3 | "$TESTDIR/hghave" darcs || exit 80 | |
4 | if darcs --version 2>&1 | grep '^2\.' > /dev/null; then |
|
|||
5 | # FIXME: darcs 2 will fail with |
|
|||
6 | ### Abort: timeout after 180 seconds. |
|
|||
7 | echo 'skipped: test currently disabled for darcs 2' |
|
|||
8 | exit 80 |
|
|||
9 | fi |
|
|||
10 |
|
4 | |||
11 | echo "[extensions]" >> $HGRCPATH |
|
5 | echo "[extensions]" >> $HGRCPATH | |
12 | echo "convert=" >> $HGRCPATH |
|
6 | echo "convert=" >> $HGRCPATH | |
13 | echo 'hgext.graphlog =' >> $HGRCPATH |
|
7 | echo 'hgext.graphlog =' >> $HGRCPATH | |
14 |
|
8 | |||
15 | DARCS_EMAIL='test@example.org'; export DARCS_EMAIL |
|
9 | DARCS_EMAIL='test@example.org'; export DARCS_EMAIL | |
16 | HOME=do_not_use_HOME_darcs; export HOME |
|
10 | HOME=`pwd`/do_not_use_HOME_darcs; export HOME | |
17 |
|
11 | |||
18 | # skip if we can't import elementtree |
|
12 | # skip if we can't import elementtree | |
19 | mkdir dummy |
|
13 | mkdir dummy | |
@@ -47,8 +41,21 b' darcs record -a -l -m p1.2' | |||||
47 |
|
41 | |||
48 | echo % merge branch |
|
42 | echo % merge branch | |
49 | darcs pull -a ../darcs-clone |
|
43 | darcs pull -a ../darcs-clone | |
|
44 | sleep 1 | |||
50 | echo e > a |
|
45 | echo e > a | |
|
46 | echo f > f | |||
|
47 | mkdir dir | |||
|
48 | echo d > dir/d | |||
|
49 | echo d > dir/d2 | |||
51 | darcs record -a -l -m p2 |
|
50 | darcs record -a -l -m p2 | |
|
51 | ||||
|
52 | echo % test file and directory move | |||
|
53 | darcs mv f ff | |||
|
54 | # Test remove + move | |||
|
55 | darcs remove dir/d2 | |||
|
56 | rm dir/d2 | |||
|
57 | darcs mv dir dir2 | |||
|
58 | darcs record -a -l -m p3 | |||
52 | cd .. |
|
59 | cd .. | |
53 |
|
60 | |||
54 | glog() |
|
61 | glog() | |
@@ -56,7 +63,7 b' glog()' | |||||
56 | hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
63 | hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" | |
57 | } |
|
64 | } | |
58 |
|
65 | |||
59 |
hg convert darcs-repo darcs-repo-hg |
|
66 | hg convert darcs-repo darcs-repo-hg | |
60 | # The converter does not currently handle patch conflicts very well. |
|
67 | # The converter does not currently handle patch conflicts very well. | |
61 | # When they occur, it reverts *all* changes and moves forward, |
|
68 | # When they occur, it reverts *all* changes and moves forward, | |
62 | # letting the conflict resolving patch fix collisions. |
|
69 | # letting the conflict resolving patch fix collisions. |
@@ -5,19 +5,25 b" Finished recording patch 'p1.1'" | |||||
5 | % update source |
|
5 | % update source | |
6 | Finished recording patch 'p1.2' |
|
6 | Finished recording patch 'p1.2' | |
7 | % merge branch |
|
7 | % merge branch | |
|
8 | Backing up ./a(-darcs-backup0) | |||
8 | We have conflicts in the following files: |
|
9 | We have conflicts in the following files: | |
9 | ./a |
|
10 | ./a | |
10 | Finished pulling and applying. |
|
11 | Finished pulling and applying. | |
11 | Finished recording patch 'p2' |
|
12 | Finished recording patch 'p2' | |
|
13 | % test file and directory move | |||
|
14 | Finished recording patch 'p3' | |||
12 | initializing destination darcs-repo-hg repository |
|
15 | initializing destination darcs-repo-hg repository | |
13 | scanning source... |
|
16 | scanning source... | |
14 | sorting... |
|
17 | sorting... | |
15 | converting... |
|
18 | converting... | |
16 |
|
|
19 | 4 p0 | |
17 |
|
|
20 | 3 p1.2 | |
18 |
|
|
21 | 2 p1.1 | |
19 |
|
|
22 | 1 p2 | |
20 | o 3 "p2" files: a |
|
23 | 0 p3 | |
|
24 | o 4 "p3" files: dir/d dir/d2 dir2/d f ff | |||
|
25 | | | |||
|
26 | o 3 "p2" files: a dir/d dir/d2 f | |||
21 | | |
|
27 | | | |
22 | o 2 "p1.1" files: |
|
28 | o 2 "p1.1" files: | |
23 | | |
|
29 | | | |
@@ -27,3 +33,5 b' o 0 "p0" files: a' | |||||
27 |
|
33 | |||
28 | 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a |
|
34 | 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a | |
29 | 1e88685f5ddec574a34c70af492f95b6debc8741 644 b |
|
35 | 1e88685f5ddec574a34c70af492f95b6debc8741 644 b | |
|
36 | d278f41640da5fc303a4cf9894af31c2983fc11d 644 dir2/d | |||
|
37 | ef5c76581d78340f568d5f48d679bf307452cbc9 644 ff |
@@ -38,6 +38,25 b' cd new' | |||||
38 | hg out ../orig |
|
38 | hg out ../orig | |
39 | cd .. |
|
39 | cd .. | |
40 |
|
40 | |||
|
41 | echo '% check shamap LF and CRLF handling' | |||
|
42 | cat > rewrite.py <<EOF | |||
|
43 | import sys | |||
|
44 | # Interlace LF and CRLF | |||
|
45 | lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n')) | |||
|
46 | for i, l in enumerate(file(sys.argv[1]))] | |||
|
47 | file(sys.argv[1], 'wb').write(''.join(lines)) | |||
|
48 | EOF | |||
|
49 | python rewrite.py new/.hg/shamap | |||
|
50 | cd orig | |||
|
51 | hg up -qC 1 | |||
|
52 | echo foo >> foo | |||
|
53 | hg ci -qm 'change foo again' | |||
|
54 | hg up -qC 2 | |||
|
55 | echo foo >> foo | |||
|
56 | hg ci -qm 'change foo again again' | |||
|
57 | cd .. | |||
|
58 | hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' | |||
|
59 | ||||
41 | echo % init broken repository |
|
60 | echo % init broken repository | |
42 | hg init broken |
|
61 | hg init broken | |
43 | cd broken |
|
62 | cd broken |
@@ -20,6 +20,12 b' 0 mark baz executable' | |||||
20 | comparing with ../orig |
|
20 | comparing with ../orig | |
21 | searching for changes |
|
21 | searching for changes | |
22 | no changes found |
|
22 | no changes found | |
|
23 | % check shamap LF and CRLF handling | |||
|
24 | scanning source... | |||
|
25 | sorting... | |||
|
26 | converting... | |||
|
27 | 1 change foo again again | |||
|
28 | 0 change foo again | |||
23 | % init broken repository |
|
29 | % init broken repository | |
24 | created new head |
|
30 | created new head | |
25 | % break it |
|
31 | % break it |
General Comments 0
You need to be logged in to leave comments.
Login now