Show More
@@ -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,19 +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 | changes.append((elt.get('to'), rev)) |
|
130 | man = self.manifest() | |
120 |
|
|
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 | |||
121 | else: |
|
147 | else: | |
122 | changes.append((elt.text.strip(), rev)) |
|
148 | changes.append((elt.text.strip(), rev)) | |
|
149 | self.pull(rev) | |||
123 | self.lastrev = rev |
|
150 | self.lastrev = rev | |
124 | return sorted(changes), copies |
|
151 | return sorted(changes), copies | |
125 |
|
152 |
@@ -44,10 +44,17 b' darcs pull -a ../darcs-clone' | |||||
44 | sleep 1 |
|
44 | sleep 1 | |
45 | echo e > a |
|
45 | echo e > a | |
46 | echo f > f |
|
46 | echo f > f | |
|
47 | mkdir dir | |||
|
48 | echo d > dir/d | |||
|
49 | echo d > dir/d2 | |||
47 | darcs record -a -l -m p2 |
|
50 | darcs record -a -l -m p2 | |
48 |
|
51 | |||
49 | echo % test file and directory move |
|
52 | echo % test file and directory move | |
50 | darcs mv f ff |
|
53 | darcs mv f ff | |
|
54 | # Test remove + move | |||
|
55 | darcs remove dir/d2 | |||
|
56 | rm dir/d2 | |||
|
57 | darcs mv dir dir2 | |||
51 | darcs record -a -l -m p3 |
|
58 | darcs record -a -l -m p3 | |
52 | cd .. |
|
59 | cd .. | |
53 |
|
60 |
@@ -21,9 +21,9 b' 3 p1.2' | |||||
21 | 2 p1.1 |
|
21 | 2 p1.1 | |
22 | 1 p2 |
|
22 | 1 p2 | |
23 | 0 p3 |
|
23 | 0 p3 | |
24 | o 4 "p3" files: f ff |
|
24 | o 4 "p3" files: dir/d dir/d2 dir2/d f ff | |
25 | | |
|
25 | | | |
26 | o 3 "p2" files: a f |
|
26 | o 3 "p2" files: a dir/d dir/d2 f | |
27 | | |
|
27 | | | |
28 | o 2 "p1.1" files: |
|
28 | o 2 "p1.1" files: | |
29 | | |
|
29 | | | |
@@ -33,4 +33,5 b' o 0 "p0" files: a' | |||||
33 |
|
33 | |||
34 | 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a |
|
34 | 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a | |
35 | 1e88685f5ddec574a34c70af492f95b6debc8741 644 b |
|
35 | 1e88685f5ddec574a34c70af492f95b6debc8741 644 b | |
|
36 | d278f41640da5fc303a4cf9894af31c2983fc11d 644 dir2/d | |||
36 | ef5c76581d78340f568d5f48d679bf307452cbc9 644 ff |
|
37 | ef5c76581d78340f568d5f48d679bf307452cbc9 644 ff |
General Comments 0
You need to be logged in to leave comments.
Login now