Show More
@@ -173,8 +173,14 b' class bzr_source(converter_source):' | |||
|
173 | 173 | revid = current._revision_id |
|
174 | 174 | changes = [] |
|
175 | 175 | renames = {} |
|
176 | seen = set() | |
|
177 | # Process the entries by reverse lexicographic name order to | |
|
178 | # handle nested renames correctly, most specific first. | |
|
179 | curchanges = sorted(current.iter_changes(origin), | |
|
180 | key=lambda c: c[1][0] or c[1][1], | |
|
181 | reverse=True) | |
|
176 | 182 | for (fileid, paths, changed_content, versioned, parent, name, |
|
177 |
kind, executable) in cur |
|
|
183 | kind, executable) in curchanges: | |
|
178 | 184 | |
|
179 | 185 | if paths[0] == u'' or paths[1] == u'': |
|
180 | 186 | # ignore changes to tree root |
@@ -188,7 +194,8 b' class bzr_source(converter_source):' | |||
|
188 | 194 | # so it can be removed. |
|
189 | 195 | changes.append((self.recode(paths[0]), revid)) |
|
190 | 196 | |
|
191 | if None not in paths and paths[0] != paths[1]: | |
|
197 | if kind[0] == 'directory' and None not in paths: | |
|
198 | renaming = paths[0] != paths[1] | |
|
192 | 199 | # neither an add nor an delete - a move |
|
193 | 200 | # rename all directory contents manually |
|
194 | 201 | subdir = origin.inventory.path2id(paths[0]) |
@@ -198,6 +205,16 b' class bzr_source(converter_source):' | |||
|
198 | 205 | if entry.kind == 'directory': |
|
199 | 206 | continue |
|
200 | 207 | frompath = self.recode(paths[0] + '/' + name) |
|
208 | if frompath in seen: | |
|
209 | # Already handled by a more specific change entry | |
|
210 | # This is important when you have: | |
|
211 | # a => b | |
|
212 | # a/c => a/c | |
|
213 | # Here a/c must not be renamed into b/c | |
|
214 | continue | |
|
215 | seen.add(frompath) | |
|
216 | if not renaming: | |
|
217 | continue | |
|
201 | 218 | topath = self.recode(paths[1] + '/' + name) |
|
202 | 219 | # register the files as changed |
|
203 | 220 | changes.append((frompath, revid)) |
@@ -215,6 +232,7 b' class bzr_source(converter_source):' | |||
|
215 | 232 | |
|
216 | 233 | # we got unicode paths, need to convert them |
|
217 | 234 | path, topath = [self.recode(part) for part in paths] |
|
235 | seen.add(path or topath) | |
|
218 | 236 | |
|
219 | 237 | if topath is None: |
|
220 | 238 | # file deleted |
@@ -213,6 +213,7 b' def rebase(ui, repo, **opts):' | |||
|
213 | 213 | originalwd, target, state = result |
|
214 | 214 | if collapsef: |
|
215 | 215 | targetancestors = set(repo.changelog.ancestors(target)) |
|
216 | targetancestors.add(target) | |
|
216 | 217 | external = checkexternal(repo, state, targetancestors) |
|
217 | 218 | |
|
218 | 219 | if keepbranchesf: |
@@ -477,7 +478,10 b' def storestatus(repo, originalwd, target' | |||
|
477 | 478 | f.write('%d\n' % int(keepbranches)) |
|
478 | 479 | for d, v in state.iteritems(): |
|
479 | 480 | oldrev = repo[d].hex() |
|
481 | if v != nullmerge: | |
|
480 | 482 | newrev = repo[v].hex() |
|
483 | else: | |
|
484 | newrev = v | |
|
481 | 485 | f.write("%s:%s\n" % (oldrev, newrev)) |
|
482 | 486 | f.close() |
|
483 | 487 | repo.ui.debug('rebase status stored\n') |
@@ -510,7 +514,10 b' def restorestatus(repo):' | |||
|
510 | 514 | keepbranches = bool(int(l)) |
|
511 | 515 | else: |
|
512 | 516 | oldrev, newrev = l.split(':') |
|
517 | if newrev != str(nullmerge): | |
|
513 | 518 | state[repo[oldrev].rev()] = repo[newrev].rev() |
|
519 | else: | |
|
520 | state[repo[oldrev].rev()] = int(newrev) | |
|
514 | 521 | skipped = set() |
|
515 | 522 | # recompute the set of skipped revs |
|
516 | 523 | if not collapse: |
@@ -2561,7 +2561,7 b' def graft(ui, repo, *revs, **opts):' | |||
|
2561 | 2561 | |
|
2562 | 2562 | for pos, ctx in enumerate(repo.set("%ld", revs)): |
|
2563 | 2563 | current = repo['.'] |
|
2564 | ui.status('grafting revision %s\n' % ctx.rev()) | |
|
2564 | ui.status(_('grafting revision %s\n') % ctx.rev()) | |
|
2565 | 2565 | |
|
2566 | 2566 | # we don't merge the first commit when continuing |
|
2567 | 2567 | if not cont: |
@@ -183,8 +183,14 b' def _unidiff(t1, t2, l1, l2, opts=defaul' | |||
|
183 | 183 | # the file more than once. |
|
184 | 184 | lastfunc[0] = astart |
|
185 | 185 | |
|
186 | yield "@@ -%d,%d +%d,%d @@%s\n" % (astart + 1, alen, | |
|
187 | bstart + 1, blen, func) | |
|
186 | # zero-length hunk ranges report their start line as one less | |
|
187 | if alen: | |
|
188 | astart += 1 | |
|
189 | if blen: | |
|
190 | bstart += 1 | |
|
191 | ||
|
192 | yield "@@ -%d,%d +%d,%d @@%s\n" % (astart, alen, | |
|
193 | bstart, blen, func) | |
|
188 | 194 | for x in delta: |
|
189 | 195 | yield x |
|
190 | 196 | for x in xrange(a2, aend): |
@@ -723,11 +723,10 b' class patchfile(object):' | |||
|
723 | 723 | |
|
724 | 724 | # fast case first, no offsets, no fuzz |
|
725 | 725 | old = h.old() |
|
726 | # patch starts counting at 1 unless we are adding the file | |
|
727 | if h.starta == 0: | |
|
728 | start = 0 | |
|
729 | else: | |
|
730 | start = h.starta + self.offset - 1 | |
|
726 | start = h.starta + self.offset | |
|
727 | # zero length hunk ranges already have their start decremented | |
|
728 | if h.lena: | |
|
729 | start -= 1 | |
|
731 | 730 | orig_start = start |
|
732 | 731 | # if there's skew we want to emit the "(offset %d lines)" even |
|
733 | 732 | # when the hunk cleanly applies at start + skew, so skip the |
@@ -149,3 +149,45 b' directory replace' | |||
|
149 | 149 | 644 second/something |
|
150 | 150 | 644 third/dummy |
|
151 | 151 | $ cd .. |
|
152 | ||
|
153 | divergent nested renames (issue3089) | |
|
154 | ||
|
155 | $ mkdir test-divergent-renames | |
|
156 | $ cd test-divergent-renames | |
|
157 | $ bzr init -q source | |
|
158 | $ cd source | |
|
159 | $ mkdir -p a/c | |
|
160 | $ echo a > a/fa | |
|
161 | $ echo c > a/c/fc | |
|
162 | $ bzr add -q a | |
|
163 | $ bzr commit -q -m 'Initial layout' | |
|
164 | $ bzr mv a b | |
|
165 | a => b | |
|
166 | $ mkdir a | |
|
167 | $ bzr add a | |
|
168 | adding a | |
|
169 | $ bzr mv b/c a/c | |
|
170 | b/c => a/c | |
|
171 | $ bzr status | |
|
172 | added: | |
|
173 | a/ | |
|
174 | renamed: | |
|
175 | a/ => b/ | |
|
176 | a/c/ => a/c/ | |
|
177 | $ bzr commit -q -m 'Divergent renames' | |
|
178 | $ cd .. | |
|
179 | $ hg convert source source-hg | |
|
180 | initializing destination source-hg repository | |
|
181 | scanning source... | |
|
182 | sorting... | |
|
183 | converting... | |
|
184 | 1 Initial layout | |
|
185 | 0 Divergent renames | |
|
186 | $ hg -R source-hg st -C --change 1 | |
|
187 | A b/fa | |
|
188 | a/fa | |
|
189 | R a/fa | |
|
190 | $ hg -R source-hg manifest -r 1 | |
|
191 | a/c/fc | |
|
192 | b/fa | |
|
193 | $ cd .. |
@@ -89,23 +89,65 b' invalid diff.unified' | |||
|
89 | 89 | abort: diff context lines count must be an integer, not 'foo' |
|
90 | 90 | [255] |
|
91 | 91 | |
|
92 | test off-by-one error with diff -p | |
|
92 | 0 lines of context hunk header matches gnu diff hunk header | |
|
93 | ||
|
94 | $ hg init diffzero | |
|
95 | $ cd diffzero | |
|
96 | $ cat > f1 << EOF | |
|
97 | > c2 | |
|
98 | > c4 | |
|
99 | > c5 | |
|
100 | > EOF | |
|
101 | $ hg commit -Am0 | |
|
102 | adding f1 | |
|
103 | ||
|
104 | $ cat > f2 << EOF | |
|
105 | > c1 | |
|
106 | > c2 | |
|
107 | > c3 | |
|
108 | > c4 | |
|
109 | > EOF | |
|
110 | $ diff -U0 f1 f2 | |
|
111 | --- f1 * (glob) | |
|
112 | +++ f2 * (glob) | |
|
113 | @@ -0,0 +1 @@ | |
|
114 | +c1 | |
|
115 | @@ -1,0 +3 @@ | |
|
116 | +c3 | |
|
117 | @@ -3 +4,0 @@ | |
|
118 | -c5 | |
|
119 | [1] | |
|
93 | 120 | |
|
94 | $ hg init diffp | |
|
95 | $ cd diffp | |
|
96 | $ echo a > a | |
|
97 | $ hg ci -Ama | |
|
98 | adding a | |
|
99 | $ rm a | |
|
100 | $ echo b > a | |
|
101 | $ echo a >> a | |
|
102 | $ echo c >> a | |
|
103 | $ hg diff -U0 -p --nodates | |
|
104 | diff -r cb9a9f314b8b a | |
|
105 | --- a/a | |
|
106 | +++ b/a | |
|
107 | @@ -1,0 +1,1 @@ | |
|
108 | +b | |
|
109 | @@ -2,0 +3,1 @@ a | |
|
110 | +c | |
|
121 | $ mv f2 f1 | |
|
122 | $ hg diff -U0 --nodates | |
|
123 | diff -r 55d8ff78db23 f1 | |
|
124 | --- a/f1 | |
|
125 | +++ b/f1 | |
|
126 | @@ -0,0 +1,1 @@ | |
|
127 | +c1 | |
|
128 | @@ -1,0 +3,1 @@ | |
|
129 | +c3 | |
|
130 | @@ -3,1 +4,0 @@ | |
|
131 | -c5 | |
|
111 | 132 | |
|
133 | $ hg diff -U0 --nodates --git | |
|
134 | diff --git a/f1 b/f1 | |
|
135 | --- a/f1 | |
|
136 | +++ b/f1 | |
|
137 | @@ -0,0 +1,1 @@ | |
|
138 | +c1 | |
|
139 | @@ -1,0 +3,1 @@ | |
|
140 | +c3 | |
|
141 | @@ -3,1 +4,0 @@ | |
|
142 | -c5 | |
|
143 | ||
|
144 | $ hg diff -U0 --nodates -p | |
|
145 | diff -r 55d8ff78db23 f1 | |
|
146 | --- a/f1 | |
|
147 | +++ b/f1 | |
|
148 | @@ -0,0 +1,1 @@ | |
|
149 | +c1 | |
|
150 | @@ -1,0 +3,1 @@ c2 | |
|
151 | +c3 | |
|
152 | @@ -3,1 +4,0 @@ c4 | |
|
153 | -c5 |
@@ -958,3 +958,39 b' diff lines looking like headers' | |||
|
958 | 958 | $ diff want have |
|
959 | 959 | $ cd .. |
|
960 | 960 | |
|
961 | import a unified diff with no lines of context (diff -U0) | |
|
962 | ||
|
963 | $ hg init diffzero | |
|
964 | $ cd diffzero | |
|
965 | $ cat > f << EOF | |
|
966 | > c2 | |
|
967 | > c4 | |
|
968 | > c5 | |
|
969 | > EOF | |
|
970 | $ hg commit -Am0 | |
|
971 | adding f | |
|
972 | ||
|
973 | $ hg import --no-commit - << EOF | |
|
974 | > # HG changeset patch | |
|
975 | > # User test | |
|
976 | > # Date 0 0 | |
|
977 | > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c | |
|
978 | > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794 | |
|
979 | > 1 | |
|
980 | > diff -r 8679a12a975b -r f4974ab632f3 f | |
|
981 | > --- a/f Thu Jan 01 00:00:00 1970 +0000 | |
|
982 | > +++ b/f Thu Jan 01 00:00:00 1970 +0000 | |
|
983 | > @@ -0,0 +1,1 @@ | |
|
984 | > +c1 | |
|
985 | > @@ -1,0 +3,1 @@ | |
|
986 | > +c3 | |
|
987 | > @@ -3,1 +4,0 @@ | |
|
988 | > -c5 | |
|
989 | > EOF | |
|
990 | applying patch from stdin | |
|
991 | ||
|
992 | $ cat f | |
|
993 | c1 | |
|
994 | c2 | |
|
995 | c3 | |
|
996 | c4 |
@@ -303,3 +303,93 b' Rebasing across null as ancestor' | |||
|
303 | 303 | |/ |
|
304 | 304 | o 0: 'A' |
|
305 | 305 | |
|
306 | $ cd .. | |
|
307 | ||
|
308 | Verify that target is not selected as external rev (issue3085) | |
|
309 | ||
|
310 | $ hg clone -q -U a a6 | |
|
311 | $ cd a6 | |
|
312 | $ hg up -q 6 | |
|
313 | ||
|
314 | $ echo "I" >> E | |
|
315 | $ hg ci -m "I" | |
|
316 | $ hg merge 7 | |
|
317 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
318 | (branch merge, don't forget to commit) | |
|
319 | $ hg ci -m "Merge" | |
|
320 | $ echo "J" >> F | |
|
321 | $ hg ci -m "J" | |
|
322 | ||
|
323 | $ hg rebase -s 8 -d 7 --collapse --detach --config ui.merge=internal:other | |
|
324 | remote changed E which local deleted | |
|
325 | use (c)hanged version or leave (d)eleted? c | |
|
326 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob) | |
|
327 | ||
|
328 | $ hg tglog | |
|
329 | @ 8: 'Collapsed revision | |
|
330 | | * I | |
|
331 | | * Merge | |
|
332 | | * J' | |
|
333 | o 7: 'H' | |
|
334 | | | |
|
335 | | o 6: 'G' | |
|
336 | |/| | |
|
337 | o | 5: 'F' | |
|
338 | | | | |
|
339 | | o 4: 'E' | |
|
340 | |/ | |
|
341 | | o 3: 'D' | |
|
342 | | | | |
|
343 | | o 2: 'C' | |
|
344 | | | | |
|
345 | | o 1: 'B' | |
|
346 | |/ | |
|
347 | o 0: 'A' | |
|
348 | ||
|
349 | ||
|
350 | $ hg parents | |
|
351 | changeset: 8:9472f4b1d736 | |
|
352 | tag: tip | |
|
353 | user: test | |
|
354 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
355 | summary: Collapsed revision | |
|
356 | ||
|
357 | ||
|
358 | $ cd .. | |
|
359 | ||
|
360 | Ensure --continue restores a correct state (issue3046): | |
|
361 | $ hg clone -q a a7 | |
|
362 | $ cd a7 | |
|
363 | $ hg up -q 3 | |
|
364 | $ echo 'H2' > H | |
|
365 | $ hg ci -A -m 'H2' | |
|
366 | adding H | |
|
367 | $ hg rebase -s 8 -d 7 --detach --config ui.merge=internal:fail | |
|
368 | merging H | |
|
369 | warning: conflicts during merge. | |
|
370 | merging H failed! | |
|
371 | abort: unresolved conflicts (see hg resolve, then hg rebase --continue) | |
|
372 | [255] | |
|
373 | $ hg resolve --all -t internal:local | |
|
374 | $ hg rebase -c | |
|
375 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-backup.hg | |
|
376 | $ hg tglog | |
|
377 | @ 8: 'H2' | |
|
378 | | | |
|
379 | o 7: 'H' | |
|
380 | | | |
|
381 | | o 6: 'G' | |
|
382 | |/| | |
|
383 | o | 5: 'F' | |
|
384 | | | | |
|
385 | | o 4: 'E' | |
|
386 | |/ | |
|
387 | | o 3: 'D' | |
|
388 | | | | |
|
389 | | o 2: 'C' | |
|
390 | | | | |
|
391 | | o 1: 'B' | |
|
392 | |/ | |
|
393 | o 0: 'A' | |
|
394 | ||
|
395 |
General Comments 0
You need to be logged in to leave comments.
Login now