Show More
@@ -0,0 +1,59 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | echo "[extensions]" >> $HGRCPATH | |||
|
4 | echo "rebase=" >> $HGRCPATH | |||
|
5 | echo "[diff]" >> $HGRCPATH | |||
|
6 | echo "git=1" >> $HGRCPATH | |||
|
7 | ||||
|
8 | BASE=`pwd` | |||
|
9 | ||||
|
10 | cleanoutput () { | |||
|
11 | sed -e 's/\(Rebase status stored to\).*/\1/' \ | |||
|
12 | -e 's/\(Rebase status restored from\).*/\1/' \ | |||
|
13 | -e 's/\(saving bundle to \).*/\1/' | |||
|
14 | } | |||
|
15 | ||||
|
16 | hg init repo1 | |||
|
17 | cd repo1 | |||
|
18 | echo "a">a | |||
|
19 | hg commit -Am "A" --date '0 0' | |||
|
20 | echo "b"> b | |||
|
21 | hg commit -Am "B" --date '1 0' | |||
|
22 | hg up -C 0 | |||
|
23 | hg mv a a-renamed | |||
|
24 | hg commit -m 'rename A' --date '2 0' | |||
|
25 | ||||
|
26 | echo | |||
|
27 | echo '% Rename is tracked' | |||
|
28 | hg log -p -r tip --template '{rev}:{desc}\n' | |||
|
29 | ||||
|
30 | echo '% Rebase the revision containing the rename' | |||
|
31 | hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput | |||
|
32 | ||||
|
33 | echo | |||
|
34 | echo '% Rename is not lost' | |||
|
35 | hg log -p -r tip --template '{rev}:{desc}\n' | |||
|
36 | ||||
|
37 | cd $BASE | |||
|
38 | rm -rf repo1 | |||
|
39 | hg init repo1 | |||
|
40 | cd repo1 | |||
|
41 | echo "a">a | |||
|
42 | hg commit -Am "A" --date '0 0' | |||
|
43 | echo "b"> b | |||
|
44 | hg commit -Am "B" --date '1 0' | |||
|
45 | hg up -C 0 | |||
|
46 | hg cp a a-copied | |||
|
47 | hg commit -m 'copy A' --date '2 0' | |||
|
48 | ||||
|
49 | echo | |||
|
50 | echo '% Copy is tracked' | |||
|
51 | hg log -p -r tip --template '{rev}:{desc}\n' | |||
|
52 | ||||
|
53 | echo '% Rebase the revision containing the copy' | |||
|
54 | hg rebase -s 2 -d 1 --quiet 2>&1 | cleanoutput | |||
|
55 | ||||
|
56 | echo | |||
|
57 | echo '% Copy is not lost' | |||
|
58 | hg log -p -r tip --template '{rev}:{desc}\n' | |||
|
59 |
@@ -0,0 +1,40 b'' | |||||
|
1 | adding a | |||
|
2 | adding b | |||
|
3 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
4 | created new head | |||
|
5 | ||||
|
6 | % Rename is tracked | |||
|
7 | 2:rename A | |||
|
8 | diff --git a/a b/a-renamed | |||
|
9 | rename from a | |||
|
10 | rename to a-renamed | |||
|
11 | ||||
|
12 | % Rebase the revision containing the rename | |||
|
13 | saving bundle to | |||
|
14 | ||||
|
15 | % Rename is not lost | |||
|
16 | 2:rename A | |||
|
17 | diff --git a/a b/a-renamed | |||
|
18 | rename from a | |||
|
19 | rename to a-renamed | |||
|
20 | ||||
|
21 | adding a | |||
|
22 | adding b | |||
|
23 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
24 | created new head | |||
|
25 | ||||
|
26 | % Copy is tracked | |||
|
27 | 2:copy A | |||
|
28 | diff --git a/a b/a-copied | |||
|
29 | copy from a | |||
|
30 | copy to a-copied | |||
|
31 | ||||
|
32 | % Rebase the revision containing the copy | |||
|
33 | saving bundle to | |||
|
34 | ||||
|
35 | % Copy is not lost | |||
|
36 | 2:copy A | |||
|
37 | diff --git a/a b/a-copied | |||
|
38 | copy from a | |||
|
39 | copy to a-copied | |||
|
40 |
@@ -14,7 +14,7 b' http://www.selenic.com/mercurial/wiki/in' | |||||
14 | ''' |
|
14 | ''' | |
15 |
|
15 | |||
16 | from mercurial import util, repair, merge, cmdutil, commands, error |
|
16 | from mercurial import util, repair, merge, cmdutil, commands, error | |
17 | from mercurial import extensions, ancestor |
|
17 | from mercurial import extensions, ancestor, copies | |
18 | from mercurial.commands import templateopts |
|
18 | from mercurial.commands import templateopts | |
19 | from mercurial.node import nullrev |
|
19 | from mercurial.node import nullrev | |
20 | from mercurial.i18n import _ |
|
20 | from mercurial.i18n import _ | |
@@ -210,7 +210,18 b' def rebasenode(repo, rev, target, state,' | |||||
210 | else: # we have an interrupted rebase |
|
210 | else: # we have an interrupted rebase | |
211 | repo.ui.debug(_('resuming interrupted rebase\n')) |
|
211 | repo.ui.debug(_('resuming interrupted rebase\n')) | |
212 |
|
212 | |||
213 |
|
213 | # Keep track of renamed files in the revision that is going to be rebased | ||
|
214 | # Here we simulate the copies and renames in the source changeset | |||
|
215 | cop, diver = copies.copies(repo, repo[rev], repo[target], repo[p2], True) | |||
|
216 | m1 = repo[rev].manifest() | |||
|
217 | m2 = repo[target].manifest() | |||
|
218 | for k, v in cop.iteritems(): | |||
|
219 | if k in m1: | |||
|
220 | if v in m1 or v in m2: | |||
|
221 | repo.dirstate.copy(v, k) | |||
|
222 | if v in m2 and v not in m1: | |||
|
223 | repo.dirstate.remove(v) | |||
|
224 | ||||
214 | newrev = concludenode(repo, rev, p1, p2, state, collapse, |
|
225 | newrev = concludenode(repo, rev, p1, p2, state, collapse, | |
215 | extrafn=extrafn) |
|
226 | extrafn=extrafn) | |
216 |
|
227 |
General Comments 0
You need to be logged in to leave comments.
Login now