Show More
@@ -0,0 +1,157 b'' | |||||
|
1 | #require symlink execbit | |||
|
2 | $ cat << EOF >> $HGRCPATH | |||
|
3 | > [extensions] | |||
|
4 | > amend= | |||
|
5 | > rebase= | |||
|
6 | > debugdrawdag=$TESTDIR/drawdag.py | |||
|
7 | > [diff] | |||
|
8 | > git=1 | |||
|
9 | > [alias] | |||
|
10 | > tglog = log -G --template "{rev}: {node|short} '{desc}'\n" | |||
|
11 | > EOF | |||
|
12 | ||||
|
13 | Rebase a simple DAG: | |||
|
14 | $ hg init repo1 | |||
|
15 | $ cd repo1 | |||
|
16 | $ hg debugdrawdag <<'EOS' | |||
|
17 | > c b | |||
|
18 | > |/ | |||
|
19 | > d | |||
|
20 | > | | |||
|
21 | > a | |||
|
22 | > EOS | |||
|
23 | $ hg up -C a | |||
|
24 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
25 | $ hg tglog | |||
|
26 | o 3: 814f6bd05178 'c' | |||
|
27 | | | |||
|
28 | | o 2: db0e82a16a62 'b' | |||
|
29 | |/ | |||
|
30 | o 1: 02952614a83d 'd' | |||
|
31 | | | |||
|
32 | @ 0: b173517d0057 'a' | |||
|
33 | ||||
|
34 | $ hg cat -r 3 c | |||
|
35 | c (no-eol) | |||
|
36 | $ hg cat -r 2 b | |||
|
37 | b (no-eol) | |||
|
38 | $ hg rebase --inmemory --debug -r b -d c | grep rebasing | |||
|
39 | rebasing in-memory | |||
|
40 | rebasing 2:db0e82a16a62 "b" (b) | |||
|
41 | $ hg tglog | |||
|
42 | o 3: ca58782ad1e4 'b' | |||
|
43 | | | |||
|
44 | o 2: 814f6bd05178 'c' | |||
|
45 | | | |||
|
46 | o 1: 02952614a83d 'd' | |||
|
47 | | | |||
|
48 | @ 0: b173517d0057 'a' | |||
|
49 | ||||
|
50 | $ hg cat -r 3 b | |||
|
51 | b (no-eol) | |||
|
52 | $ hg cat -r 2 c | |||
|
53 | c (no-eol) | |||
|
54 | ||||
|
55 | Case 2: | |||
|
56 | $ hg init repo2 | |||
|
57 | $ cd repo2 | |||
|
58 | $ hg debugdrawdag <<'EOS' | |||
|
59 | > c b | |||
|
60 | > |/ | |||
|
61 | > d | |||
|
62 | > | | |||
|
63 | > a | |||
|
64 | > EOS | |||
|
65 | ||||
|
66 | Add a symlink and executable file: | |||
|
67 | $ hg up -C c | |||
|
68 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
69 | $ ln -s somefile e | |||
|
70 | $ echo f > f | |||
|
71 | $ chmod +x f | |||
|
72 | $ hg add e f | |||
|
73 | $ hg amend -q | |||
|
74 | $ hg up -Cq a | |||
|
75 | ||||
|
76 | Write files to the working copy, and ensure they're still there after the rebase | |||
|
77 | $ echo "abc" > a | |||
|
78 | $ ln -s def b | |||
|
79 | $ echo "ghi" > c | |||
|
80 | $ echo "jkl" > d | |||
|
81 | $ echo "mno" > e | |||
|
82 | $ hg tglog | |||
|
83 | o 3: f56b71190a8f 'c' | |||
|
84 | | | |||
|
85 | | o 2: db0e82a16a62 'b' | |||
|
86 | |/ | |||
|
87 | o 1: 02952614a83d 'd' | |||
|
88 | | | |||
|
89 | @ 0: b173517d0057 'a' | |||
|
90 | ||||
|
91 | $ hg cat -r 3 c | |||
|
92 | c (no-eol) | |||
|
93 | $ hg cat -r 2 b | |||
|
94 | b (no-eol) | |||
|
95 | $ hg cat -r 3 e | |||
|
96 | somefile (no-eol) | |||
|
97 | $ hg rebase --inmemory --debug -s b -d a | grep rebasing | |||
|
98 | rebasing in-memory | |||
|
99 | rebasing 2:db0e82a16a62 "b" (b) | |||
|
100 | $ hg tglog | |||
|
101 | o 3: fc055c3b4d33 'b' | |||
|
102 | | | |||
|
103 | | o 2: f56b71190a8f 'c' | |||
|
104 | | | | |||
|
105 | | o 1: 02952614a83d 'd' | |||
|
106 | |/ | |||
|
107 | @ 0: b173517d0057 'a' | |||
|
108 | ||||
|
109 | $ hg cat -r 2 c | |||
|
110 | c (no-eol) | |||
|
111 | $ hg cat -r 3 b | |||
|
112 | b (no-eol) | |||
|
113 | $ hg rebase --inmemory --debug -s 1 -d 3 | grep rebasing | |||
|
114 | rebasing in-memory | |||
|
115 | rebasing 1:02952614a83d "d" (d) | |||
|
116 | rebasing 2:f56b71190a8f "c" | |||
|
117 | $ hg tglog | |||
|
118 | o 3: 753feb6fd12a 'c' | |||
|
119 | | | |||
|
120 | o 2: 09c044d2cb43 'd' | |||
|
121 | | | |||
|
122 | o 1: fc055c3b4d33 'b' | |||
|
123 | | | |||
|
124 | @ 0: b173517d0057 'a' | |||
|
125 | ||||
|
126 | Ensure working copy files are still there: | |||
|
127 | $ cat a | |||
|
128 | abc | |||
|
129 | $ readlink.py b | |||
|
130 | b -> def | |||
|
131 | $ cat e | |||
|
132 | mno | |||
|
133 | ||||
|
134 | Ensure symlink and executable files were rebased properly: | |||
|
135 | $ hg up -Cq 3 | |||
|
136 | $ readlink.py e | |||
|
137 | e -> somefile | |||
|
138 | $ ls -l f | cut -c -10 | |||
|
139 | -rwxr-xr-x | |||
|
140 | ||||
|
141 | Rebase the working copy parent, which should default to an on-disk merge even if | |||
|
142 | we requested in-memory. | |||
|
143 | $ hg up -C 3 | |||
|
144 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
145 | $ hg rebase -r 3 -d 0 --inmemory --debug | grep rebasing | |||
|
146 | rebasing on disk | |||
|
147 | rebasing 3:753feb6fd12a "c" (tip) | |||
|
148 | $ hg tglog | |||
|
149 | @ 3: 844a7de3e617 'c' | |||
|
150 | | | |||
|
151 | | o 2: 09c044d2cb43 'd' | |||
|
152 | | | | |||
|
153 | | o 1: fc055c3b4d33 'b' | |||
|
154 | |/ | |||
|
155 | o 0: b173517d0057 'a' | |||
|
156 | ||||
|
157 |
@@ -386,8 +386,10 b' class rebaseruntime(object):' | |||||
386 | if self.inmemory: |
|
386 | if self.inmemory: | |
387 | from mercurial.context import overlayworkingctx |
|
387 | from mercurial.context import overlayworkingctx | |
388 | self.wctx = overlayworkingctx(self.repo) |
|
388 | self.wctx = overlayworkingctx(self.repo) | |
|
389 | self.repo.ui.debug("rebasing in-memory\n") | |||
389 | else: |
|
390 | else: | |
390 | self.wctx = self.repo[None] |
|
391 | self.wctx = self.repo[None] | |
|
392 | self.repo.ui.debug("rebasing on disk\n") | |||
391 |
|
393 | |||
392 | def _performrebase(self, tr): |
|
394 | def _performrebase(self, tr): | |
393 | self._assignworkingcopy() |
|
395 | self._assignworkingcopy() |
@@ -235,6 +235,7 b' Check that the right ancestors is used w' | |||||
235 |
|
235 | |||
236 | $ hg rebase -s9 -d2 --debug # use debug to really check merge base used |
|
236 | $ hg rebase -s9 -d2 --debug # use debug to really check merge base used | |
237 | rebase onto 4bc80088dc6b starting from e31216eec445 |
|
237 | rebase onto 4bc80088dc6b starting from e31216eec445 | |
|
238 | rebasing on disk | |||
238 | rebase status stored |
|
239 | rebase status stored | |
239 | rebasing 9:e31216eec445 "more changes to f1" |
|
240 | rebasing 9:e31216eec445 "more changes to f1" | |
240 | future parents are 2 and -1 |
|
241 | future parents are 2 and -1 |
General Comments 0
You need to be logged in to leave comments.
Login now