##// END OF EJS Templates
rebase: make sure the newancestor is used during the whole update...
Christian Boos -
r9815:49efeed4 default
parent child Browse files
Show More
@@ -0,0 +1,31 b''
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "graphlog=" >> $HGRCPATH
5 echo "rebase=" >> $HGRCPATH
6
7 rm -rf repo
8 hg init repo
9 cd repo
10
11 echo A > a
12 echo >> a
13 hg commit -AmA -u test -d '0 0'
14
15 echo B > a
16 echo >> a
17 hg commit -mB -u test -d '1 0'
18
19 echo C > a
20 echo >> a
21 hg commit -mC -u test -d '2 0'
22
23 hg up -C 0
24 echo D >> a
25 hg commit -AmAD -u test -d '3 0'
26
27 hg glog --template '{rev}:{desc} {node|short}\n'
28 hg rebase -q -s 1 -d 3 2>&1 | grep -v 'saving bundle'
29 hg glog --template '{rev}:{desc} {node|short}\n'
30
31 exit 0
@@ -0,0 +1,19 b''
1 adding a
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 created new head
4 @ 3:AD 1d4e82ed3c2a
5 |
6 | o 2:C 7e1afe9214b2
7 | |
8 | o 1:B 0a6620c3c26a
9 |/
10 o 0:A 1e635d440a73
11
12 @ 3:C 0c5887756284
13 |
14 o 2:B 4f208f4a1507
15 |
16 o 1:AD 1d4e82ed3c2a
17 |
18 o 0:A 1e635d440a73
19
@@ -27,17 +27,19 b' def rebasemerge(repo, rev, first=False):'
27 oldancestor = ancestor.ancestor
27 oldancestor = ancestor.ancestor
28
28
29 def newancestor(a, b, pfunc):
29 def newancestor(a, b, pfunc):
30 ancestor.ancestor = oldancestor
31 if b == rev:
30 if b == rev:
32 return repo[rev].parents()[0].rev()
31 return repo[rev].parents()[0].rev()
33 return ancestor.ancestor(a, b, pfunc)
32 return oldancestor(a, b, pfunc)
34
33
35 if not first:
34 if not first:
36 ancestor.ancestor = newancestor
35 ancestor.ancestor = newancestor
37 else:
36 else:
38 repo.ui.debug("first revision, do not change ancestor\n")
37 repo.ui.debug("first revision, do not change ancestor\n")
39 stats = merge.update(repo, rev, True, True, False)
38 try:
40 return stats
39 stats = merge.update(repo, rev, True, True, False)
40 return stats
41 finally:
42 ancestor.ancestor = oldancestor
41
43
42 def rebase(ui, repo, **opts):
44 def rebase(ui, repo, **opts):
43 """move changeset (and descendants) to a different branch
45 """move changeset (and descendants) to a different branch
@@ -130,12 +130,7 b" hg glog --template '{rev}: {desc}\\n'"
130
130
131 echo
131 echo
132 echo '% Rebase and collapse - E onto I'
132 echo '% Rebase and collapse - E onto I'
133 hg rebase -s 4 --collapse
133 hg rebase -s 4 --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
134
135 echo '% Fix conflict and continue'
136 echo 'Resolved merge' > E
137 hg resolve -m E
138 hg rebase -c 2>&1 | sed 's/\(saving bundle to \).*/\1/'
139
134
140 hg glog --template '{rev}: {desc}\n'
135 hg glog --template '{rev}: {desc}\n'
141
136
@@ -145,10 +145,6 b' o 0: A'
145
145
146 % Rebase and collapse - E onto I
146 % Rebase and collapse - E onto I
147 merging E
147 merging E
148 warning: conflicts during merge.
149 merging E failed!
150 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
151 % Fix conflict and continue
152 saving bundle to
148 saving bundle to
153 adding branch
149 adding branch
154 adding changesets
150 adding changesets
@@ -179,7 +175,7 b' E'
179 G
175 G
180 I
176 I
181 Cat E:
177 Cat E:
182 Resolved merge
178 F
183
179
184 @ 5: F
180 @ 5: F
185 |
181 |
General Comments 0
You need to be logged in to leave comments. Login now