##// END OF EJS Templates
rebase: reinstate old-style rev spec support for the source and base (issue3181)...
Steven Brown -
r15800:e4fc0f0b stable
parent child Browse files
Show More
@@ -15,7 +15,7 b' http://mercurial.selenic.com/wiki/Rebase'
15 15 '''
16 16
17 17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks
18 from mercurial import extensions, patch
18 from mercurial import extensions, patch, scmutil
19 19 from mercurial.commands import templateopts
20 20 from mercurial.node import nullrev
21 21 from mercurial.lock import release
@@ -187,10 +187,11 b' def rebase(ui, repo, **opts):'
187 187 if revf:
188 188 revgen = repo.set('%lr', revf)
189 189 elif srcf:
190 revgen = repo.set('(%r)::', srcf)
190 src = scmutil.revrange(repo, [srcf])
191 revgen = repo.set('(%ld)::', src)
191 192 else:
192 base = basef or '.'
193 revgen = repo.set('(children(ancestor(%r, %d)) and ::(%r))::',
193 base = scmutil.revrange(repo, [basef or '.'])
194 revgen = repo.set('(children(ancestor(%ld, %d)) and ::(%ld))::',
194 195 base, dest, base)
195 196
196 197 rebaseset = [c.rev() for c in revgen]
@@ -19,25 +19,156 b''
19 19 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20 $ cd ..
21 21
22
23 Rebasing descendant onto ancestor across different named branches
24
25 22 $ hg clone -q -u . a a1
26 23
27 24 $ cd a1
28 25
29 $ hg branch dev
30 marked working directory as branch dev
26 $ hg update 3
27 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
28 $ hg branch dev-one
29 marked working directory as branch dev-one
30 (branches are permanent and global, did you want a bookmark?)
31 $ hg ci -m 'dev-one named branch'
32
33 $ hg update 7
34 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
35 $ hg branch dev-two
36 marked working directory as branch dev-two
31 37 (branches are permanent and global, did you want a bookmark?)
32 38
33 39 $ echo x > x
34 40
35 41 $ hg add x
36 42
37 $ hg ci -m 'extra named branch'
43 $ hg ci -m 'dev-two named branch'
44
45 $ hg tglog
46 @ 9: 'dev-two named branch' dev-two
47 |
48 | o 8: 'dev-one named branch' dev-one
49 | |
50 o | 7: 'H'
51 | |
52 +---o 6: 'G'
53 | | |
54 o | | 5: 'F'
55 | | |
56 +---o 4: 'E'
57 | |
58 | o 3: 'D'
59 | |
60 | o 2: 'C'
61 | |
62 | o 1: 'B'
63 |/
64 o 0: 'A'
65
66
67 Branch name containing a dash (issue3181)
68
69 $ hg rebase -b dev-two -d dev-one --keepbranches
70 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
71
72 $ hg tglog
73 @ 9: 'dev-two named branch' dev-two
74 |
75 o 8: 'H'
76 |
77 | o 7: 'G'
78 |/|
79 o | 6: 'F'
80 | |
81 o | 5: 'dev-one named branch' dev-one
82 | |
83 | o 4: 'E'
84 | |
85 o | 3: 'D'
86 | |
87 o | 2: 'C'
88 | |
89 o | 1: 'B'
90 |/
91 o 0: 'A'
92
93 $ hg rebase -s dev-one -d 0 --keepbranches
94 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
38 95
39 96 $ hg tglog
40 @ 8: 'extra named branch' dev
97 @ 8: 'dev-two named branch' dev-two
98 |
99 o 7: 'H'
100 |
101 | o 6: 'G'
102 |/|
103 o | 5: 'F'
104 | |
105 | o 4: 'E'
106 |/
107 | o 3: 'D'
108 | |
109 | o 2: 'C'
110 | |
111 | o 1: 'B'
112 |/
113 o 0: 'A'
114
115 $ hg update 3
116 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
117 $ hg branch dev-one
118 marked working directory as branch dev-one
119 (branches are permanent and global, did you want a bookmark?)
120 $ hg ci -m 'dev-one named branch'
121
122 $ hg tglog
123 @ 9: 'dev-one named branch' dev-one
124 |
125 | o 8: 'dev-two named branch' dev-two
126 | |
127 | o 7: 'H'
128 | |
129 | | o 6: 'G'
130 | |/|
131 | o | 5: 'F'
132 | | |
133 | | o 4: 'E'
134 | |/
135 o | 3: 'D'
136 | |
137 o | 2: 'C'
138 | |
139 o | 1: 'B'
140 |/
141 o 0: 'A'
142
143 $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches
144 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
145
146 $ hg tglog
147 @ 9: 'dev-two named branch' dev-two
148 |
149 o 8: 'H'
150 |
151 | o 7: 'G'
152 |/|
153 o | 6: 'F'
154 | |
155 o | 5: 'dev-one named branch' dev-one
156 | |
157 | o 4: 'E'
158 | |
159 o | 3: 'D'
160 | |
161 o | 2: 'C'
162 | |
163 o | 1: 'B'
164 |/
165 o 0: 'A'
166
167 $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches
168 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
169
170 $ hg tglog
171 @ 8: 'dev-two named branch' dev-two
41 172 |
42 173 o 7: 'H'
43 174 |
@@ -56,6 +187,7 b' Rebasing descendant onto ancestor across'
56 187 o 0: 'A'
57 188
58 189
190 Rebasing descendant onto ancestor across different named branches
59 191
60 192 $ hg rebase -s 1 -d 8 --keepbranches
61 193 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
@@ -67,7 +199,7 b' Rebasing descendant onto ancestor across'
67 199 |
68 200 o 6: 'B'
69 201 |
70 o 5: 'extra named branch' dev
202 o 5: 'dev-two named branch' dev-two
71 203 |
72 204 o 4: 'H'
73 205 |
@@ -93,7 +225,7 b' Rebasing descendant onto ancestor across'
93 225 |
94 226 o 6: 'B'
95 227 |
96 o 5: 'extra named branch'
228 o 5: 'dev-two named branch'
97 229 |
98 230 o 4: 'H'
99 231 |
General Comments 0
You need to be logged in to leave comments. Login now