Show More
@@ -1,490 +1,490 b'' | |||||
1 | # destutil.py - Mercurial utility function for command destination |
|
1 | # destutil.py - Mercurial utility function for command destination | |
2 | # |
|
2 | # | |
3 | # Copyright Matt Mackall <mpm@selenic.com> and other |
|
3 | # Copyright Matt Mackall <mpm@selenic.com> and other | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | from .i18n import _ |
|
10 | from .i18n import _ | |
11 | from . import bookmarks, error, obsutil, scmutil, stack |
|
11 | from . import bookmarks, error, obsutil, scmutil, stack | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | def orphanpossibledestination(repo, rev): |
|
14 | def orphanpossibledestination(repo, rev): | |
15 | """Return all changesets that may be a new parent for orphan `rev`. |
|
15 | """Return all changesets that may be a new parent for orphan `rev`. | |
16 |
|
16 | |||
17 | This function works fine on non-orphan revisions, it's just silly |
|
17 | This function works fine on non-orphan revisions, it's just silly | |
18 | because there's no destination implied by obsolete markers, so |
|
18 | because there's no destination implied by obsolete markers, so | |
19 | it'll return nothing. |
|
19 | it'll return nothing. | |
20 | """ |
|
20 | """ | |
21 | tonode = repo.changelog.node |
|
21 | tonode = repo.changelog.node | |
22 | parents = repo.changelog.parentrevs |
|
22 | parents = repo.changelog.parentrevs | |
23 | torev = repo.changelog.rev |
|
23 | torev = repo.changelog.rev | |
24 | dest = set() |
|
24 | dest = set() | |
25 | tovisit = list(parents(rev)) |
|
25 | tovisit = list(parents(rev)) | |
26 | while tovisit: |
|
26 | while tovisit: | |
27 | r = tovisit.pop() |
|
27 | r = tovisit.pop() | |
28 | succsets = obsutil.successorssets(repo, tonode(r)) |
|
28 | succsets = obsutil.successorssets(repo, tonode(r)) | |
29 | if not succsets: |
|
29 | if not succsets: | |
30 | # if there are no successors for r, r was probably pruned |
|
30 | # if there are no successors for r, r was probably pruned | |
31 | # and we should walk up to r's parents to try and find |
|
31 | # and we should walk up to r's parents to try and find | |
32 | # some successors. |
|
32 | # some successors. | |
33 | tovisit.extend(parents(r)) |
|
33 | tovisit.extend(parents(r)) | |
34 | else: |
|
34 | else: | |
35 | # We should probably pick only one destination from split |
|
35 | # We should probably pick only one destination from split | |
36 | # (case where '1 < len(ss)'), This could be the currently |
|
36 | # (case where '1 < len(ss)'), This could be the currently | |
37 | # tipmost, but the correct result is less clear when |
|
37 | # tipmost, but the correct result is less clear when | |
38 | # results of the split have been moved such that they |
|
38 | # results of the split have been moved such that they | |
39 | # reside on multiple branches. |
|
39 | # reside on multiple branches. | |
40 | for ss in succsets: |
|
40 | for ss in succsets: | |
41 | for n in ss: |
|
41 | for n in ss: | |
42 | dr = torev(n) |
|
42 | dr = torev(n) | |
43 | if dr != -1: |
|
43 | if dr != -1: | |
44 | dest.add(dr) |
|
44 | dest.add(dr) | |
45 | return dest |
|
45 | return dest | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | def _destupdateobs(repo, clean): |
|
48 | def _destupdateobs(repo, clean): | |
49 | """decide of an update destination from obsolescence markers""" |
|
49 | """decide of an update destination from obsolescence markers""" | |
50 | node = None |
|
50 | node = None | |
51 | wc = repo[None] |
|
51 | wc = repo[None] | |
52 | p1 = wc.p1() |
|
52 | p1 = wc.p1() | |
53 | movemark = None |
|
53 | movemark = None | |
54 |
|
54 | |||
55 | if p1.obsolete() and not p1.children(): |
|
55 | if p1.obsolete() and not p1.children(): | |
56 | # allow updating to successors |
|
56 | # allow updating to successors | |
57 | successors = obsutil.successorssets(repo, p1.node()) |
|
57 | successors = obsutil.successorssets(repo, p1.node()) | |
58 |
|
58 | |||
59 | # behavior of certain cases is as follows, |
|
59 | # behavior of certain cases is as follows, | |
60 | # |
|
60 | # | |
61 | # divergent changesets: update to highest rev, similar to what |
|
61 | # divergent changesets: update to highest rev, similar to what | |
62 | # is currently done when there are more than one head |
|
62 | # is currently done when there are more than one head | |
63 | # (i.e. 'tip') |
|
63 | # (i.e. 'tip') | |
64 | # |
|
64 | # | |
65 | # replaced changesets: same as divergent except we know there |
|
65 | # replaced changesets: same as divergent except we know there | |
66 | # is no conflict |
|
66 | # is no conflict | |
67 | # |
|
67 | # | |
68 | # pruned changeset: no update is done; though, we could |
|
68 | # pruned changeset: no update is done; though, we could | |
69 | # consider updating to the first non-obsolete parent, |
|
69 | # consider updating to the first non-obsolete parent, | |
70 | # similar to what is current done for 'hg prune' |
|
70 | # similar to what is current done for 'hg prune' | |
71 |
|
71 | |||
72 | if successors: |
|
72 | if successors: | |
73 | # flatten the list here handles both divergent (len > 1) |
|
73 | # flatten the list here handles both divergent (len > 1) | |
74 | # and the usual case (len = 1) |
|
74 | # and the usual case (len = 1) | |
75 | successors = [n for sub in successors for n in sub] |
|
75 | successors = [n for sub in successors for n in sub] | |
76 |
|
76 | |||
77 | # get the max revision for the given successors set, |
|
77 | # get the max revision for the given successors set, | |
78 | # i.e. the 'tip' of a set |
|
78 | # i.e. the 'tip' of a set | |
79 | node = repo.revs(b'max(%ln)', successors).first() |
|
79 | node = repo.revs(b'max(%ln)', successors).first() | |
80 | if bookmarks.isactivewdirparent(repo): |
|
80 | if bookmarks.isactivewdirparent(repo): | |
81 | movemark = repo[b'.'].node() |
|
81 | movemark = repo[b'.'].node() | |
82 | return node, movemark, None |
|
82 | return node, movemark, None | |
83 |
|
83 | |||
84 |
|
84 | |||
85 | def _destupdatebook(repo, clean): |
|
85 | def _destupdatebook(repo, clean): | |
86 | """decide on an update destination from active bookmark""" |
|
86 | """decide on an update destination from active bookmark""" | |
87 | # we also move the active bookmark, if any |
|
87 | # we also move the active bookmark, if any | |
88 | node = None |
|
88 | node = None | |
89 | activemark, movemark = bookmarks.calculateupdate(repo.ui, repo) |
|
89 | activemark, movemark = bookmarks.calculateupdate(repo.ui, repo) | |
90 | if activemark is not None: |
|
90 | if activemark is not None: | |
91 | node = repo._bookmarks[activemark] |
|
91 | node = repo._bookmarks[activemark] | |
92 | return node, movemark, activemark |
|
92 | return node, movemark, activemark | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | def _destupdatebranch(repo, clean): |
|
95 | def _destupdatebranch(repo, clean): | |
96 | """decide on an update destination from current branch |
|
96 | """decide on an update destination from current branch | |
97 |
|
97 | |||
98 | This ignores closed branch heads. |
|
98 | This ignores closed branch heads. | |
99 | """ |
|
99 | """ | |
100 | wc = repo[None] |
|
100 | wc = repo[None] | |
101 | movemark = node = None |
|
101 | movemark = node = None | |
102 | currentbranch = wc.branch() |
|
102 | currentbranch = wc.branch() | |
103 |
|
103 | |||
104 | if clean: |
|
104 | if clean: | |
105 | currentbranch = repo[b'.'].branch() |
|
105 | currentbranch = repo[b'.'].branch() | |
106 |
|
106 | |||
107 | if currentbranch in repo.branchmap(): |
|
107 | if currentbranch in repo.branchmap(): | |
108 | heads = repo.branchheads(currentbranch) |
|
108 | heads = repo.branchheads(currentbranch) | |
109 | if heads: |
|
109 | if heads: | |
110 | node = repo.revs(b'max(.::(%ln))', heads).first() |
|
110 | node = repo.revs(b'max(.::(%ln))', heads).first() | |
111 | if bookmarks.isactivewdirparent(repo): |
|
111 | if bookmarks.isactivewdirparent(repo): | |
112 | movemark = repo[b'.'].node() |
|
112 | movemark = repo[b'.'].node() | |
113 | elif currentbranch == b'default' and not wc.p1(): |
|
113 | elif currentbranch == b'default' and not wc.p1(): | |
114 | # "null" parent belongs to "default" branch, but it doesn't exist, so |
|
114 | # "null" parent belongs to "default" branch, but it doesn't exist, so | |
115 | # update to the tipmost non-closed branch head |
|
115 | # update to the tipmost non-closed branch head | |
116 | node = repo.revs(b'max(head() and not closed())').first() |
|
116 | node = repo.revs(b'max(head() and not closed())').first() | |
117 | else: |
|
117 | else: | |
118 | node = repo[b'.'].node() |
|
118 | node = repo[b'.'].node() | |
119 | return node, movemark, None |
|
119 | return node, movemark, None | |
120 |
|
120 | |||
121 |
|
121 | |||
122 | def _destupdatebranchfallback(repo, clean): |
|
122 | def _destupdatebranchfallback(repo, clean): | |
123 | """decide on an update destination from closed heads in current branch""" |
|
123 | """decide on an update destination from closed heads in current branch""" | |
124 | wc = repo[None] |
|
124 | wc = repo[None] | |
125 | currentbranch = wc.branch() |
|
125 | currentbranch = wc.branch() | |
126 | movemark = None |
|
126 | movemark = None | |
127 | if currentbranch in repo.branchmap(): |
|
127 | if currentbranch in repo.branchmap(): | |
128 | # here, all descendant branch heads are closed |
|
128 | # here, all descendant branch heads are closed | |
129 | heads = repo.branchheads(currentbranch, closed=True) |
|
129 | heads = repo.branchheads(currentbranch, closed=True) | |
130 | assert heads, b"any branch has at least one head" |
|
130 | assert heads, b"any branch has at least one head" | |
131 | node = repo.revs(b'max(.::(%ln))', heads).first() |
|
131 | node = repo.revs(b'max(.::(%ln))', heads).first() | |
132 | assert node is not None, ( |
|
132 | assert node is not None, ( | |
133 | b"any revision has at least " b"one descendant branch head" |
|
133 | b"any revision has at least " b"one descendant branch head" | |
134 | ) |
|
134 | ) | |
135 | if bookmarks.isactivewdirparent(repo): |
|
135 | if bookmarks.isactivewdirparent(repo): | |
136 | movemark = repo[b'.'].node() |
|
136 | movemark = repo[b'.'].node() | |
137 | else: |
|
137 | else: | |
138 | # here, no "default" branch, and all branches are closed |
|
138 | # here, no "default" branch, and all branches are closed | |
139 | node = repo.lookup(b'tip') |
|
139 | node = repo.lookup(b'tip') | |
140 | assert node is not None, b"'tip' exists even in empty repository" |
|
140 | assert node is not None, b"'tip' exists even in empty repository" | |
141 | return node, movemark, None |
|
141 | return node, movemark, None | |
142 |
|
142 | |||
143 |
|
143 | |||
144 | # order in which each step should be evaluated |
|
144 | # order in which each step should be evaluated | |
145 | # steps are run until one finds a destination |
|
145 | # steps are run until one finds a destination | |
146 | destupdatesteps = [b'evolution', b'bookmark', b'branch', b'branchfallback'] |
|
146 | destupdatesteps = [b'evolution', b'bookmark', b'branch', b'branchfallback'] | |
147 | # mapping to ease extension overriding steps. |
|
147 | # mapping to ease extension overriding steps. | |
148 | destupdatestepmap = { |
|
148 | destupdatestepmap = { | |
149 | b'evolution': _destupdateobs, |
|
149 | b'evolution': _destupdateobs, | |
150 | b'bookmark': _destupdatebook, |
|
150 | b'bookmark': _destupdatebook, | |
151 | b'branch': _destupdatebranch, |
|
151 | b'branch': _destupdatebranch, | |
152 | b'branchfallback': _destupdatebranchfallback, |
|
152 | b'branchfallback': _destupdatebranchfallback, | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 |
|
155 | |||
156 | def destupdate(repo, clean=False): |
|
156 | def destupdate(repo, clean=False): | |
157 | """destination for bare update operation |
|
157 | """destination for bare update operation | |
158 |
|
158 | |||
159 | return (rev, movemark, activemark) |
|
159 | return (rev, movemark, activemark) | |
160 |
|
160 | |||
161 | - rev: the revision to update to, |
|
161 | - rev: the revision to update to, | |
162 | - movemark: node to move the active bookmark from |
|
162 | - movemark: node to move the active bookmark from | |
163 | (cf bookmark.calculate update), |
|
163 | (cf bookmark.calculate update), | |
164 | - activemark: a bookmark to activate at the end of the update. |
|
164 | - activemark: a bookmark to activate at the end of the update. | |
165 | """ |
|
165 | """ | |
166 | node = movemark = activemark = None |
|
166 | node = movemark = activemark = None | |
167 |
|
167 | |||
168 | for step in destupdatesteps: |
|
168 | for step in destupdatesteps: | |
169 | node, movemark, activemark = destupdatestepmap[step](repo, clean) |
|
169 | node, movemark, activemark = destupdatestepmap[step](repo, clean) | |
170 | if node is not None: |
|
170 | if node is not None: | |
171 | break |
|
171 | break | |
172 | rev = repo[node].rev() |
|
172 | rev = repo[node].rev() | |
173 |
|
173 | |||
174 | return rev, movemark, activemark |
|
174 | return rev, movemark, activemark | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | msgdestmerge = { |
|
177 | msgdestmerge = { | |
178 | # too many matching divergent bookmark |
|
178 | # too many matching divergent bookmark | |
179 | b'toomanybookmarks': { |
|
179 | b'toomanybookmarks': { | |
180 | b'merge': ( |
|
180 | b'merge': ( | |
181 | _( |
|
181 | _( | |
182 | b"multiple matching bookmarks to merge -" |
|
182 | b"multiple matching bookmarks to merge -" | |
183 | b" please merge with an explicit rev or bookmark" |
|
183 | b" please merge with an explicit rev or bookmark" | |
184 | ), |
|
184 | ), | |
185 | _(b"run 'hg heads' to see all heads"), |
|
185 | _(b"run 'hg heads' to see all heads, specify rev with -r"), | |
186 | ), |
|
186 | ), | |
187 | b'rebase': ( |
|
187 | b'rebase': ( | |
188 | _( |
|
188 | _( | |
189 | b"multiple matching bookmarks to rebase -" |
|
189 | b"multiple matching bookmarks to rebase -" | |
190 | b" please rebase to an explicit rev or bookmark" |
|
190 | b" please rebase to an explicit rev or bookmark" | |
191 | ), |
|
191 | ), | |
192 | _(b"run 'hg heads' to see all heads"), |
|
192 | _(b"run 'hg heads' to see all heads, specify destination with -d"), | |
193 | ), |
|
193 | ), | |
194 | }, |
|
194 | }, | |
195 | # no other matching divergent bookmark |
|
195 | # no other matching divergent bookmark | |
196 | b'nootherbookmarks': { |
|
196 | b'nootherbookmarks': { | |
197 | b'merge': ( |
|
197 | b'merge': ( | |
198 | _( |
|
198 | _( | |
199 | b"no matching bookmark to merge - " |
|
199 | b"no matching bookmark to merge - " | |
200 | b"please merge with an explicit rev or bookmark" |
|
200 | b"please merge with an explicit rev or bookmark" | |
201 | ), |
|
201 | ), | |
202 | _(b"run 'hg heads' to see all heads"), |
|
202 | _(b"run 'hg heads' to see all heads, specify rev with -r"), | |
203 | ), |
|
203 | ), | |
204 | b'rebase': ( |
|
204 | b'rebase': ( | |
205 | _( |
|
205 | _( | |
206 | b"no matching bookmark to rebase - " |
|
206 | b"no matching bookmark to rebase - " | |
207 | b"please rebase to an explicit rev or bookmark" |
|
207 | b"please rebase to an explicit rev or bookmark" | |
208 | ), |
|
208 | ), | |
209 | _(b"run 'hg heads' to see all heads"), |
|
209 | _(b"run 'hg heads' to see all heads, specify destination with -d"), | |
210 | ), |
|
210 | ), | |
211 | }, |
|
211 | }, | |
212 | # branch have too many unbookmarked heads, no obvious destination |
|
212 | # branch have too many unbookmarked heads, no obvious destination | |
213 | b'toomanyheads': { |
|
213 | b'toomanyheads': { | |
214 | b'merge': ( |
|
214 | b'merge': ( | |
215 | _(b"branch '%s' has %d heads - please merge with an explicit rev"), |
|
215 | _(b"branch '%s' has %d heads - please merge with an explicit rev"), | |
216 | _(b"run 'hg heads .' to see heads"), |
|
216 | _(b"run 'hg heads .' to see heads, specify rev with -r"), | |
217 | ), |
|
217 | ), | |
218 | b'rebase': ( |
|
218 | b'rebase': ( | |
219 | _(b"branch '%s' has %d heads - please rebase to an explicit rev"), |
|
219 | _(b"branch '%s' has %d heads - please rebase to an explicit rev"), | |
220 | _(b"run 'hg heads .' to see heads"), |
|
220 | _(b"run 'hg heads .' to see heads, specify destination with -d"), | |
221 | ), |
|
221 | ), | |
222 | }, |
|
222 | }, | |
223 | # branch have no other unbookmarked heads |
|
223 | # branch have no other unbookmarked heads | |
224 | b'bookmarkedheads': { |
|
224 | b'bookmarkedheads': { | |
225 | b'merge': ( |
|
225 | b'merge': ( | |
226 | _(b"heads are bookmarked - please merge with an explicit rev"), |
|
226 | _(b"heads are bookmarked - please merge with an explicit rev"), | |
227 | _(b"run 'hg heads' to see all heads"), |
|
227 | _(b"run 'hg heads' to see all heads, specify rev with -r"), | |
228 | ), |
|
228 | ), | |
229 | b'rebase': ( |
|
229 | b'rebase': ( | |
230 | _(b"heads are bookmarked - please rebase to an explicit rev"), |
|
230 | _(b"heads are bookmarked - please rebase to an explicit rev"), | |
231 | _(b"run 'hg heads' to see all heads"), |
|
231 | _(b"run 'hg heads' to see all heads, specify destination with -d"), | |
232 | ), |
|
232 | ), | |
233 | }, |
|
233 | }, | |
234 | # branch have just a single heads, but there is other branches |
|
234 | # branch have just a single heads, but there is other branches | |
235 | b'nootherbranchheads': { |
|
235 | b'nootherbranchheads': { | |
236 | b'merge': ( |
|
236 | b'merge': ( | |
237 | _(b"branch '%s' has one head - please merge with an explicit rev"), |
|
237 | _(b"branch '%s' has one head - please merge with an explicit rev"), | |
238 | _(b"run 'hg heads' to see all heads"), |
|
238 | _(b"run 'hg heads' to see all heads, specify rev with -r"), | |
239 | ), |
|
239 | ), | |
240 | b'rebase': ( |
|
240 | b'rebase': ( | |
241 | _(b"branch '%s' has one head - please rebase to an explicit rev"), |
|
241 | _(b"branch '%s' has one head - please rebase to an explicit rev"), | |
242 | _(b"run 'hg heads' to see all heads"), |
|
242 | _(b"run 'hg heads' to see all heads, specify destination with -d"), | |
243 | ), |
|
243 | ), | |
244 | }, |
|
244 | }, | |
245 | # repository have a single head |
|
245 | # repository have a single head | |
246 | b'nootherheads': { |
|
246 | b'nootherheads': { | |
247 | b'merge': (_(b'nothing to merge'), None), |
|
247 | b'merge': (_(b'nothing to merge'), None), | |
248 | b'rebase': (_(b'nothing to rebase'), None), |
|
248 | b'rebase': (_(b'nothing to rebase'), None), | |
249 | }, |
|
249 | }, | |
250 | # repository have a single head and we are not on it |
|
250 | # repository have a single head and we are not on it | |
251 | b'nootherheadsbehind': { |
|
251 | b'nootherheadsbehind': { | |
252 | b'merge': (_(b'nothing to merge'), _(b"use 'hg update' instead")), |
|
252 | b'merge': (_(b'nothing to merge'), _(b"use 'hg update' instead")), | |
253 | b'rebase': (_(b'nothing to rebase'), _(b"use 'hg update' instead")), |
|
253 | b'rebase': (_(b'nothing to rebase'), _(b"use 'hg update' instead")), | |
254 | }, |
|
254 | }, | |
255 | # We are not on a head |
|
255 | # We are not on a head | |
256 | b'notatheads': { |
|
256 | b'notatheads': { | |
257 | b'merge': ( |
|
257 | b'merge': ( | |
258 | _(b'working directory not at a head revision'), |
|
258 | _(b'working directory not at a head revision'), | |
259 | _(b"use 'hg update' or merge with an explicit revision"), |
|
259 | _(b"use 'hg update' or merge with an explicit revision"), | |
260 | ), |
|
260 | ), | |
261 | b'rebase': ( |
|
261 | b'rebase': ( | |
262 | _(b'working directory not at a head revision'), |
|
262 | _(b'working directory not at a head revision'), | |
263 | _(b"use 'hg update' or rebase to an explicit revision"), |
|
263 | _(b"use 'hg update' or rebase to an explicit revision"), | |
264 | ), |
|
264 | ), | |
265 | }, |
|
265 | }, | |
266 | b'emptysourceset': { |
|
266 | b'emptysourceset': { | |
267 | b'merge': (_(b'source set is empty'), None), |
|
267 | b'merge': (_(b'source set is empty'), None), | |
268 | b'rebase': (_(b'source set is empty'), None), |
|
268 | b'rebase': (_(b'source set is empty'), None), | |
269 | }, |
|
269 | }, | |
270 | b'multiplebranchessourceset': { |
|
270 | b'multiplebranchessourceset': { | |
271 | b'merge': (_(b'source set is rooted in multiple branches'), None), |
|
271 | b'merge': (_(b'source set is rooted in multiple branches'), None), | |
272 | b'rebase': ( |
|
272 | b'rebase': ( | |
273 | _(b'rebaseset is rooted in multiple named branches'), |
|
273 | _(b'rebaseset is rooted in multiple named branches'), | |
274 | _(b'specify an explicit destination with --dest'), |
|
274 | _(b'specify an explicit destination with --dest'), | |
275 | ), |
|
275 | ), | |
276 | }, |
|
276 | }, | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 |
|
279 | |||
280 | def _destmergebook(repo, action=b'merge', sourceset=None, destspace=None): |
|
280 | def _destmergebook(repo, action=b'merge', sourceset=None, destspace=None): | |
281 | """find merge destination in the active bookmark case""" |
|
281 | """find merge destination in the active bookmark case""" | |
282 | node = None |
|
282 | node = None | |
283 | bmheads = bookmarks.headsforactive(repo) |
|
283 | bmheads = bookmarks.headsforactive(repo) | |
284 | curhead = repo._bookmarks[repo._activebookmark] |
|
284 | curhead = repo._bookmarks[repo._activebookmark] | |
285 | if len(bmheads) == 2: |
|
285 | if len(bmheads) == 2: | |
286 | if curhead == bmheads[0]: |
|
286 | if curhead == bmheads[0]: | |
287 | node = bmheads[1] |
|
287 | node = bmheads[1] | |
288 | else: |
|
288 | else: | |
289 | node = bmheads[0] |
|
289 | node = bmheads[0] | |
290 | elif len(bmheads) > 2: |
|
290 | elif len(bmheads) > 2: | |
291 | msg, hint = msgdestmerge[b'toomanybookmarks'][action] |
|
291 | msg, hint = msgdestmerge[b'toomanybookmarks'][action] | |
292 | raise error.ManyMergeDestAbort(msg, hint=hint) |
|
292 | raise error.ManyMergeDestAbort(msg, hint=hint) | |
293 | elif len(bmheads) <= 1: |
|
293 | elif len(bmheads) <= 1: | |
294 | msg, hint = msgdestmerge[b'nootherbookmarks'][action] |
|
294 | msg, hint = msgdestmerge[b'nootherbookmarks'][action] | |
295 | raise error.NoMergeDestAbort(msg, hint=hint) |
|
295 | raise error.NoMergeDestAbort(msg, hint=hint) | |
296 | assert node is not None |
|
296 | assert node is not None | |
297 | return node |
|
297 | return node | |
298 |
|
298 | |||
299 |
|
299 | |||
300 | def _destmergebranch( |
|
300 | def _destmergebranch( | |
301 | repo, action=b'merge', sourceset=None, onheadcheck=True, destspace=None |
|
301 | repo, action=b'merge', sourceset=None, onheadcheck=True, destspace=None | |
302 | ): |
|
302 | ): | |
303 | """find merge destination based on branch heads""" |
|
303 | """find merge destination based on branch heads""" | |
304 | node = None |
|
304 | node = None | |
305 |
|
305 | |||
306 | if sourceset is None: |
|
306 | if sourceset is None: | |
307 | sourceset = [repo[repo.dirstate.p1()].rev()] |
|
307 | sourceset = [repo[repo.dirstate.p1()].rev()] | |
308 | branch = repo.dirstate.branch() |
|
308 | branch = repo.dirstate.branch() | |
309 | elif not sourceset: |
|
309 | elif not sourceset: | |
310 | msg, hint = msgdestmerge[b'emptysourceset'][action] |
|
310 | msg, hint = msgdestmerge[b'emptysourceset'][action] | |
311 | raise error.NoMergeDestAbort(msg, hint=hint) |
|
311 | raise error.NoMergeDestAbort(msg, hint=hint) | |
312 | else: |
|
312 | else: | |
313 | branch = None |
|
313 | branch = None | |
314 | for ctx in repo.set(b'roots(%ld::%ld)', sourceset, sourceset): |
|
314 | for ctx in repo.set(b'roots(%ld::%ld)', sourceset, sourceset): | |
315 | if branch is not None and ctx.branch() != branch: |
|
315 | if branch is not None and ctx.branch() != branch: | |
316 | msg, hint = msgdestmerge[b'multiplebranchessourceset'][action] |
|
316 | msg, hint = msgdestmerge[b'multiplebranchessourceset'][action] | |
317 | raise error.ManyMergeDestAbort(msg, hint=hint) |
|
317 | raise error.ManyMergeDestAbort(msg, hint=hint) | |
318 | branch = ctx.branch() |
|
318 | branch = ctx.branch() | |
319 |
|
319 | |||
320 | bheads = repo.branchheads(branch) |
|
320 | bheads = repo.branchheads(branch) | |
321 | onhead = repo.revs(b'%ld and %ln', sourceset, bheads) |
|
321 | onhead = repo.revs(b'%ld and %ln', sourceset, bheads) | |
322 | if onheadcheck and not onhead: |
|
322 | if onheadcheck and not onhead: | |
323 | # Case A: working copy if not on a head. (merge only) |
|
323 | # Case A: working copy if not on a head. (merge only) | |
324 | # |
|
324 | # | |
325 | # This is probably a user mistake We bailout pointing at 'hg update' |
|
325 | # This is probably a user mistake We bailout pointing at 'hg update' | |
326 | if len(repo.heads()) <= 1: |
|
326 | if len(repo.heads()) <= 1: | |
327 | msg, hint = msgdestmerge[b'nootherheadsbehind'][action] |
|
327 | msg, hint = msgdestmerge[b'nootherheadsbehind'][action] | |
328 | else: |
|
328 | else: | |
329 | msg, hint = msgdestmerge[b'notatheads'][action] |
|
329 | msg, hint = msgdestmerge[b'notatheads'][action] | |
330 | raise error.Abort(msg, hint=hint) |
|
330 | raise error.Abort(msg, hint=hint) | |
331 | # remove heads descendants of source from the set |
|
331 | # remove heads descendants of source from the set | |
332 | bheads = list(repo.revs(b'%ln - (%ld::)', bheads, sourceset)) |
|
332 | bheads = list(repo.revs(b'%ln - (%ld::)', bheads, sourceset)) | |
333 | # filters out bookmarked heads |
|
333 | # filters out bookmarked heads | |
334 | nbhs = list(repo.revs(b'%ld - bookmark()', bheads)) |
|
334 | nbhs = list(repo.revs(b'%ld - bookmark()', bheads)) | |
335 |
|
335 | |||
336 | if destspace is not None: |
|
336 | if destspace is not None: | |
337 | # restrict search space |
|
337 | # restrict search space | |
338 | # used in the 'hg pull --rebase' case, see issue 5214. |
|
338 | # used in the 'hg pull --rebase' case, see issue 5214. | |
339 | nbhs = list(repo.revs(b'%ld and %ld', destspace, nbhs)) |
|
339 | nbhs = list(repo.revs(b'%ld and %ld', destspace, nbhs)) | |
340 |
|
340 | |||
341 | if len(nbhs) > 1: |
|
341 | if len(nbhs) > 1: | |
342 | # Case B: There is more than 1 other anonymous heads |
|
342 | # Case B: There is more than 1 other anonymous heads | |
343 | # |
|
343 | # | |
344 | # This means that there will be more than 1 candidate. This is |
|
344 | # This means that there will be more than 1 candidate. This is | |
345 | # ambiguous. We abort asking the user to pick as explicit destination |
|
345 | # ambiguous. We abort asking the user to pick as explicit destination | |
346 | # instead. |
|
346 | # instead. | |
347 | msg, hint = msgdestmerge[b'toomanyheads'][action] |
|
347 | msg, hint = msgdestmerge[b'toomanyheads'][action] | |
348 | msg %= (branch, len(bheads) + 1) |
|
348 | msg %= (branch, len(bheads) + 1) | |
349 | raise error.ManyMergeDestAbort(msg, hint=hint) |
|
349 | raise error.ManyMergeDestAbort(msg, hint=hint) | |
350 | elif not nbhs: |
|
350 | elif not nbhs: | |
351 | # Case B: There is no other anonymous heads |
|
351 | # Case B: There is no other anonymous heads | |
352 | # |
|
352 | # | |
353 | # This means that there is no natural candidate to merge with. |
|
353 | # This means that there is no natural candidate to merge with. | |
354 | # We abort, with various messages for various cases. |
|
354 | # We abort, with various messages for various cases. | |
355 | if bheads: |
|
355 | if bheads: | |
356 | msg, hint = msgdestmerge[b'bookmarkedheads'][action] |
|
356 | msg, hint = msgdestmerge[b'bookmarkedheads'][action] | |
357 | elif len(repo.heads()) > 1: |
|
357 | elif len(repo.heads()) > 1: | |
358 | msg, hint = msgdestmerge[b'nootherbranchheads'][action] |
|
358 | msg, hint = msgdestmerge[b'nootherbranchheads'][action] | |
359 | msg %= branch |
|
359 | msg %= branch | |
360 | elif not onhead: |
|
360 | elif not onhead: | |
361 | # if 'onheadcheck == False' (rebase case), |
|
361 | # if 'onheadcheck == False' (rebase case), | |
362 | # this was not caught in Case A. |
|
362 | # this was not caught in Case A. | |
363 | msg, hint = msgdestmerge[b'nootherheadsbehind'][action] |
|
363 | msg, hint = msgdestmerge[b'nootherheadsbehind'][action] | |
364 | else: |
|
364 | else: | |
365 | msg, hint = msgdestmerge[b'nootherheads'][action] |
|
365 | msg, hint = msgdestmerge[b'nootherheads'][action] | |
366 | raise error.NoMergeDestAbort(msg, hint=hint) |
|
366 | raise error.NoMergeDestAbort(msg, hint=hint) | |
367 | else: |
|
367 | else: | |
368 | node = nbhs[0] |
|
368 | node = nbhs[0] | |
369 | assert node is not None |
|
369 | assert node is not None | |
370 | return node |
|
370 | return node | |
371 |
|
371 | |||
372 |
|
372 | |||
373 | def destmerge( |
|
373 | def destmerge( | |
374 | repo, action=b'merge', sourceset=None, onheadcheck=True, destspace=None |
|
374 | repo, action=b'merge', sourceset=None, onheadcheck=True, destspace=None | |
375 | ): |
|
375 | ): | |
376 | """return the default destination for a merge |
|
376 | """return the default destination for a merge | |
377 |
|
377 | |||
378 | (or raise exception about why it can't pick one) |
|
378 | (or raise exception about why it can't pick one) | |
379 |
|
379 | |||
380 | :action: the action being performed, controls emitted error message |
|
380 | :action: the action being performed, controls emitted error message | |
381 | """ |
|
381 | """ | |
382 | # destspace is here to work around issues with `hg pull --rebase` see |
|
382 | # destspace is here to work around issues with `hg pull --rebase` see | |
383 | # issue5214 for details |
|
383 | # issue5214 for details | |
384 | if repo._activebookmark: |
|
384 | if repo._activebookmark: | |
385 | node = _destmergebook( |
|
385 | node = _destmergebook( | |
386 | repo, action=action, sourceset=sourceset, destspace=destspace |
|
386 | repo, action=action, sourceset=sourceset, destspace=destspace | |
387 | ) |
|
387 | ) | |
388 | else: |
|
388 | else: | |
389 | node = _destmergebranch( |
|
389 | node = _destmergebranch( | |
390 | repo, |
|
390 | repo, | |
391 | action=action, |
|
391 | action=action, | |
392 | sourceset=sourceset, |
|
392 | sourceset=sourceset, | |
393 | onheadcheck=onheadcheck, |
|
393 | onheadcheck=onheadcheck, | |
394 | destspace=destspace, |
|
394 | destspace=destspace, | |
395 | ) |
|
395 | ) | |
396 | return repo[node].rev() |
|
396 | return repo[node].rev() | |
397 |
|
397 | |||
398 |
|
398 | |||
399 | def desthistedit(ui, repo): |
|
399 | def desthistedit(ui, repo): | |
400 | """Default base revision to edit for `hg histedit`.""" |
|
400 | """Default base revision to edit for `hg histedit`.""" | |
401 | default = ui.config(b'histedit', b'defaultrev') |
|
401 | default = ui.config(b'histedit', b'defaultrev') | |
402 |
|
402 | |||
403 | if default is None: |
|
403 | if default is None: | |
404 | revs = stack.getstack(repo) |
|
404 | revs = stack.getstack(repo) | |
405 | elif default: |
|
405 | elif default: | |
406 | revs = scmutil.revrange(repo, [default]) |
|
406 | revs = scmutil.revrange(repo, [default]) | |
407 | else: |
|
407 | else: | |
408 | raise error.Abort( |
|
408 | raise error.Abort( | |
409 | _(b"config option histedit.defaultrev can't be empty") |
|
409 | _(b"config option histedit.defaultrev can't be empty") | |
410 | ) |
|
410 | ) | |
411 |
|
411 | |||
412 | if revs: |
|
412 | if revs: | |
413 | # Take the first revision of the revset as the root |
|
413 | # Take the first revision of the revset as the root | |
414 | return revs.min() |
|
414 | return revs.min() | |
415 |
|
415 | |||
416 | return None |
|
416 | return None | |
417 |
|
417 | |||
418 |
|
418 | |||
419 | def stackbase(ui, repo): |
|
419 | def stackbase(ui, repo): | |
420 | revs = stack.getstack(repo) |
|
420 | revs = stack.getstack(repo) | |
421 | return revs.first() if revs else None |
|
421 | return revs.first() if revs else None | |
422 |
|
422 | |||
423 |
|
423 | |||
424 | def _statusotherbook(ui, repo): |
|
424 | def _statusotherbook(ui, repo): | |
425 | bmheads = bookmarks.headsforactive(repo) |
|
425 | bmheads = bookmarks.headsforactive(repo) | |
426 | curhead = repo._bookmarks[repo._activebookmark] |
|
426 | curhead = repo._bookmarks[repo._activebookmark] | |
427 | if repo.revs(b'%n and parents()', curhead): |
|
427 | if repo.revs(b'%n and parents()', curhead): | |
428 | # we are on the active bookmark |
|
428 | # we are on the active bookmark | |
429 | bmheads = [b for b in bmheads if curhead != b] |
|
429 | bmheads = [b for b in bmheads if curhead != b] | |
430 | if bmheads: |
|
430 | if bmheads: | |
431 | msg = _(b'%i other divergent bookmarks for "%s"\n') |
|
431 | msg = _(b'%i other divergent bookmarks for "%s"\n') | |
432 | ui.status(msg % (len(bmheads), repo._activebookmark)) |
|
432 | ui.status(msg % (len(bmheads), repo._activebookmark)) | |
433 |
|
433 | |||
434 |
|
434 | |||
435 | def _statusotherbranchheads(ui, repo): |
|
435 | def _statusotherbranchheads(ui, repo): | |
436 | currentbranch = repo.dirstate.branch() |
|
436 | currentbranch = repo.dirstate.branch() | |
437 | allheads = repo.branchheads(currentbranch, closed=True) |
|
437 | allheads = repo.branchheads(currentbranch, closed=True) | |
438 | heads = repo.branchheads(currentbranch) |
|
438 | heads = repo.branchheads(currentbranch) | |
439 | if repo.revs(b'%ln and parents()', allheads): |
|
439 | if repo.revs(b'%ln and parents()', allheads): | |
440 | # we are on a head, even though it might be closed |
|
440 | # we are on a head, even though it might be closed | |
441 | # |
|
441 | # | |
442 | # on closed otherheads |
|
442 | # on closed otherheads | |
443 | # ========= ========== |
|
443 | # ========= ========== | |
444 | # o 0 all heads for current branch are closed |
|
444 | # o 0 all heads for current branch are closed | |
445 | # N only descendant branch heads are closed |
|
445 | # N only descendant branch heads are closed | |
446 | # x 0 there is only one non-closed branch head |
|
446 | # x 0 there is only one non-closed branch head | |
447 | # N there are some non-closed branch heads |
|
447 | # N there are some non-closed branch heads | |
448 | # ========= ========== |
|
448 | # ========= ========== | |
449 | otherheads = repo.revs(b'%ln - parents()', heads) |
|
449 | otherheads = repo.revs(b'%ln - parents()', heads) | |
450 | if repo[b'.'].closesbranch(): |
|
450 | if repo[b'.'].closesbranch(): | |
451 | ui.warn( |
|
451 | ui.warn( | |
452 | _( |
|
452 | _( | |
453 | b'no open descendant heads on branch "%s", ' |
|
453 | b'no open descendant heads on branch "%s", ' | |
454 | b'updating to a closed head\n' |
|
454 | b'updating to a closed head\n' | |
455 | ) |
|
455 | ) | |
456 | % currentbranch |
|
456 | % currentbranch | |
457 | ) |
|
457 | ) | |
458 | if otherheads: |
|
458 | if otherheads: | |
459 | ui.warn( |
|
459 | ui.warn( | |
460 | _( |
|
460 | _( | |
461 | b"(committing will reopen the head, " |
|
461 | b"(committing will reopen the head, " | |
462 | b"use 'hg heads .' to see %i other heads)\n" |
|
462 | b"use 'hg heads .' to see %i other heads)\n" | |
463 | ) |
|
463 | ) | |
464 | % (len(otherheads)) |
|
464 | % (len(otherheads)) | |
465 | ) |
|
465 | ) | |
466 | else: |
|
466 | else: | |
467 | ui.warn( |
|
467 | ui.warn( | |
468 | _(b'(committing will reopen branch "%s")\n') % currentbranch |
|
468 | _(b'(committing will reopen branch "%s")\n') % currentbranch | |
469 | ) |
|
469 | ) | |
470 | elif otherheads: |
|
470 | elif otherheads: | |
471 | curhead = repo[b'.'] |
|
471 | curhead = repo[b'.'] | |
472 | ui.status( |
|
472 | ui.status( | |
473 | _(b'updated to "%s: %s"\n') |
|
473 | _(b'updated to "%s: %s"\n') | |
474 | % (curhead, curhead.description().split(b'\n')[0]) |
|
474 | % (curhead, curhead.description().split(b'\n')[0]) | |
475 | ) |
|
475 | ) | |
476 | ui.status( |
|
476 | ui.status( | |
477 | _(b'%i other heads for branch "%s"\n') |
|
477 | _(b'%i other heads for branch "%s"\n') | |
478 | % (len(otherheads), currentbranch) |
|
478 | % (len(otherheads), currentbranch) | |
479 | ) |
|
479 | ) | |
480 |
|
480 | |||
481 |
|
481 | |||
482 | def statusotherdests(ui, repo): |
|
482 | def statusotherdests(ui, repo): | |
483 | """Print message about other head""" |
|
483 | """Print message about other head""" | |
484 | # XXX we should probably include a hint: |
|
484 | # XXX we should probably include a hint: | |
485 | # - about what to do |
|
485 | # - about what to do | |
486 | # - how to see such heads |
|
486 | # - how to see such heads | |
487 | if repo._activebookmark: |
|
487 | if repo._activebookmark: | |
488 | _statusotherbook(ui, repo) |
|
488 | _statusotherbook(ui, repo) | |
489 | else: |
|
489 | else: | |
490 | _statusotherbranchheads(ui, repo) |
|
490 | _statusotherbranchheads(ui, repo) |
@@ -1,152 +1,152 b'' | |||||
1 | # init |
|
1 | # init | |
2 |
|
2 | |||
3 | $ hg init |
|
3 | $ hg init | |
4 | $ echo a > a |
|
4 | $ echo a > a | |
5 | $ hg add a |
|
5 | $ hg add a | |
6 | $ hg commit -m'a' |
|
6 | $ hg commit -m'a' | |
7 | $ echo b > b |
|
7 | $ echo b > b | |
8 | $ hg add b |
|
8 | $ hg add b | |
9 | $ hg commit -m'b' |
|
9 | $ hg commit -m'b' | |
10 | $ hg up -C 0 |
|
10 | $ hg up -C 0 | |
11 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
11 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
12 | $ echo c > c |
|
12 | $ echo c > c | |
13 | $ hg add c |
|
13 | $ hg add c | |
14 | $ hg commit -m'c' |
|
14 | $ hg commit -m'c' | |
15 | created new head |
|
15 | created new head | |
16 |
|
16 | |||
17 | # test merging of diverged bookmarks |
|
17 | # test merging of diverged bookmarks | |
18 | $ hg bookmark -r 1 "c@diverge" |
|
18 | $ hg bookmark -r 1 "c@diverge" | |
19 | $ hg bookmark -r 1 b |
|
19 | $ hg bookmark -r 1 b | |
20 | $ hg bookmark c |
|
20 | $ hg bookmark c | |
21 | $ hg bookmarks |
|
21 | $ hg bookmarks | |
22 | b 1:d2ae7f538514 |
|
22 | b 1:d2ae7f538514 | |
23 | * c 2:d36c0562f908 |
|
23 | * c 2:d36c0562f908 | |
24 | c@diverge 1:d2ae7f538514 |
|
24 | c@diverge 1:d2ae7f538514 | |
25 | $ hg merge "c@diverge" |
|
25 | $ hg merge "c@diverge" | |
26 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
26 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
27 | (branch merge, don't forget to commit) |
|
27 | (branch merge, don't forget to commit) | |
28 | $ hg commit -m'merge' |
|
28 | $ hg commit -m'merge' | |
29 | $ hg bookmarks |
|
29 | $ hg bookmarks | |
30 | b 1:d2ae7f538514 |
|
30 | b 1:d2ae7f538514 | |
31 | * c 3:b8f96cf4688b |
|
31 | * c 3:b8f96cf4688b | |
32 |
|
32 | |||
33 | $ hg up -C 3 |
|
33 | $ hg up -C 3 | |
34 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
35 | (leaving bookmark c) |
|
35 | (leaving bookmark c) | |
36 | $ echo d > d |
|
36 | $ echo d > d | |
37 | $ hg add d |
|
37 | $ hg add d | |
38 | $ hg commit -m'd' |
|
38 | $ hg commit -m'd' | |
39 |
|
39 | |||
40 | $ hg up -C 3 |
|
40 | $ hg up -C 3 | |
41 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
41 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
42 | $ echo e > e |
|
42 | $ echo e > e | |
43 | $ hg add e |
|
43 | $ hg add e | |
44 | $ hg commit -m'e' |
|
44 | $ hg commit -m'e' | |
45 | created new head |
|
45 | created new head | |
46 | $ hg up -C 5 |
|
46 | $ hg up -C 5 | |
47 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
47 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
48 | $ hg bookmark e |
|
48 | $ hg bookmark e | |
49 | $ hg bookmarks |
|
49 | $ hg bookmarks | |
50 | b 1:d2ae7f538514 |
|
50 | b 1:d2ae7f538514 | |
51 | c 3:b8f96cf4688b |
|
51 | c 3:b8f96cf4688b | |
52 | * e 5:26bee9c5bcf3 |
|
52 | * e 5:26bee9c5bcf3 | |
53 |
|
53 | |||
54 | # the picked side is bookmarked |
|
54 | # the picked side is bookmarked | |
55 |
|
55 | |||
56 | $ hg up -C 4 |
|
56 | $ hg up -C 4 | |
57 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
57 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
58 | (leaving bookmark e) |
|
58 | (leaving bookmark e) | |
59 | $ hg merge |
|
59 | $ hg merge | |
60 | abort: heads are bookmarked - please merge with an explicit rev |
|
60 | abort: heads are bookmarked - please merge with an explicit rev | |
61 | (run 'hg heads' to see all heads) |
|
61 | (run 'hg heads' to see all heads, specify rev with -r) | |
62 | [255] |
|
62 | [255] | |
63 |
|
63 | |||
64 | # our revision is bookmarked |
|
64 | # our revision is bookmarked | |
65 |
|
65 | |||
66 | $ hg up -C e |
|
66 | $ hg up -C e | |
67 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
67 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
68 | (activating bookmark e) |
|
68 | (activating bookmark e) | |
69 | $ hg merge |
|
69 | $ hg merge | |
70 | abort: no matching bookmark to merge - please merge with an explicit rev or bookmark |
|
70 | abort: no matching bookmark to merge - please merge with an explicit rev or bookmark | |
71 | (run 'hg heads' to see all heads) |
|
71 | (run 'hg heads' to see all heads, specify rev with -r) | |
72 | [255] |
|
72 | [255] | |
73 |
|
73 | |||
74 | # merge bookmark heads |
|
74 | # merge bookmark heads | |
75 |
|
75 | |||
76 | $ hg up -C 4 |
|
76 | $ hg up -C 4 | |
77 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
77 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
78 | (leaving bookmark e) |
|
78 | (leaving bookmark e) | |
79 | $ echo f > f |
|
79 | $ echo f > f | |
80 | $ hg commit -Am "f" |
|
80 | $ hg commit -Am "f" | |
81 | adding f |
|
81 | adding f | |
82 | $ hg bookmarks -r 4 "e@diverged" |
|
82 | $ hg bookmarks -r 4 "e@diverged" | |
83 | $ hg up -q -C "e@diverged" |
|
83 | $ hg up -q -C "e@diverged" | |
84 | $ hg merge |
|
84 | $ hg merge | |
85 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
85 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
86 | (branch merge, don't forget to commit) |
|
86 | (branch merge, don't forget to commit) | |
87 | $ hg parents |
|
87 | $ hg parents | |
88 | changeset: 4:a0546fcfe0fb |
|
88 | changeset: 4:a0546fcfe0fb | |
89 | bookmark: e@diverged |
|
89 | bookmark: e@diverged | |
90 | user: test |
|
90 | user: test | |
91 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
91 | date: Thu Jan 01 00:00:00 1970 +0000 | |
92 | summary: d |
|
92 | summary: d | |
93 |
|
93 | |||
94 | changeset: 5:26bee9c5bcf3 |
|
94 | changeset: 5:26bee9c5bcf3 | |
95 | bookmark: e |
|
95 | bookmark: e | |
96 | parent: 3:b8f96cf4688b |
|
96 | parent: 3:b8f96cf4688b | |
97 | user: test |
|
97 | user: test | |
98 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
98 | date: Thu Jan 01 00:00:00 1970 +0000 | |
99 | summary: e |
|
99 | summary: e | |
100 |
|
100 | |||
101 | $ hg up -C e |
|
101 | $ hg up -C e | |
102 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
102 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
103 | (activating bookmark e) |
|
103 | (activating bookmark e) | |
104 | $ hg bookmarks |
|
104 | $ hg bookmarks | |
105 | b 1:d2ae7f538514 |
|
105 | b 1:d2ae7f538514 | |
106 | c 3:b8f96cf4688b |
|
106 | c 3:b8f96cf4688b | |
107 | * e 5:26bee9c5bcf3 |
|
107 | * e 5:26bee9c5bcf3 | |
108 | e@diverged 4:a0546fcfe0fb |
|
108 | e@diverged 4:a0546fcfe0fb | |
109 | $ hg merge |
|
109 | $ hg merge | |
110 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 | (branch merge, don't forget to commit) |
|
111 | (branch merge, don't forget to commit) | |
112 | $ hg commit -m'merge' |
|
112 | $ hg commit -m'merge' | |
113 | $ hg bookmarks |
|
113 | $ hg bookmarks | |
114 | b 1:d2ae7f538514 |
|
114 | b 1:d2ae7f538514 | |
115 | c 3:b8f96cf4688b |
|
115 | c 3:b8f96cf4688b | |
116 | * e 7:ca784329f0ba |
|
116 | * e 7:ca784329f0ba | |
117 |
|
117 | |||
118 | # test warning when all heads are inactive bookmarks |
|
118 | # test warning when all heads are inactive bookmarks | |
119 |
|
119 | |||
120 | $ hg up -C 6 |
|
120 | $ hg up -C 6 | |
121 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
121 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
122 | (leaving bookmark e) |
|
122 | (leaving bookmark e) | |
123 | $ echo g > g |
|
123 | $ echo g > g | |
124 | $ hg commit -Am 'g' |
|
124 | $ hg commit -Am 'g' | |
125 | adding g |
|
125 | adding g | |
126 | $ hg bookmark -i g |
|
126 | $ hg bookmark -i g | |
127 | $ hg bookmarks |
|
127 | $ hg bookmarks | |
128 | b 1:d2ae7f538514 |
|
128 | b 1:d2ae7f538514 | |
129 | c 3:b8f96cf4688b |
|
129 | c 3:b8f96cf4688b | |
130 | e 7:ca784329f0ba |
|
130 | e 7:ca784329f0ba | |
131 | g 8:04dd21731d95 |
|
131 | g 8:04dd21731d95 | |
132 | $ hg heads |
|
132 | $ hg heads | |
133 | changeset: 8:04dd21731d95 |
|
133 | changeset: 8:04dd21731d95 | |
134 | bookmark: g |
|
134 | bookmark: g | |
135 | tag: tip |
|
135 | tag: tip | |
136 | parent: 6:be381d1126a0 |
|
136 | parent: 6:be381d1126a0 | |
137 | user: test |
|
137 | user: test | |
138 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
138 | date: Thu Jan 01 00:00:00 1970 +0000 | |
139 | summary: g |
|
139 | summary: g | |
140 |
|
140 | |||
141 | changeset: 7:ca784329f0ba |
|
141 | changeset: 7:ca784329f0ba | |
142 | bookmark: e |
|
142 | bookmark: e | |
143 | parent: 5:26bee9c5bcf3 |
|
143 | parent: 5:26bee9c5bcf3 | |
144 | parent: 4:a0546fcfe0fb |
|
144 | parent: 4:a0546fcfe0fb | |
145 | user: test |
|
145 | user: test | |
146 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
146 | date: Thu Jan 01 00:00:00 1970 +0000 | |
147 | summary: merge |
|
147 | summary: merge | |
148 |
|
148 | |||
149 | $ hg merge |
|
149 | $ hg merge | |
150 | abort: heads are bookmarked - please merge with an explicit rev |
|
150 | abort: heads are bookmarked - please merge with an explicit rev | |
151 | (run 'hg heads' to see all heads) |
|
151 | (run 'hg heads' to see all heads, specify rev with -r) | |
152 | [255] |
|
152 | [255] |
@@ -1,87 +1,87 b'' | |||||
1 | $ hgcommit() { |
|
1 | $ hgcommit() { | |
2 | > hg commit -u user "$@" |
|
2 | > hg commit -u user "$@" | |
3 | > } |
|
3 | > } | |
4 |
|
4 | |||
5 | $ hg init clhead |
|
5 | $ hg init clhead | |
6 | $ cd clhead |
|
6 | $ cd clhead | |
7 |
|
7 | |||
8 | $ touch foo && hg add && hgcommit -m 'foo' |
|
8 | $ touch foo && hg add && hgcommit -m 'foo' | |
9 | adding foo |
|
9 | adding foo | |
10 | $ touch bar && hg add && hgcommit -m 'bar' |
|
10 | $ touch bar && hg add && hgcommit -m 'bar' | |
11 | adding bar |
|
11 | adding bar | |
12 | $ touch baz && hg add && hgcommit -m 'baz' |
|
12 | $ touch baz && hg add && hgcommit -m 'baz' | |
13 | adding baz |
|
13 | adding baz | |
14 |
|
14 | |||
15 | $ echo "flub" > foo |
|
15 | $ echo "flub" > foo | |
16 | $ hgcommit -m "flub" |
|
16 | $ hgcommit -m "flub" | |
17 | $ echo "nub" > foo |
|
17 | $ echo "nub" > foo | |
18 | $ hgcommit -m "nub" |
|
18 | $ hgcommit -m "nub" | |
19 |
|
19 | |||
20 | $ hg up -C 2 |
|
20 | $ hg up -C 2 | |
21 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
21 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
22 |
|
22 | |||
23 | $ echo "c1" > c1 |
|
23 | $ echo "c1" > c1 | |
24 | $ hg add c1 |
|
24 | $ hg add c1 | |
25 | $ hgcommit -m "c1" |
|
25 | $ hgcommit -m "c1" | |
26 | created new head |
|
26 | created new head | |
27 | $ echo "c2" > c1 |
|
27 | $ echo "c2" > c1 | |
28 | $ hgcommit -m "c2" |
|
28 | $ hgcommit -m "c2" | |
29 |
|
29 | |||
30 | $ hg up -C 2 |
|
30 | $ hg up -C 2 | |
31 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
31 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
32 |
|
32 | |||
33 | $ echo "d1" > d1 |
|
33 | $ echo "d1" > d1 | |
34 | $ hg add d1 |
|
34 | $ hg add d1 | |
35 | $ hgcommit -m "d1" |
|
35 | $ hgcommit -m "d1" | |
36 | created new head |
|
36 | created new head | |
37 | $ echo "d2" > d1 |
|
37 | $ echo "d2" > d1 | |
38 | $ hgcommit -m "d2" |
|
38 | $ hgcommit -m "d2" | |
39 | $ hg tag -l good |
|
39 | $ hg tag -l good | |
40 |
|
40 | |||
41 | fail with three heads |
|
41 | fail with three heads | |
42 | $ hg up -C good |
|
42 | $ hg up -C good | |
43 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
43 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
44 | $ hg merge |
|
44 | $ hg merge | |
45 | abort: branch 'default' has 3 heads - please merge with an explicit rev |
|
45 | abort: branch 'default' has 3 heads - please merge with an explicit rev | |
46 | (run 'hg heads .' to see heads) |
|
46 | (run 'hg heads .' to see heads, specify rev with -r) | |
47 | [255] |
|
47 | [255] | |
48 |
|
48 | |||
49 | close one of the heads |
|
49 | close one of the heads | |
50 | $ hg up -C 6 |
|
50 | $ hg up -C 6 | |
51 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
51 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
52 | $ hgcommit -m 'close this head' --close-branch |
|
52 | $ hgcommit -m 'close this head' --close-branch | |
53 |
|
53 | |||
54 | succeed with two open heads |
|
54 | succeed with two open heads | |
55 | $ hg up -C good |
|
55 | $ hg up -C good | |
56 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
56 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
57 | $ hg up -C good |
|
57 | $ hg up -C good | |
58 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
58 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
59 | $ hg merge |
|
59 | $ hg merge | |
60 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
60 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
61 | (branch merge, don't forget to commit) |
|
61 | (branch merge, don't forget to commit) | |
62 | $ hgcommit -m 'merged heads' |
|
62 | $ hgcommit -m 'merged heads' | |
63 |
|
63 | |||
64 | hg update -C 8 |
|
64 | hg update -C 8 | |
65 | $ hg update -C 8 |
|
65 | $ hg update -C 8 | |
66 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
66 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
67 |
|
67 | |||
68 | hg branch some-branch |
|
68 | hg branch some-branch | |
69 | $ hg branch some-branch |
|
69 | $ hg branch some-branch | |
70 | marked working directory as branch some-branch |
|
70 | marked working directory as branch some-branch | |
71 | (branches are permanent and global, did you want a bookmark?) |
|
71 | (branches are permanent and global, did you want a bookmark?) | |
72 | hg commit |
|
72 | hg commit | |
73 | $ hgcommit -m 'started some-branch' |
|
73 | $ hgcommit -m 'started some-branch' | |
74 | hg commit --close-branch |
|
74 | hg commit --close-branch | |
75 | $ hgcommit --close-branch -m 'closed some-branch' |
|
75 | $ hgcommit --close-branch -m 'closed some-branch' | |
76 |
|
76 | |||
77 | hg update default |
|
77 | hg update default | |
78 | $ hg update default |
|
78 | $ hg update default | |
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
80 | hg merge some-branch |
|
80 | hg merge some-branch | |
81 | $ hg merge some-branch |
|
81 | $ hg merge some-branch | |
82 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
82 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
83 | (branch merge, don't forget to commit) |
|
83 | (branch merge, don't forget to commit) | |
84 | hg commit (no reopening of some-branch) |
|
84 | hg commit (no reopening of some-branch) | |
85 | $ hgcommit -m 'merge with closed branch' |
|
85 | $ hgcommit -m 'merge with closed branch' | |
86 |
|
86 | |||
87 | $ cd .. |
|
87 | $ cd .. |
@@ -1,175 +1,175 b'' | |||||
1 | $ hg init |
|
1 | $ hg init | |
2 | $ echo a > a |
|
2 | $ echo a > a | |
3 | $ hg commit -A -ma |
|
3 | $ hg commit -A -ma | |
4 | adding a |
|
4 | adding a | |
5 |
|
5 | |||
6 | $ echo b >> a |
|
6 | $ echo b >> a | |
7 | $ hg commit -mb |
|
7 | $ hg commit -mb | |
8 |
|
8 | |||
9 | $ echo c >> a |
|
9 | $ echo c >> a | |
10 | $ hg commit -mc |
|
10 | $ hg commit -mc | |
11 |
|
11 | |||
12 | $ hg up 1 |
|
12 | $ hg up 1 | |
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
14 | $ echo d >> a |
|
14 | $ echo d >> a | |
15 | $ hg commit -md |
|
15 | $ hg commit -md | |
16 | created new head |
|
16 | created new head | |
17 |
|
17 | |||
18 | $ hg up 1 |
|
18 | $ hg up 1 | |
19 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
19 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 | $ echo e >> a |
|
20 | $ echo e >> a | |
21 | $ hg commit -me |
|
21 | $ hg commit -me | |
22 | created new head |
|
22 | created new head | |
23 |
|
23 | |||
24 | $ hg up 1 |
|
24 | $ hg up 1 | |
25 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
25 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
26 |
|
26 | |||
27 | Should fail because not at a head: |
|
27 | Should fail because not at a head: | |
28 |
|
28 | |||
29 | $ hg merge |
|
29 | $ hg merge | |
30 | abort: working directory not at a head revision |
|
30 | abort: working directory not at a head revision | |
31 | (use 'hg update' or merge with an explicit revision) |
|
31 | (use 'hg update' or merge with an explicit revision) | |
32 | [255] |
|
32 | [255] | |
33 |
|
33 | |||
34 | $ hg up |
|
34 | $ hg up | |
35 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
35 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
36 | updated to "f25cbe84d8b3: e" |
|
36 | updated to "f25cbe84d8b3: e" | |
37 | 2 other heads for branch "default" |
|
37 | 2 other heads for branch "default" | |
38 |
|
38 | |||
39 | Should fail because > 2 heads: |
|
39 | Should fail because > 2 heads: | |
40 |
|
40 | |||
41 | $ HGMERGE=internal:other; export HGMERGE |
|
41 | $ HGMERGE=internal:other; export HGMERGE | |
42 | $ hg merge |
|
42 | $ hg merge | |
43 | abort: branch 'default' has 3 heads - please merge with an explicit rev |
|
43 | abort: branch 'default' has 3 heads - please merge with an explicit rev | |
44 | (run 'hg heads .' to see heads) |
|
44 | (run 'hg heads .' to see heads, specify rev with -r) | |
45 | [255] |
|
45 | [255] | |
46 |
|
46 | |||
47 | Should succeed: |
|
47 | Should succeed: | |
48 |
|
48 | |||
49 | $ hg merge 2 |
|
49 | $ hg merge 2 | |
50 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
50 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
51 | (branch merge, don't forget to commit) |
|
51 | (branch merge, don't forget to commit) | |
52 | $ hg id -Tjson |
|
52 | $ hg id -Tjson | |
53 | [ |
|
53 | [ | |
54 | { |
|
54 | { | |
55 | "bookmarks": [], |
|
55 | "bookmarks": [], | |
56 | "branch": "default", |
|
56 | "branch": "default", | |
57 | "dirty": "+", |
|
57 | "dirty": "+", | |
58 | "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+", |
|
58 | "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+", | |
59 | "node": "ffffffffffffffffffffffffffffffffffffffff", |
|
59 | "node": "ffffffffffffffffffffffffffffffffffffffff", | |
60 | "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"], |
|
60 | "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"], | |
61 | "tags": ["tip"] |
|
61 | "tags": ["tip"] | |
62 | } |
|
62 | } | |
63 | ] |
|
63 | ] | |
64 | $ hg commit -mm1 |
|
64 | $ hg commit -mm1 | |
65 |
|
65 | |||
66 | Should succeed - 2 heads: |
|
66 | Should succeed - 2 heads: | |
67 |
|
67 | |||
68 | $ hg merge -P |
|
68 | $ hg merge -P | |
69 | changeset: 3:ea9ff125ff88 |
|
69 | changeset: 3:ea9ff125ff88 | |
70 | parent: 1:1846eede8b68 |
|
70 | parent: 1:1846eede8b68 | |
71 | user: test |
|
71 | user: test | |
72 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
72 | date: Thu Jan 01 00:00:00 1970 +0000 | |
73 | summary: d |
|
73 | summary: d | |
74 |
|
74 | |||
75 | $ hg merge |
|
75 | $ hg merge | |
76 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
76 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
77 | (branch merge, don't forget to commit) |
|
77 | (branch merge, don't forget to commit) | |
78 | $ hg commit -mm2 |
|
78 | $ hg commit -mm2 | |
79 |
|
79 | |||
80 | $ hg id -r 1 -Tjson |
|
80 | $ hg id -r 1 -Tjson | |
81 | [ |
|
81 | [ | |
82 | { |
|
82 | { | |
83 | "bookmarks": [], |
|
83 | "bookmarks": [], | |
84 | "branch": "default", |
|
84 | "branch": "default", | |
85 | "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", |
|
85 | "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", | |
86 | "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", |
|
86 | "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", | |
87 | "tags": [] |
|
87 | "tags": [] | |
88 | } |
|
88 | } | |
89 | ] |
|
89 | ] | |
90 |
|
90 | |||
91 | Should fail because at tip: |
|
91 | Should fail because at tip: | |
92 |
|
92 | |||
93 | $ hg merge |
|
93 | $ hg merge | |
94 | abort: nothing to merge |
|
94 | abort: nothing to merge | |
95 | [255] |
|
95 | [255] | |
96 |
|
96 | |||
97 | $ hg up 0 |
|
97 | $ hg up 0 | |
98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 |
|
99 | |||
100 | Should fail because there is only one head: |
|
100 | Should fail because there is only one head: | |
101 |
|
101 | |||
102 | $ hg merge |
|
102 | $ hg merge | |
103 | abort: nothing to merge |
|
103 | abort: nothing to merge | |
104 | (use 'hg update' instead) |
|
104 | (use 'hg update' instead) | |
105 | [255] |
|
105 | [255] | |
106 |
|
106 | |||
107 | $ hg up 3 |
|
107 | $ hg up 3 | |
108 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
108 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
109 |
|
109 | |||
110 | $ echo f >> a |
|
110 | $ echo f >> a | |
111 | $ hg branch foobranch |
|
111 | $ hg branch foobranch | |
112 | marked working directory as branch foobranch |
|
112 | marked working directory as branch foobranch | |
113 | (branches are permanent and global, did you want a bookmark?) |
|
113 | (branches are permanent and global, did you want a bookmark?) | |
114 | $ hg commit -mf |
|
114 | $ hg commit -mf | |
115 |
|
115 | |||
116 | Should fail because merge with other branch: |
|
116 | Should fail because merge with other branch: | |
117 |
|
117 | |||
118 | $ hg merge |
|
118 | $ hg merge | |
119 | abort: branch 'foobranch' has one head - please merge with an explicit rev |
|
119 | abort: branch 'foobranch' has one head - please merge with an explicit rev | |
120 | (run 'hg heads' to see all heads) |
|
120 | (run 'hg heads' to see all heads, specify rev with -r) | |
121 | [255] |
|
121 | [255] | |
122 |
|
122 | |||
123 |
|
123 | |||
124 | Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that |
|
124 | Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that | |
125 | are not ancestors of 7, regardless of where their common ancestors are. |
|
125 | are not ancestors of 7, regardless of where their common ancestors are. | |
126 |
|
126 | |||
127 | Merge preview not affected by common ancestor: |
|
127 | Merge preview not affected by common ancestor: | |
128 |
|
128 | |||
129 | $ hg up -q 7 |
|
129 | $ hg up -q 7 | |
130 | $ hg merge -q -P 6 |
|
130 | $ hg merge -q -P 6 | |
131 | 2:2d95304fed5d |
|
131 | 2:2d95304fed5d | |
132 | 4:f25cbe84d8b3 |
|
132 | 4:f25cbe84d8b3 | |
133 | 5:a431fabd6039 |
|
133 | 5:a431fabd6039 | |
134 | 6:e88e33f3bf62 |
|
134 | 6:e88e33f3bf62 | |
135 |
|
135 | |||
136 | Test experimental destination revset |
|
136 | Test experimental destination revset | |
137 |
|
137 | |||
138 | $ hg log -r '_destmerge()' |
|
138 | $ hg log -r '_destmerge()' | |
139 | abort: branch 'foobranch' has one head - please merge with an explicit rev |
|
139 | abort: branch 'foobranch' has one head - please merge with an explicit rev | |
140 | (run 'hg heads' to see all heads) |
|
140 | (run 'hg heads' to see all heads, specify rev with -r) | |
141 | [255] |
|
141 | [255] | |
142 |
|
142 | |||
143 | (on a branch with a two heads) |
|
143 | (on a branch with a two heads) | |
144 |
|
144 | |||
145 | $ hg up 5 |
|
145 | $ hg up 5 | |
146 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
146 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
147 | $ echo f >> a |
|
147 | $ echo f >> a | |
148 | $ hg commit -mf |
|
148 | $ hg commit -mf | |
149 | created new head |
|
149 | created new head | |
150 | $ hg log -r '_destmerge()' |
|
150 | $ hg log -r '_destmerge()' | |
151 | changeset: 6:e88e33f3bf62 |
|
151 | changeset: 6:e88e33f3bf62 | |
152 | parent: 5:a431fabd6039 |
|
152 | parent: 5:a431fabd6039 | |
153 | parent: 3:ea9ff125ff88 |
|
153 | parent: 3:ea9ff125ff88 | |
154 | user: test |
|
154 | user: test | |
155 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
155 | date: Thu Jan 01 00:00:00 1970 +0000 | |
156 | summary: m2 |
|
156 | summary: m2 | |
157 |
|
157 | |||
158 |
|
158 | |||
159 | (from the other head) |
|
159 | (from the other head) | |
160 |
|
160 | |||
161 | $ hg log -r '_destmerge(e88e33f3bf62)' |
|
161 | $ hg log -r '_destmerge(e88e33f3bf62)' | |
162 | changeset: 8:b613918999e2 |
|
162 | changeset: 8:b613918999e2 | |
163 | tag: tip |
|
163 | tag: tip | |
164 | parent: 5:a431fabd6039 |
|
164 | parent: 5:a431fabd6039 | |
165 | user: test |
|
165 | user: test | |
166 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
166 | date: Thu Jan 01 00:00:00 1970 +0000 | |
167 | summary: f |
|
167 | summary: f | |
168 |
|
168 | |||
169 |
|
169 | |||
170 | (from unrelated branch) |
|
170 | (from unrelated branch) | |
171 |
|
171 | |||
172 | $ hg log -r '_destmerge(foobranch)' |
|
172 | $ hg log -r '_destmerge(foobranch)' | |
173 | abort: branch 'foobranch' has one head - please merge with an explicit rev |
|
173 | abort: branch 'foobranch' has one head - please merge with an explicit rev | |
174 | (run 'hg heads' to see all heads) |
|
174 | (run 'hg heads' to see all heads, specify rev with -r) | |
175 | [255] |
|
175 | [255] |
@@ -1,534 +1,534 b'' | |||||
1 | $ branchcache=.hg/cache/branch2 |
|
1 | $ branchcache=.hg/cache/branch2 | |
2 |
|
2 | |||
3 | $ listbranchcaches() { |
|
3 | $ listbranchcaches() { | |
4 | > for f in .hg/cache/branch2*; |
|
4 | > for f in .hg/cache/branch2*; | |
5 | > do echo === $f ===; |
|
5 | > do echo === $f ===; | |
6 | > cat $f; |
|
6 | > cat $f; | |
7 | > done; |
|
7 | > done; | |
8 | > } |
|
8 | > } | |
9 | $ purgebranchcaches() { |
|
9 | $ purgebranchcaches() { | |
10 | > rm .hg/cache/branch2* |
|
10 | > rm .hg/cache/branch2* | |
11 | > } |
|
11 | > } | |
12 |
|
12 | |||
13 | $ hg init t |
|
13 | $ hg init t | |
14 | $ cd t |
|
14 | $ cd t | |
15 |
|
15 | |||
16 | $ hg branches |
|
16 | $ hg branches | |
17 | $ echo foo > a |
|
17 | $ echo foo > a | |
18 | $ hg add a |
|
18 | $ hg add a | |
19 | $ hg ci -m "initial" |
|
19 | $ hg ci -m "initial" | |
20 | $ hg branch foo |
|
20 | $ hg branch foo | |
21 | marked working directory as branch foo |
|
21 | marked working directory as branch foo | |
22 | (branches are permanent and global, did you want a bookmark?) |
|
22 | (branches are permanent and global, did you want a bookmark?) | |
23 | $ hg branch |
|
23 | $ hg branch | |
24 | foo |
|
24 | foo | |
25 | $ hg ci -m "add branch name" |
|
25 | $ hg ci -m "add branch name" | |
26 | $ hg branch bar |
|
26 | $ hg branch bar | |
27 | marked working directory as branch bar |
|
27 | marked working directory as branch bar | |
28 | $ hg ci -m "change branch name" |
|
28 | $ hg ci -m "change branch name" | |
29 |
|
29 | |||
30 | Branch shadowing: |
|
30 | Branch shadowing: | |
31 |
|
31 | |||
32 | $ hg branch default |
|
32 | $ hg branch default | |
33 | abort: a branch of the same name already exists |
|
33 | abort: a branch of the same name already exists | |
34 | (use 'hg update' to switch to it) |
|
34 | (use 'hg update' to switch to it) | |
35 | [255] |
|
35 | [255] | |
36 |
|
36 | |||
37 | $ hg branch -f default |
|
37 | $ hg branch -f default | |
38 | marked working directory as branch default |
|
38 | marked working directory as branch default | |
39 |
|
39 | |||
40 | $ hg ci -m "clear branch name" |
|
40 | $ hg ci -m "clear branch name" | |
41 | created new head |
|
41 | created new head | |
42 |
|
42 | |||
43 | There should be only one default branch head |
|
43 | There should be only one default branch head | |
44 |
|
44 | |||
45 | $ hg heads . |
|
45 | $ hg heads . | |
46 | changeset: 3:1c28f494dae6 |
|
46 | changeset: 3:1c28f494dae6 | |
47 | tag: tip |
|
47 | tag: tip | |
48 | user: test |
|
48 | user: test | |
49 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
49 | date: Thu Jan 01 00:00:00 1970 +0000 | |
50 | summary: clear branch name |
|
50 | summary: clear branch name | |
51 |
|
51 | |||
52 | Merging and branches |
|
52 | Merging and branches | |
53 |
|
53 | |||
54 | $ hg co foo |
|
54 | $ hg co foo | |
55 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
55 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
56 | $ hg branch |
|
56 | $ hg branch | |
57 | foo |
|
57 | foo | |
58 |
|
58 | |||
59 | set existing branch name fails unless force - setting existing parent branch works without force: |
|
59 | set existing branch name fails unless force - setting existing parent branch works without force: | |
60 |
|
60 | |||
61 | $ hg branch bar |
|
61 | $ hg branch bar | |
62 | abort: a branch of the same name already exists |
|
62 | abort: a branch of the same name already exists | |
63 | (use 'hg update' to switch to it) |
|
63 | (use 'hg update' to switch to it) | |
64 | [255] |
|
64 | [255] | |
65 |
|
65 | |||
66 | $ hg branch -f bar |
|
66 | $ hg branch -f bar | |
67 | marked working directory as branch bar |
|
67 | marked working directory as branch bar | |
68 |
|
68 | |||
69 | $ hg branch foo |
|
69 | $ hg branch foo | |
70 | marked working directory as branch foo |
|
70 | marked working directory as branch foo | |
71 |
|
71 | |||
72 | $ echo bleah > a |
|
72 | $ echo bleah > a | |
73 | $ hg ci -m "modify a branch" |
|
73 | $ hg ci -m "modify a branch" | |
74 |
|
74 | |||
75 | $ hg merge default |
|
75 | $ hg merge default | |
76 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
76 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
77 | (branch merge, don't forget to commit) |
|
77 | (branch merge, don't forget to commit) | |
78 |
|
78 | |||
79 | $ hg branch |
|
79 | $ hg branch | |
80 | foo |
|
80 | foo | |
81 |
|
81 | |||
82 | set existing branch name where branch head is ancestor: |
|
82 | set existing branch name where branch head is ancestor: | |
83 |
|
83 | |||
84 | $ hg branch bar |
|
84 | $ hg branch bar | |
85 | abort: a branch of the same name already exists |
|
85 | abort: a branch of the same name already exists | |
86 | (use 'hg update' to switch to it) |
|
86 | (use 'hg update' to switch to it) | |
87 | [255] |
|
87 | [255] | |
88 |
|
88 | |||
89 | set (other) parent branch as branch name |
|
89 | set (other) parent branch as branch name | |
90 |
|
90 | |||
91 | $ hg branch default |
|
91 | $ hg branch default | |
92 | marked working directory as branch default |
|
92 | marked working directory as branch default | |
93 |
|
93 | |||
94 | set (first) parent branch as branch name |
|
94 | set (first) parent branch as branch name | |
95 |
|
95 | |||
96 | $ hg branch foo |
|
96 | $ hg branch foo | |
97 | marked working directory as branch foo |
|
97 | marked working directory as branch foo | |
98 |
|
98 | |||
99 | $ hg ci -m "merge" |
|
99 | $ hg ci -m "merge" | |
100 |
|
100 | |||
101 | $ hg log -G -T '{rev}:{node|short} {branch} {desc}\n' |
|
101 | $ hg log -G -T '{rev}:{node|short} {branch} {desc}\n' | |
102 | @ 5:530046499edf foo merge |
|
102 | @ 5:530046499edf foo merge | |
103 | |\ |
|
103 | |\ | |
104 | | o 4:adf1a74a7f7b foo modify a branch |
|
104 | | o 4:adf1a74a7f7b foo modify a branch | |
105 | | | |
|
105 | | | | |
106 | o | 3:1c28f494dae6 default clear branch name |
|
106 | o | 3:1c28f494dae6 default clear branch name | |
107 | | | |
|
107 | | | | |
108 | o | 2:c21617b13b22 bar change branch name |
|
108 | o | 2:c21617b13b22 bar change branch name | |
109 | |/ |
|
109 | |/ | |
110 | o 1:6c0e42da283a foo add branch name |
|
110 | o 1:6c0e42da283a foo add branch name | |
111 | | |
|
111 | | | |
112 | o 0:db01e8ea3388 default initial |
|
112 | o 0:db01e8ea3388 default initial | |
113 |
|
113 | |||
114 | $ hg branches |
|
114 | $ hg branches | |
115 | foo 5:530046499edf |
|
115 | foo 5:530046499edf | |
116 | default 3:1c28f494dae6 (inactive) |
|
116 | default 3:1c28f494dae6 (inactive) | |
117 | bar 2:c21617b13b22 (inactive) |
|
117 | bar 2:c21617b13b22 (inactive) | |
118 |
|
118 | |||
119 | $ hg branches -q |
|
119 | $ hg branches -q | |
120 | foo |
|
120 | foo | |
121 | default |
|
121 | default | |
122 | bar |
|
122 | bar | |
123 |
|
123 | |||
124 | Test for invalid branch cache: |
|
124 | Test for invalid branch cache: | |
125 |
|
125 | |||
126 | $ hg rollback |
|
126 | $ hg rollback | |
127 | repository tip rolled back to revision 4 (undo commit) |
|
127 | repository tip rolled back to revision 4 (undo commit) | |
128 | working directory now based on revisions 4 and 3 |
|
128 | working directory now based on revisions 4 and 3 | |
129 |
|
129 | |||
130 | $ cp ${branchcache}-served .hg/bc-invalid |
|
130 | $ cp ${branchcache}-served .hg/bc-invalid | |
131 |
|
131 | |||
132 | $ hg log -r foo |
|
132 | $ hg log -r foo | |
133 | changeset: 4:adf1a74a7f7b |
|
133 | changeset: 4:adf1a74a7f7b | |
134 | branch: foo |
|
134 | branch: foo | |
135 | tag: tip |
|
135 | tag: tip | |
136 | parent: 1:6c0e42da283a |
|
136 | parent: 1:6c0e42da283a | |
137 | user: test |
|
137 | user: test | |
138 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
138 | date: Thu Jan 01 00:00:00 1970 +0000 | |
139 | summary: modify a branch |
|
139 | summary: modify a branch | |
140 |
|
140 | |||
141 | $ cp .hg/bc-invalid $branchcache |
|
141 | $ cp .hg/bc-invalid $branchcache | |
142 |
|
142 | |||
143 | $ hg --debug log -r foo |
|
143 | $ hg --debug log -r foo | |
144 | changeset: 4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 |
|
144 | changeset: 4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 | |
145 | branch: foo |
|
145 | branch: foo | |
146 | tag: tip |
|
146 | tag: tip | |
147 | phase: draft |
|
147 | phase: draft | |
148 | parent: 1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8 |
|
148 | parent: 1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8 | |
149 | parent: -1:0000000000000000000000000000000000000000 |
|
149 | parent: -1:0000000000000000000000000000000000000000 | |
150 | manifest: 1:8c342a37dfba0b3d3ce073562a00d8a813c54ffe |
|
150 | manifest: 1:8c342a37dfba0b3d3ce073562a00d8a813c54ffe | |
151 | user: test |
|
151 | user: test | |
152 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
152 | date: Thu Jan 01 00:00:00 1970 +0000 | |
153 | files: a |
|
153 | files: a | |
154 | extra: branch=foo |
|
154 | extra: branch=foo | |
155 | description: |
|
155 | description: | |
156 | modify a branch |
|
156 | modify a branch | |
157 |
|
157 | |||
158 |
|
158 | |||
159 | $ purgebranchcaches |
|
159 | $ purgebranchcaches | |
160 | $ echo corrupted > $branchcache |
|
160 | $ echo corrupted > $branchcache | |
161 |
|
161 | |||
162 | $ hg log -qr foo |
|
162 | $ hg log -qr foo | |
163 | 4:adf1a74a7f7b |
|
163 | 4:adf1a74a7f7b | |
164 |
|
164 | |||
165 | $ listbranchcaches |
|
165 | $ listbranchcaches | |
166 | === .hg/cache/branch2 === |
|
166 | === .hg/cache/branch2 === | |
167 | corrupted |
|
167 | corrupted | |
168 | === .hg/cache/branch2-served === |
|
168 | === .hg/cache/branch2-served === | |
169 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
|
169 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 | |
170 | c21617b13b220988e7a2e26290fbe4325ffa7139 o bar |
|
170 | c21617b13b220988e7a2e26290fbe4325ffa7139 o bar | |
171 | 1c28f494dae69a2f8fc815059d257eccf3fcfe75 o default |
|
171 | 1c28f494dae69a2f8fc815059d257eccf3fcfe75 o default | |
172 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 o foo |
|
172 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 o foo | |
173 |
|
173 | |||
174 | Push should update the branch cache: |
|
174 | Push should update the branch cache: | |
175 |
|
175 | |||
176 | $ hg init ../target |
|
176 | $ hg init ../target | |
177 |
|
177 | |||
178 | Pushing just rev 0: |
|
178 | Pushing just rev 0: | |
179 |
|
179 | |||
180 | $ hg push -qr 0 ../target |
|
180 | $ hg push -qr 0 ../target | |
181 |
|
181 | |||
182 | $ (cd ../target/; listbranchcaches) |
|
182 | $ (cd ../target/; listbranchcaches) | |
183 | === .hg/cache/branch2-base === |
|
183 | === .hg/cache/branch2-base === | |
184 | db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 |
|
184 | db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 | |
185 | db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 o default |
|
185 | db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 o default | |
186 |
|
186 | |||
187 | Pushing everything: |
|
187 | Pushing everything: | |
188 |
|
188 | |||
189 | $ hg push -qf ../target |
|
189 | $ hg push -qf ../target | |
190 |
|
190 | |||
191 | $ (cd ../target/; listbranchcaches) |
|
191 | $ (cd ../target/; listbranchcaches) | |
192 | === .hg/cache/branch2-base === |
|
192 | === .hg/cache/branch2-base === | |
193 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
|
193 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 | |
194 | c21617b13b220988e7a2e26290fbe4325ffa7139 o bar |
|
194 | c21617b13b220988e7a2e26290fbe4325ffa7139 o bar | |
195 | 1c28f494dae69a2f8fc815059d257eccf3fcfe75 o default |
|
195 | 1c28f494dae69a2f8fc815059d257eccf3fcfe75 o default | |
196 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 o foo |
|
196 | adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 o foo | |
197 |
|
197 | |||
198 | Update with no arguments: tipmost revision of the current branch: |
|
198 | Update with no arguments: tipmost revision of the current branch: | |
199 |
|
199 | |||
200 | $ hg up -q -C 0 |
|
200 | $ hg up -q -C 0 | |
201 | $ hg up -q |
|
201 | $ hg up -q | |
202 | $ hg id |
|
202 | $ hg id | |
203 | 1c28f494dae6 |
|
203 | 1c28f494dae6 | |
204 |
|
204 | |||
205 | $ hg up -q 1 |
|
205 | $ hg up -q 1 | |
206 | $ hg up -q |
|
206 | $ hg up -q | |
207 | $ hg id |
|
207 | $ hg id | |
208 | adf1a74a7f7b (foo) tip |
|
208 | adf1a74a7f7b (foo) tip | |
209 |
|
209 | |||
210 | $ hg branch foobar |
|
210 | $ hg branch foobar | |
211 | marked working directory as branch foobar |
|
211 | marked working directory as branch foobar | |
212 |
|
212 | |||
213 | $ hg up |
|
213 | $ hg up | |
214 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
214 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
215 |
|
215 | |||
216 | Fast-forward merge: |
|
216 | Fast-forward merge: | |
217 |
|
217 | |||
218 | $ hg branch ff |
|
218 | $ hg branch ff | |
219 | marked working directory as branch ff |
|
219 | marked working directory as branch ff | |
220 |
|
220 | |||
221 | $ echo ff > ff |
|
221 | $ echo ff > ff | |
222 | $ hg ci -Am'fast forward' |
|
222 | $ hg ci -Am'fast forward' | |
223 | adding ff |
|
223 | adding ff | |
224 |
|
224 | |||
225 | $ hg up foo |
|
225 | $ hg up foo | |
226 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
226 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
227 |
|
227 | |||
228 | $ hg merge ff |
|
228 | $ hg merge ff | |
229 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
229 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
230 | (branch merge, don't forget to commit) |
|
230 | (branch merge, don't forget to commit) | |
231 |
|
231 | |||
232 | $ hg branch |
|
232 | $ hg branch | |
233 | foo |
|
233 | foo | |
234 | $ hg commit -m'Merge ff into foo' |
|
234 | $ hg commit -m'Merge ff into foo' | |
235 | $ hg parents |
|
235 | $ hg parents | |
236 | changeset: 6:185ffbfefa30 |
|
236 | changeset: 6:185ffbfefa30 | |
237 | branch: foo |
|
237 | branch: foo | |
238 | tag: tip |
|
238 | tag: tip | |
239 | parent: 4:adf1a74a7f7b |
|
239 | parent: 4:adf1a74a7f7b | |
240 | parent: 5:1a3c27dc5e11 |
|
240 | parent: 5:1a3c27dc5e11 | |
241 | user: test |
|
241 | user: test | |
242 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
242 | date: Thu Jan 01 00:00:00 1970 +0000 | |
243 | summary: Merge ff into foo |
|
243 | summary: Merge ff into foo | |
244 |
|
244 | |||
245 | $ hg manifest |
|
245 | $ hg manifest | |
246 | a |
|
246 | a | |
247 | ff |
|
247 | ff | |
248 |
|
248 | |||
249 |
|
249 | |||
250 | Test merging, add 3 default heads and one test head: |
|
250 | Test merging, add 3 default heads and one test head: | |
251 |
|
251 | |||
252 | $ cd .. |
|
252 | $ cd .. | |
253 | $ hg init merges |
|
253 | $ hg init merges | |
254 | $ cd merges |
|
254 | $ cd merges | |
255 | $ echo a > a |
|
255 | $ echo a > a | |
256 | $ hg ci -Ama |
|
256 | $ hg ci -Ama | |
257 | adding a |
|
257 | adding a | |
258 |
|
258 | |||
259 | $ echo b > b |
|
259 | $ echo b > b | |
260 | $ hg ci -Amb |
|
260 | $ hg ci -Amb | |
261 | adding b |
|
261 | adding b | |
262 |
|
262 | |||
263 | $ hg up 0 |
|
263 | $ hg up 0 | |
264 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
264 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
265 | $ echo c > c |
|
265 | $ echo c > c | |
266 | $ hg ci -Amc |
|
266 | $ hg ci -Amc | |
267 | adding c |
|
267 | adding c | |
268 | created new head |
|
268 | created new head | |
269 |
|
269 | |||
270 | $ hg up 0 |
|
270 | $ hg up 0 | |
271 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
271 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
272 | $ echo d > d |
|
272 | $ echo d > d | |
273 | $ hg ci -Amd |
|
273 | $ hg ci -Amd | |
274 | adding d |
|
274 | adding d | |
275 | created new head |
|
275 | created new head | |
276 |
|
276 | |||
277 | $ hg up 0 |
|
277 | $ hg up 0 | |
278 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
278 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
279 | $ hg branch test |
|
279 | $ hg branch test | |
280 | marked working directory as branch test |
|
280 | marked working directory as branch test | |
281 | (branches are permanent and global, did you want a bookmark?) |
|
281 | (branches are permanent and global, did you want a bookmark?) | |
282 | $ echo e >> e |
|
282 | $ echo e >> e | |
283 | $ hg ci -Ame |
|
283 | $ hg ci -Ame | |
284 | adding e |
|
284 | adding e | |
285 |
|
285 | |||
286 | $ hg log |
|
286 | $ hg log | |
287 | changeset: 4:3a1e01ed1df4 |
|
287 | changeset: 4:3a1e01ed1df4 | |
288 | branch: test |
|
288 | branch: test | |
289 | tag: tip |
|
289 | tag: tip | |
290 | parent: 0:cb9a9f314b8b |
|
290 | parent: 0:cb9a9f314b8b | |
291 | user: test |
|
291 | user: test | |
292 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
292 | date: Thu Jan 01 00:00:00 1970 +0000 | |
293 | summary: e |
|
293 | summary: e | |
294 |
|
294 | |||
295 | changeset: 3:980f7dc84c29 |
|
295 | changeset: 3:980f7dc84c29 | |
296 | parent: 0:cb9a9f314b8b |
|
296 | parent: 0:cb9a9f314b8b | |
297 | user: test |
|
297 | user: test | |
298 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
298 | date: Thu Jan 01 00:00:00 1970 +0000 | |
299 | summary: d |
|
299 | summary: d | |
300 |
|
300 | |||
301 | changeset: 2:d36c0562f908 |
|
301 | changeset: 2:d36c0562f908 | |
302 | parent: 0:cb9a9f314b8b |
|
302 | parent: 0:cb9a9f314b8b | |
303 | user: test |
|
303 | user: test | |
304 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
304 | date: Thu Jan 01 00:00:00 1970 +0000 | |
305 | summary: c |
|
305 | summary: c | |
306 |
|
306 | |||
307 | changeset: 1:d2ae7f538514 |
|
307 | changeset: 1:d2ae7f538514 | |
308 | user: test |
|
308 | user: test | |
309 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
309 | date: Thu Jan 01 00:00:00 1970 +0000 | |
310 | summary: b |
|
310 | summary: b | |
311 |
|
311 | |||
312 | changeset: 0:cb9a9f314b8b |
|
312 | changeset: 0:cb9a9f314b8b | |
313 | user: test |
|
313 | user: test | |
314 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
314 | date: Thu Jan 01 00:00:00 1970 +0000 | |
315 | summary: a |
|
315 | summary: a | |
316 |
|
316 | |||
317 | Implicit merge with test branch as parent: |
|
317 | Implicit merge with test branch as parent: | |
318 |
|
318 | |||
319 | $ hg merge |
|
319 | $ hg merge | |
320 | abort: branch 'test' has one head - please merge with an explicit rev |
|
320 | abort: branch 'test' has one head - please merge with an explicit rev | |
321 | (run 'hg heads' to see all heads) |
|
321 | (run 'hg heads' to see all heads, specify rev with -r) | |
322 | [255] |
|
322 | [255] | |
323 | $ hg up -C default |
|
323 | $ hg up -C default | |
324 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
324 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
325 |
|
325 | |||
326 | Implicit merge with default branch as parent: |
|
326 | Implicit merge with default branch as parent: | |
327 |
|
327 | |||
328 | $ hg merge |
|
328 | $ hg merge | |
329 | abort: branch 'default' has 3 heads - please merge with an explicit rev |
|
329 | abort: branch 'default' has 3 heads - please merge with an explicit rev | |
330 | (run 'hg heads .' to see heads) |
|
330 | (run 'hg heads .' to see heads, specify rev with -r) | |
331 | [255] |
|
331 | [255] | |
332 |
|
332 | |||
333 | 3 branch heads, explicit merge required: |
|
333 | 3 branch heads, explicit merge required: | |
334 |
|
334 | |||
335 | $ hg merge 2 |
|
335 | $ hg merge 2 | |
336 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
336 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
337 | (branch merge, don't forget to commit) |
|
337 | (branch merge, don't forget to commit) | |
338 | $ hg ci -m merge |
|
338 | $ hg ci -m merge | |
339 |
|
339 | |||
340 | 2 branch heads, implicit merge works: |
|
340 | 2 branch heads, implicit merge works: | |
341 |
|
341 | |||
342 | $ hg merge |
|
342 | $ hg merge | |
343 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
343 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
344 | (branch merge, don't forget to commit) |
|
344 | (branch merge, don't forget to commit) | |
345 |
|
345 | |||
346 | $ cd .. |
|
346 | $ cd .. | |
347 |
|
347 | |||
348 | We expect that bare update on new branch, updates to parent |
|
348 | We expect that bare update on new branch, updates to parent | |
349 |
|
349 | |||
350 | $ hg init bareupdateonnewbranch |
|
350 | $ hg init bareupdateonnewbranch | |
351 | $ cd bareupdateonnewbranch |
|
351 | $ cd bareupdateonnewbranch | |
352 | $ hg update |
|
352 | $ hg update | |
353 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
353 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
354 | $ touch a |
|
354 | $ touch a | |
355 | $ hg commit -A -m "a" |
|
355 | $ hg commit -A -m "a" | |
356 | adding a |
|
356 | adding a | |
357 | $ touch b |
|
357 | $ touch b | |
358 | $ hg commit -A -m "b" |
|
358 | $ hg commit -A -m "b" | |
359 | adding b |
|
359 | adding b | |
360 | $ touch c |
|
360 | $ touch c | |
361 | $ hg commit -A -m "c" |
|
361 | $ hg commit -A -m "c" | |
362 | adding c |
|
362 | adding c | |
363 | $ hg update -r 1 |
|
363 | $ hg update -r 1 | |
364 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
364 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
365 | $ hg log -G |
|
365 | $ hg log -G | |
366 | o changeset: 2:991a3460af53 |
|
366 | o changeset: 2:991a3460af53 | |
367 | | tag: tip |
|
367 | | tag: tip | |
368 | | user: test |
|
368 | | user: test | |
369 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
369 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
370 | | summary: c |
|
370 | | summary: c | |
371 | | |
|
371 | | | |
372 | @ changeset: 1:0e067c57feba |
|
372 | @ changeset: 1:0e067c57feba | |
373 | | user: test |
|
373 | | user: test | |
374 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
374 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
375 | | summary: b |
|
375 | | summary: b | |
376 | | |
|
376 | | | |
377 | o changeset: 0:3903775176ed |
|
377 | o changeset: 0:3903775176ed | |
378 | user: test |
|
378 | user: test | |
379 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
379 | date: Thu Jan 01 00:00:00 1970 +0000 | |
380 | summary: a |
|
380 | summary: a | |
381 |
|
381 | |||
382 | $ hg branch dev |
|
382 | $ hg branch dev | |
383 | marked working directory as branch dev |
|
383 | marked working directory as branch dev | |
384 | (branches are permanent and global, did you want a bookmark?) |
|
384 | (branches are permanent and global, did you want a bookmark?) | |
385 | $ hg update |
|
385 | $ hg update | |
386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
387 | $ hg summary |
|
387 | $ hg summary | |
388 | parent: 1:0e067c57feba |
|
388 | parent: 1:0e067c57feba | |
389 | b |
|
389 | b | |
390 | branch: dev |
|
390 | branch: dev | |
391 | commit: (new branch) |
|
391 | commit: (new branch) | |
392 | update: (current) |
|
392 | update: (current) | |
393 | phases: 3 draft |
|
393 | phases: 3 draft | |
394 |
|
394 | |||
395 | $ cd .. |
|
395 | $ cd .. | |
396 |
|
396 | |||
397 | We need special handling for repositories with no "default" branch because |
|
397 | We need special handling for repositories with no "default" branch because | |
398 | "null" revision belongs to non-existent "default" branch. |
|
398 | "null" revision belongs to non-existent "default" branch. | |
399 |
|
399 | |||
400 | $ hg init nodefault |
|
400 | $ hg init nodefault | |
401 | $ cd nodefault |
|
401 | $ cd nodefault | |
402 | $ hg branch -q foo |
|
402 | $ hg branch -q foo | |
403 | $ touch 0 |
|
403 | $ touch 0 | |
404 | $ hg ci -Aqm0 |
|
404 | $ hg ci -Aqm0 | |
405 | $ touch 1 |
|
405 | $ touch 1 | |
406 | $ hg ci -Aqm1 |
|
406 | $ hg ci -Aqm1 | |
407 | $ hg update -qr0 |
|
407 | $ hg update -qr0 | |
408 | $ hg branch -q bar |
|
408 | $ hg branch -q bar | |
409 | $ touch 2 |
|
409 | $ touch 2 | |
410 | $ hg ci -Aqm2 |
|
410 | $ hg ci -Aqm2 | |
411 | $ hg update -qr0 |
|
411 | $ hg update -qr0 | |
412 | $ hg branch -q baz |
|
412 | $ hg branch -q baz | |
413 | $ touch 3 |
|
413 | $ touch 3 | |
414 | $ hg ci -Aqm3 |
|
414 | $ hg ci -Aqm3 | |
415 | $ hg ci --close-branch -m 'close baz' |
|
415 | $ hg ci --close-branch -m 'close baz' | |
416 | $ hg update -q null |
|
416 | $ hg update -q null | |
417 | $ hg log -GT'{rev} {branch}\n' |
|
417 | $ hg log -GT'{rev} {branch}\n' | |
418 | _ 4 baz |
|
418 | _ 4 baz | |
419 | | |
|
419 | | | |
420 | o 3 baz |
|
420 | o 3 baz | |
421 | | |
|
421 | | | |
422 | | o 2 bar |
|
422 | | o 2 bar | |
423 | |/ |
|
423 | |/ | |
424 | | o 1 foo |
|
424 | | o 1 foo | |
425 | |/ |
|
425 | |/ | |
426 | o 0 foo |
|
426 | o 0 foo | |
427 |
|
427 | |||
428 |
|
428 | |||
429 | a) updating from "null" should bring us to the tip-most branch head as |
|
429 | a) updating from "null" should bring us to the tip-most branch head as | |
430 | there is no "default" branch: |
|
430 | there is no "default" branch: | |
431 |
|
431 | |||
432 | $ hg update -q null |
|
432 | $ hg update -q null | |
433 | $ hg id -bn |
|
433 | $ hg id -bn | |
434 | -1 default |
|
434 | -1 default | |
435 | $ hg update |
|
435 | $ hg update | |
436 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
436 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
437 | $ hg id -bn |
|
437 | $ hg id -bn | |
438 | 2 bar |
|
438 | 2 bar | |
439 |
|
439 | |||
440 | b) but if we are at uncommitted "default" branch, we should stick to the |
|
440 | b) but if we are at uncommitted "default" branch, we should stick to the | |
441 | current revision: |
|
441 | current revision: | |
442 |
|
442 | |||
443 | $ hg update -q 0 |
|
443 | $ hg update -q 0 | |
444 | $ hg branch default |
|
444 | $ hg branch default | |
445 | marked working directory as branch default |
|
445 | marked working directory as branch default | |
446 | $ hg id -bn |
|
446 | $ hg id -bn | |
447 | 0 default |
|
447 | 0 default | |
448 | $ hg update |
|
448 | $ hg update | |
449 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
449 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
450 | $ hg id -bn |
|
450 | $ hg id -bn | |
451 | 0 default |
|
451 | 0 default | |
452 |
|
452 | |||
453 | c) also, if we have uncommitted branch at "null", we should stick to it: |
|
453 | c) also, if we have uncommitted branch at "null", we should stick to it: | |
454 |
|
454 | |||
455 | $ hg update -q null |
|
455 | $ hg update -q null | |
456 | $ hg branch new |
|
456 | $ hg branch new | |
457 | marked working directory as branch new |
|
457 | marked working directory as branch new | |
458 | $ hg id -bn |
|
458 | $ hg id -bn | |
459 | -1 new |
|
459 | -1 new | |
460 | $ hg update |
|
460 | $ hg update | |
461 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
461 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
462 | $ hg id -bn |
|
462 | $ hg id -bn | |
463 | -1 new |
|
463 | -1 new | |
464 |
|
464 | |||
465 | $ cd .. |
|
465 | $ cd .. | |
466 |
|
466 | |||
467 | We expect that update --clean discard changes in working directory, |
|
467 | We expect that update --clean discard changes in working directory, | |
468 | and updates to the head of parent branch. |
|
468 | and updates to the head of parent branch. | |
469 |
|
469 | |||
470 | $ hg init updatebareclean |
|
470 | $ hg init updatebareclean | |
471 | $ cd updatebareclean |
|
471 | $ cd updatebareclean | |
472 | $ hg update --clean |
|
472 | $ hg update --clean | |
473 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
473 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
474 | $ touch a |
|
474 | $ touch a | |
475 | $ hg commit -A -m "a" |
|
475 | $ hg commit -A -m "a" | |
476 | adding a |
|
476 | adding a | |
477 | $ touch b |
|
477 | $ touch b | |
478 | $ hg commit -A -m "b" |
|
478 | $ hg commit -A -m "b" | |
479 | adding b |
|
479 | adding b | |
480 | $ touch c |
|
480 | $ touch c | |
481 | $ hg commit -A -m "c" |
|
481 | $ hg commit -A -m "c" | |
482 | adding c |
|
482 | adding c | |
483 | $ hg log |
|
483 | $ hg log | |
484 | changeset: 2:991a3460af53 |
|
484 | changeset: 2:991a3460af53 | |
485 | tag: tip |
|
485 | tag: tip | |
486 | user: test |
|
486 | user: test | |
487 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
487 | date: Thu Jan 01 00:00:00 1970 +0000 | |
488 | summary: c |
|
488 | summary: c | |
489 |
|
489 | |||
490 | changeset: 1:0e067c57feba |
|
490 | changeset: 1:0e067c57feba | |
491 | user: test |
|
491 | user: test | |
492 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
492 | date: Thu Jan 01 00:00:00 1970 +0000 | |
493 | summary: b |
|
493 | summary: b | |
494 |
|
494 | |||
495 | changeset: 0:3903775176ed |
|
495 | changeset: 0:3903775176ed | |
496 | user: test |
|
496 | user: test | |
497 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
497 | date: Thu Jan 01 00:00:00 1970 +0000 | |
498 | summary: a |
|
498 | summary: a | |
499 |
|
499 | |||
500 | $ hg update -r 1 |
|
500 | $ hg update -r 1 | |
501 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
501 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
502 | $ hg branch new-branch |
|
502 | $ hg branch new-branch | |
503 | marked working directory as branch new-branch |
|
503 | marked working directory as branch new-branch | |
504 | (branches are permanent and global, did you want a bookmark?) |
|
504 | (branches are permanent and global, did you want a bookmark?) | |
505 | $ echo "aa" >> a |
|
505 | $ echo "aa" >> a | |
506 | $ hg update --clean |
|
506 | $ hg update --clean | |
507 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
507 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
508 | $ hg status |
|
508 | $ hg status | |
509 | $ hg branch |
|
509 | $ hg branch | |
510 | default |
|
510 | default | |
511 | $ hg parent |
|
511 | $ hg parent | |
512 | changeset: 2:991a3460af53 |
|
512 | changeset: 2:991a3460af53 | |
513 | tag: tip |
|
513 | tag: tip | |
514 | user: test |
|
514 | user: test | |
515 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
515 | date: Thu Jan 01 00:00:00 1970 +0000 | |
516 | summary: c |
|
516 | summary: c | |
517 |
|
517 | |||
518 | We expect that update --clean on non existing parent discards a new branch |
|
518 | We expect that update --clean on non existing parent discards a new branch | |
519 | and updates to the tipmost non-closed branch head |
|
519 | and updates to the tipmost non-closed branch head | |
520 |
|
520 | |||
521 | $ hg update null |
|
521 | $ hg update null | |
522 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
522 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
523 | $ hg branch newbranch |
|
523 | $ hg branch newbranch | |
524 | marked working directory as branch newbranch |
|
524 | marked working directory as branch newbranch | |
525 | (branches are permanent and global, did you want a bookmark?) |
|
525 | (branches are permanent and global, did you want a bookmark?) | |
526 | $ hg update -C |
|
526 | $ hg update -C | |
527 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
527 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
528 | $ hg summary |
|
528 | $ hg summary | |
529 | parent: 2:991a3460af53 tip |
|
529 | parent: 2:991a3460af53 tip | |
530 | c |
|
530 | c | |
531 | branch: default |
|
531 | branch: default | |
532 | commit: (clean) |
|
532 | commit: (clean) | |
533 | update: (current) |
|
533 | update: (current) | |
534 | phases: 3 draft |
|
534 | phases: 3 draft |
@@ -1,410 +1,410 b'' | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > rebase= |
|
3 | > rebase= | |
4 | > |
|
4 | > | |
5 | > [phases] |
|
5 | > [phases] | |
6 | > publish=False |
|
6 | > publish=False | |
7 | > |
|
7 | > | |
8 | > [alias] |
|
8 | > [alias] | |
9 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" |
|
9 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | $ hg init a |
|
12 | $ hg init a | |
13 | $ cd a |
|
13 | $ cd a | |
14 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
14 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | |
15 | adding changesets |
|
15 | adding changesets | |
16 | adding manifests |
|
16 | adding manifests | |
17 | adding file changes |
|
17 | adding file changes | |
18 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
18 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
19 | new changesets cd010b8cd998:02de42196ebe (8 drafts) |
|
19 | new changesets cd010b8cd998:02de42196ebe (8 drafts) | |
20 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
20 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
21 | $ hg up tip |
|
21 | $ hg up tip | |
22 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
23 | $ cd .. |
|
23 | $ cd .. | |
24 |
|
24 | |||
25 | $ hg clone -q -u . a a1 |
|
25 | $ hg clone -q -u . a a1 | |
26 |
|
26 | |||
27 | $ cd a1 |
|
27 | $ cd a1 | |
28 |
|
28 | |||
29 | $ hg update 3 |
|
29 | $ hg update 3 | |
30 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
30 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
31 | $ hg branch dev-one |
|
31 | $ hg branch dev-one | |
32 | marked working directory as branch dev-one |
|
32 | marked working directory as branch dev-one | |
33 | (branches are permanent and global, did you want a bookmark?) |
|
33 | (branches are permanent and global, did you want a bookmark?) | |
34 | $ hg ci -m 'dev-one named branch' |
|
34 | $ hg ci -m 'dev-one named branch' | |
35 |
|
35 | |||
36 | $ hg update 7 |
|
36 | $ hg update 7 | |
37 | 2 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
37 | 2 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
38 | $ hg branch dev-two |
|
38 | $ hg branch dev-two | |
39 | marked working directory as branch dev-two |
|
39 | marked working directory as branch dev-two | |
40 |
|
40 | |||
41 | $ echo x > x |
|
41 | $ echo x > x | |
42 |
|
42 | |||
43 | $ hg add x |
|
43 | $ hg add x | |
44 |
|
44 | |||
45 | $ hg ci -m 'dev-two named branch' |
|
45 | $ hg ci -m 'dev-two named branch' | |
46 |
|
46 | |||
47 | $ hg tglog |
|
47 | $ hg tglog | |
48 | @ 9: cb039b7cae8e 'dev-two named branch' dev-two |
|
48 | @ 9: cb039b7cae8e 'dev-two named branch' dev-two | |
49 | | |
|
49 | | | |
50 | | o 8: 643fc9128048 'dev-one named branch' dev-one |
|
50 | | o 8: 643fc9128048 'dev-one named branch' dev-one | |
51 | | | |
|
51 | | | | |
52 | o | 7: 02de42196ebe 'H' |
|
52 | o | 7: 02de42196ebe 'H' | |
53 | | | |
|
53 | | | | |
54 | +---o 6: eea13746799a 'G' |
|
54 | +---o 6: eea13746799a 'G' | |
55 | | | | |
|
55 | | | | | |
56 | o | | 5: 24b6387c8c8c 'F' |
|
56 | o | | 5: 24b6387c8c8c 'F' | |
57 | | | | |
|
57 | | | | | |
58 | +---o 4: 9520eea781bc 'E' |
|
58 | +---o 4: 9520eea781bc 'E' | |
59 | | | |
|
59 | | | | |
60 | | o 3: 32af7686d403 'D' |
|
60 | | o 3: 32af7686d403 'D' | |
61 | | | |
|
61 | | | | |
62 | | o 2: 5fddd98957c8 'C' |
|
62 | | o 2: 5fddd98957c8 'C' | |
63 | | | |
|
63 | | | | |
64 | | o 1: 42ccdea3bb16 'B' |
|
64 | | o 1: 42ccdea3bb16 'B' | |
65 | |/ |
|
65 | |/ | |
66 | o 0: cd010b8cd998 'A' |
|
66 | o 0: cd010b8cd998 'A' | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | Branch name containing a dash (issue3181) |
|
69 | Branch name containing a dash (issue3181) | |
70 |
|
70 | |||
71 | $ hg rebase -b dev-two -d dev-one --keepbranches |
|
71 | $ hg rebase -b dev-two -d dev-one --keepbranches | |
72 | rebasing 5:24b6387c8c8c "F" |
|
72 | rebasing 5:24b6387c8c8c "F" | |
73 | rebasing 6:eea13746799a "G" |
|
73 | rebasing 6:eea13746799a "G" | |
74 | rebasing 7:02de42196ebe "H" |
|
74 | rebasing 7:02de42196ebe "H" | |
75 | rebasing 9:cb039b7cae8e "dev-two named branch" (tip) |
|
75 | rebasing 9:cb039b7cae8e "dev-two named branch" (tip) | |
76 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg |
|
76 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg | |
77 |
|
77 | |||
78 | $ hg tglog |
|
78 | $ hg tglog | |
79 | @ 9: 9e70cd31750f 'dev-two named branch' dev-two |
|
79 | @ 9: 9e70cd31750f 'dev-two named branch' dev-two | |
80 | | |
|
80 | | | |
81 | o 8: 31d0e4ba75e6 'H' |
|
81 | o 8: 31d0e4ba75e6 'H' | |
82 | | |
|
82 | | | |
83 | | o 7: 4b988a958030 'G' |
|
83 | | o 7: 4b988a958030 'G' | |
84 | |/| |
|
84 | |/| | |
85 | o | 6: 24de4aff8e28 'F' |
|
85 | o | 6: 24de4aff8e28 'F' | |
86 | | | |
|
86 | | | | |
87 | o | 5: 643fc9128048 'dev-one named branch' dev-one |
|
87 | o | 5: 643fc9128048 'dev-one named branch' dev-one | |
88 | | | |
|
88 | | | | |
89 | | o 4: 9520eea781bc 'E' |
|
89 | | o 4: 9520eea781bc 'E' | |
90 | | | |
|
90 | | | | |
91 | o | 3: 32af7686d403 'D' |
|
91 | o | 3: 32af7686d403 'D' | |
92 | | | |
|
92 | | | | |
93 | o | 2: 5fddd98957c8 'C' |
|
93 | o | 2: 5fddd98957c8 'C' | |
94 | | | |
|
94 | | | | |
95 | o | 1: 42ccdea3bb16 'B' |
|
95 | o | 1: 42ccdea3bb16 'B' | |
96 | |/ |
|
96 | |/ | |
97 | o 0: cd010b8cd998 'A' |
|
97 | o 0: cd010b8cd998 'A' | |
98 |
|
98 | |||
99 | $ hg rebase -s dev-one -d 0 --keepbranches |
|
99 | $ hg rebase -s dev-one -d 0 --keepbranches | |
100 | rebasing 5:643fc9128048 "dev-one named branch" |
|
100 | rebasing 5:643fc9128048 "dev-one named branch" | |
101 | rebasing 6:24de4aff8e28 "F" |
|
101 | rebasing 6:24de4aff8e28 "F" | |
102 | rebasing 7:4b988a958030 "G" |
|
102 | rebasing 7:4b988a958030 "G" | |
103 | rebasing 8:31d0e4ba75e6 "H" |
|
103 | rebasing 8:31d0e4ba75e6 "H" | |
104 | rebasing 9:9e70cd31750f "dev-two named branch" (tip) |
|
104 | rebasing 9:9e70cd31750f "dev-two named branch" (tip) | |
105 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg |
|
105 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg | |
106 |
|
106 | |||
107 | $ hg tglog |
|
107 | $ hg tglog | |
108 | @ 9: 59c2e59309fe 'dev-two named branch' dev-two |
|
108 | @ 9: 59c2e59309fe 'dev-two named branch' dev-two | |
109 | | |
|
109 | | | |
110 | o 8: 904590360559 'H' |
|
110 | o 8: 904590360559 'H' | |
111 | | |
|
111 | | | |
112 | | o 7: 1a1e6f72ec38 'G' |
|
112 | | o 7: 1a1e6f72ec38 'G' | |
113 | |/| |
|
113 | |/| | |
114 | o | 6: 42aa3cf0fa7a 'F' |
|
114 | o | 6: 42aa3cf0fa7a 'F' | |
115 | | | |
|
115 | | | | |
116 | o | 5: bc8139ee757c 'dev-one named branch' dev-one |
|
116 | o | 5: bc8139ee757c 'dev-one named branch' dev-one | |
117 | | | |
|
117 | | | | |
118 | | o 4: 9520eea781bc 'E' |
|
118 | | o 4: 9520eea781bc 'E' | |
119 | |/ |
|
119 | |/ | |
120 | | o 3: 32af7686d403 'D' |
|
120 | | o 3: 32af7686d403 'D' | |
121 | | | |
|
121 | | | | |
122 | | o 2: 5fddd98957c8 'C' |
|
122 | | o 2: 5fddd98957c8 'C' | |
123 | | | |
|
123 | | | | |
124 | | o 1: 42ccdea3bb16 'B' |
|
124 | | o 1: 42ccdea3bb16 'B' | |
125 | |/ |
|
125 | |/ | |
126 | o 0: cd010b8cd998 'A' |
|
126 | o 0: cd010b8cd998 'A' | |
127 |
|
127 | |||
128 | $ hg update 3 |
|
128 | $ hg update 3 | |
129 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
129 | 3 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
130 | $ hg branch -f dev-one |
|
130 | $ hg branch -f dev-one | |
131 | marked working directory as branch dev-one |
|
131 | marked working directory as branch dev-one | |
132 | $ hg ci -m 'dev-one named branch' |
|
132 | $ hg ci -m 'dev-one named branch' | |
133 | created new head |
|
133 | created new head | |
134 |
|
134 | |||
135 | $ hg tglog |
|
135 | $ hg tglog | |
136 | @ 10: 643fc9128048 'dev-one named branch' dev-one |
|
136 | @ 10: 643fc9128048 'dev-one named branch' dev-one | |
137 | | |
|
137 | | | |
138 | | o 9: 59c2e59309fe 'dev-two named branch' dev-two |
|
138 | | o 9: 59c2e59309fe 'dev-two named branch' dev-two | |
139 | | | |
|
139 | | | | |
140 | | o 8: 904590360559 'H' |
|
140 | | o 8: 904590360559 'H' | |
141 | | | |
|
141 | | | | |
142 | | | o 7: 1a1e6f72ec38 'G' |
|
142 | | | o 7: 1a1e6f72ec38 'G' | |
143 | | |/| |
|
143 | | |/| | |
144 | | o | 6: 42aa3cf0fa7a 'F' |
|
144 | | o | 6: 42aa3cf0fa7a 'F' | |
145 | | | | |
|
145 | | | | | |
146 | | o | 5: bc8139ee757c 'dev-one named branch' dev-one |
|
146 | | o | 5: bc8139ee757c 'dev-one named branch' dev-one | |
147 | | | | |
|
147 | | | | | |
148 | | | o 4: 9520eea781bc 'E' |
|
148 | | | o 4: 9520eea781bc 'E' | |
149 | | |/ |
|
149 | | |/ | |
150 | o | 3: 32af7686d403 'D' |
|
150 | o | 3: 32af7686d403 'D' | |
151 | | | |
|
151 | | | | |
152 | o | 2: 5fddd98957c8 'C' |
|
152 | o | 2: 5fddd98957c8 'C' | |
153 | | | |
|
153 | | | | |
154 | o | 1: 42ccdea3bb16 'B' |
|
154 | o | 1: 42ccdea3bb16 'B' | |
155 | |/ |
|
155 | |/ | |
156 | o 0: cd010b8cd998 'A' |
|
156 | o 0: cd010b8cd998 'A' | |
157 |
|
157 | |||
158 | $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches |
|
158 | $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches | |
159 | rebasing 5:bc8139ee757c "dev-one named branch" |
|
159 | rebasing 5:bc8139ee757c "dev-one named branch" | |
160 | note: not rebasing 5:bc8139ee757c "dev-one named branch", its destination already has all its changes |
|
160 | note: not rebasing 5:bc8139ee757c "dev-one named branch", its destination already has all its changes | |
161 | rebasing 6:42aa3cf0fa7a "F" |
|
161 | rebasing 6:42aa3cf0fa7a "F" | |
162 | rebasing 7:1a1e6f72ec38 "G" |
|
162 | rebasing 7:1a1e6f72ec38 "G" | |
163 | rebasing 8:904590360559 "H" |
|
163 | rebasing 8:904590360559 "H" | |
164 | rebasing 9:59c2e59309fe "dev-two named branch" |
|
164 | rebasing 9:59c2e59309fe "dev-two named branch" | |
165 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg |
|
165 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg | |
166 |
|
166 | |||
167 | $ hg tglog |
|
167 | $ hg tglog | |
168 | o 9: 71325f8bc082 'dev-two named branch' dev-two |
|
168 | o 9: 71325f8bc082 'dev-two named branch' dev-two | |
169 | | |
|
169 | | | |
170 | o 8: 12b2bc666e20 'H' |
|
170 | o 8: 12b2bc666e20 'H' | |
171 | | |
|
171 | | | |
172 | | o 7: 549f007a9f5f 'G' |
|
172 | | o 7: 549f007a9f5f 'G' | |
173 | |/| |
|
173 | |/| | |
174 | o | 6: 679f28760620 'F' |
|
174 | o | 6: 679f28760620 'F' | |
175 | | | |
|
175 | | | | |
176 | @ | 5: 643fc9128048 'dev-one named branch' dev-one |
|
176 | @ | 5: 643fc9128048 'dev-one named branch' dev-one | |
177 | | | |
|
177 | | | | |
178 | | o 4: 9520eea781bc 'E' |
|
178 | | o 4: 9520eea781bc 'E' | |
179 | | | |
|
179 | | | | |
180 | o | 3: 32af7686d403 'D' |
|
180 | o | 3: 32af7686d403 'D' | |
181 | | | |
|
181 | | | | |
182 | o | 2: 5fddd98957c8 'C' |
|
182 | o | 2: 5fddd98957c8 'C' | |
183 | | | |
|
183 | | | | |
184 | o | 1: 42ccdea3bb16 'B' |
|
184 | o | 1: 42ccdea3bb16 'B' | |
185 | |/ |
|
185 | |/ | |
186 | o 0: cd010b8cd998 'A' |
|
186 | o 0: cd010b8cd998 'A' | |
187 |
|
187 | |||
188 | $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches |
|
188 | $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches | |
189 | rebasing 5:643fc9128048 "dev-one named branch" |
|
189 | rebasing 5:643fc9128048 "dev-one named branch" | |
190 | rebasing 6:679f28760620 "F" |
|
190 | rebasing 6:679f28760620 "F" | |
191 | rebasing 7:549f007a9f5f "G" |
|
191 | rebasing 7:549f007a9f5f "G" | |
192 | rebasing 8:12b2bc666e20 "H" |
|
192 | rebasing 8:12b2bc666e20 "H" | |
193 | rebasing 9:71325f8bc082 "dev-two named branch" (tip) |
|
193 | rebasing 9:71325f8bc082 "dev-two named branch" (tip) | |
194 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg |
|
194 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg | |
195 |
|
195 | |||
196 | $ hg tglog |
|
196 | $ hg tglog | |
197 | o 9: 3944801ae4ea 'dev-two named branch' dev-two |
|
197 | o 9: 3944801ae4ea 'dev-two named branch' dev-two | |
198 | | |
|
198 | | | |
199 | o 8: 8e279d293175 'H' |
|
199 | o 8: 8e279d293175 'H' | |
200 | | |
|
200 | | | |
201 | | o 7: aeefee77ab01 'G' |
|
201 | | o 7: aeefee77ab01 'G' | |
202 | |/| |
|
202 | |/| | |
203 | o | 6: e908b85f3729 'F' |
|
203 | o | 6: e908b85f3729 'F' | |
204 | | | |
|
204 | | | | |
205 | @ | 5: bc8139ee757c 'dev-one named branch' dev-one |
|
205 | @ | 5: bc8139ee757c 'dev-one named branch' dev-one | |
206 | | | |
|
206 | | | | |
207 | | o 4: 9520eea781bc 'E' |
|
207 | | o 4: 9520eea781bc 'E' | |
208 | |/ |
|
208 | |/ | |
209 | | o 3: 32af7686d403 'D' |
|
209 | | o 3: 32af7686d403 'D' | |
210 | | | |
|
210 | | | | |
211 | | o 2: 5fddd98957c8 'C' |
|
211 | | o 2: 5fddd98957c8 'C' | |
212 | | | |
|
212 | | | | |
213 | | o 1: 42ccdea3bb16 'B' |
|
213 | | o 1: 42ccdea3bb16 'B' | |
214 | |/ |
|
214 | |/ | |
215 | o 0: cd010b8cd998 'A' |
|
215 | o 0: cd010b8cd998 'A' | |
216 |
|
216 | |||
217 | $ hg up -r 0 > /dev/null |
|
217 | $ hg up -r 0 > /dev/null | |
218 |
|
218 | |||
219 | Rebasing descendant onto ancestor across different named branches |
|
219 | Rebasing descendant onto ancestor across different named branches | |
220 |
|
220 | |||
221 | $ hg rebase -s 1 -d 9 --keepbranches |
|
221 | $ hg rebase -s 1 -d 9 --keepbranches | |
222 | rebasing 1:42ccdea3bb16 "B" |
|
222 | rebasing 1:42ccdea3bb16 "B" | |
223 | rebasing 2:5fddd98957c8 "C" |
|
223 | rebasing 2:5fddd98957c8 "C" | |
224 | rebasing 3:32af7686d403 "D" |
|
224 | rebasing 3:32af7686d403 "D" | |
225 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
225 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
226 |
|
226 | |||
227 | $ hg tglog |
|
227 | $ hg tglog | |
228 | o 9: e9f862ce8bad 'D' |
|
228 | o 9: e9f862ce8bad 'D' | |
229 | | |
|
229 | | | |
230 | o 8: a0d543090fa4 'C' |
|
230 | o 8: a0d543090fa4 'C' | |
231 | | |
|
231 | | | |
232 | o 7: 3bdb949809d9 'B' |
|
232 | o 7: 3bdb949809d9 'B' | |
233 | | |
|
233 | | | |
234 | o 6: 3944801ae4ea 'dev-two named branch' dev-two |
|
234 | o 6: 3944801ae4ea 'dev-two named branch' dev-two | |
235 | | |
|
235 | | | |
236 | o 5: 8e279d293175 'H' |
|
236 | o 5: 8e279d293175 'H' | |
237 | | |
|
237 | | | |
238 | | o 4: aeefee77ab01 'G' |
|
238 | | o 4: aeefee77ab01 'G' | |
239 | |/| |
|
239 | |/| | |
240 | o | 3: e908b85f3729 'F' |
|
240 | o | 3: e908b85f3729 'F' | |
241 | | | |
|
241 | | | | |
242 | o | 2: bc8139ee757c 'dev-one named branch' dev-one |
|
242 | o | 2: bc8139ee757c 'dev-one named branch' dev-one | |
243 | | | |
|
243 | | | | |
244 | | o 1: 9520eea781bc 'E' |
|
244 | | o 1: 9520eea781bc 'E' | |
245 | |/ |
|
245 | |/ | |
246 | @ 0: cd010b8cd998 'A' |
|
246 | @ 0: cd010b8cd998 'A' | |
247 |
|
247 | |||
248 | $ hg rebase -s 5 -d 6 |
|
248 | $ hg rebase -s 5 -d 6 | |
249 | abort: source and destination form a cycle |
|
249 | abort: source and destination form a cycle | |
250 | [255] |
|
250 | [255] | |
251 |
|
251 | |||
252 | $ hg rebase -s 6 -d 5 |
|
252 | $ hg rebase -s 6 -d 5 | |
253 | rebasing 6:3944801ae4ea "dev-two named branch" |
|
253 | rebasing 6:3944801ae4ea "dev-two named branch" | |
254 | rebasing 7:3bdb949809d9 "B" |
|
254 | rebasing 7:3bdb949809d9 "B" | |
255 | rebasing 8:a0d543090fa4 "C" |
|
255 | rebasing 8:a0d543090fa4 "C" | |
256 | rebasing 9:e9f862ce8bad "D" (tip) |
|
256 | rebasing 9:e9f862ce8bad "D" (tip) | |
257 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg |
|
257 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg | |
258 |
|
258 | |||
259 | $ hg tglog |
|
259 | $ hg tglog | |
260 | o 9: e522577ccdbd 'D' |
|
260 | o 9: e522577ccdbd 'D' | |
261 | | |
|
261 | | | |
262 | o 8: 810110211f50 'C' |
|
262 | o 8: 810110211f50 'C' | |
263 | | |
|
263 | | | |
264 | o 7: 160b0930ccc6 'B' |
|
264 | o 7: 160b0930ccc6 'B' | |
265 | | |
|
265 | | | |
266 | o 6: c57724c84928 'dev-two named branch' |
|
266 | o 6: c57724c84928 'dev-two named branch' | |
267 | | |
|
267 | | | |
268 | o 5: 8e279d293175 'H' |
|
268 | o 5: 8e279d293175 'H' | |
269 | | |
|
269 | | | |
270 | | o 4: aeefee77ab01 'G' |
|
270 | | o 4: aeefee77ab01 'G' | |
271 | |/| |
|
271 | |/| | |
272 | o | 3: e908b85f3729 'F' |
|
272 | o | 3: e908b85f3729 'F' | |
273 | | | |
|
273 | | | | |
274 | o | 2: bc8139ee757c 'dev-one named branch' dev-one |
|
274 | o | 2: bc8139ee757c 'dev-one named branch' dev-one | |
275 | | | |
|
275 | | | | |
276 | | o 1: 9520eea781bc 'E' |
|
276 | | o 1: 9520eea781bc 'E' | |
277 | |/ |
|
277 | |/ | |
278 | @ 0: cd010b8cd998 'A' |
|
278 | @ 0: cd010b8cd998 'A' | |
279 |
|
279 | |||
280 |
|
280 | |||
281 | Reopen branch by rebase |
|
281 | Reopen branch by rebase | |
282 |
|
282 | |||
283 | $ hg up -qr3 |
|
283 | $ hg up -qr3 | |
284 | $ hg branch -q b |
|
284 | $ hg branch -q b | |
285 | $ hg ci -m 'create b' |
|
285 | $ hg ci -m 'create b' | |
286 | $ hg ci -m 'close b' --close |
|
286 | $ hg ci -m 'close b' --close | |
287 | $ hg rebase -b 8 -d b |
|
287 | $ hg rebase -b 8 -d b | |
288 | reopening closed branch head 2b586e70108d |
|
288 | reopening closed branch head 2b586e70108d | |
289 | rebasing 5:8e279d293175 "H" |
|
289 | rebasing 5:8e279d293175 "H" | |
290 | rebasing 6:c57724c84928 "dev-two named branch" |
|
290 | rebasing 6:c57724c84928 "dev-two named branch" | |
291 | rebasing 7:160b0930ccc6 "B" |
|
291 | rebasing 7:160b0930ccc6 "B" | |
292 | rebasing 8:810110211f50 "C" |
|
292 | rebasing 8:810110211f50 "C" | |
293 | rebasing 9:e522577ccdbd "D" |
|
293 | rebasing 9:e522577ccdbd "D" | |
294 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg |
|
294 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg | |
295 |
|
295 | |||
296 | $ cd .. |
|
296 | $ cd .. | |
297 |
|
297 | |||
298 | Rebase to other head on branch |
|
298 | Rebase to other head on branch | |
299 |
|
299 | |||
300 | Set up a case: |
|
300 | Set up a case: | |
301 |
|
301 | |||
302 | $ hg init case1 |
|
302 | $ hg init case1 | |
303 | $ cd case1 |
|
303 | $ cd case1 | |
304 | $ touch f |
|
304 | $ touch f | |
305 | $ hg ci -qAm0 |
|
305 | $ hg ci -qAm0 | |
306 | $ hg branch -q b |
|
306 | $ hg branch -q b | |
307 | $ echo >> f |
|
307 | $ echo >> f | |
308 | $ hg ci -qAm 'b1' |
|
308 | $ hg ci -qAm 'b1' | |
309 | $ hg up -qr -2 |
|
309 | $ hg up -qr -2 | |
310 | $ hg branch -qf b |
|
310 | $ hg branch -qf b | |
311 | $ hg ci -qm 'b2' |
|
311 | $ hg ci -qm 'b2' | |
312 | $ hg up -qr -3 |
|
312 | $ hg up -qr -3 | |
313 | $ hg branch -q c |
|
313 | $ hg branch -q c | |
314 | $ hg ci -m 'c1' |
|
314 | $ hg ci -m 'c1' | |
315 |
|
315 | |||
316 | $ hg tglog |
|
316 | $ hg tglog | |
317 | @ 3: c062e3ecd6c6 'c1' c |
|
317 | @ 3: c062e3ecd6c6 'c1' c | |
318 | | |
|
318 | | | |
319 | | o 2: 792845bb77ee 'b2' b |
|
319 | | o 2: 792845bb77ee 'b2' b | |
320 | |/ |
|
320 | |/ | |
321 | | o 1: 40039acb7ca5 'b1' b |
|
321 | | o 1: 40039acb7ca5 'b1' b | |
322 | |/ |
|
322 | |/ | |
323 | o 0: d681519c3ea7 '0' |
|
323 | o 0: d681519c3ea7 '0' | |
324 |
|
324 | |||
325 | $ hg clone -q . ../case2 |
|
325 | $ hg clone -q . ../case2 | |
326 |
|
326 | |||
327 | rebase 'b2' to another lower branch head |
|
327 | rebase 'b2' to another lower branch head | |
328 |
|
328 | |||
329 | $ hg up -qr 2 |
|
329 | $ hg up -qr 2 | |
330 | $ hg rebase |
|
330 | $ hg rebase | |
331 | rebasing 2:792845bb77ee "b2" |
|
331 | rebasing 2:792845bb77ee "b2" | |
332 | note: not rebasing 2:792845bb77ee "b2", its destination already has all its changes |
|
332 | note: not rebasing 2:792845bb77ee "b2", its destination already has all its changes | |
333 | saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg |
|
333 | saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg | |
334 | $ hg tglog |
|
334 | $ hg tglog | |
335 | o 2: c062e3ecd6c6 'c1' c |
|
335 | o 2: c062e3ecd6c6 'c1' c | |
336 | | |
|
336 | | | |
337 | | @ 1: 40039acb7ca5 'b1' b |
|
337 | | @ 1: 40039acb7ca5 'b1' b | |
338 | |/ |
|
338 | |/ | |
339 | o 0: d681519c3ea7 '0' |
|
339 | o 0: d681519c3ea7 '0' | |
340 |
|
340 | |||
341 |
|
341 | |||
342 | rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1') |
|
342 | rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1') | |
343 |
|
343 | |||
344 | $ cd ../case2 |
|
344 | $ cd ../case2 | |
345 | $ hg up -qr 1 |
|
345 | $ hg up -qr 1 | |
346 | $ hg rebase |
|
346 | $ hg rebase | |
347 | rebasing 1:40039acb7ca5 "b1" |
|
347 | rebasing 1:40039acb7ca5 "b1" | |
348 | saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg |
|
348 | saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg | |
349 | $ hg tglog |
|
349 | $ hg tglog | |
350 | @ 3: 76abc1c6f8c7 'b1' b |
|
350 | @ 3: 76abc1c6f8c7 'b1' b | |
351 | | |
|
351 | | | |
352 | | o 2: c062e3ecd6c6 'c1' c |
|
352 | | o 2: c062e3ecd6c6 'c1' c | |
353 | | | |
|
353 | | | | |
354 | o | 1: 792845bb77ee 'b2' b |
|
354 | o | 1: 792845bb77ee 'b2' b | |
355 | |/ |
|
355 | |/ | |
356 | o 0: d681519c3ea7 '0' |
|
356 | o 0: d681519c3ea7 '0' | |
357 |
|
357 | |||
358 |
|
358 | |||
359 | rebase 'c1' to the branch head 'c2' that is closed |
|
359 | rebase 'c1' to the branch head 'c2' that is closed | |
360 |
|
360 | |||
361 | $ hg branch -qf c |
|
361 | $ hg branch -qf c | |
362 | $ hg ci -qm 'c2 closed' --close |
|
362 | $ hg ci -qm 'c2 closed' --close | |
363 | $ hg up -qr 2 |
|
363 | $ hg up -qr 2 | |
364 | $ hg tglog |
|
364 | $ hg tglog | |
365 | _ 4: 8427af5d86f2 'c2 closed' c |
|
365 | _ 4: 8427af5d86f2 'c2 closed' c | |
366 | | |
|
366 | | | |
367 | o 3: 76abc1c6f8c7 'b1' b |
|
367 | o 3: 76abc1c6f8c7 'b1' b | |
368 | | |
|
368 | | | |
369 | | @ 2: c062e3ecd6c6 'c1' c |
|
369 | | @ 2: c062e3ecd6c6 'c1' c | |
370 | | | |
|
370 | | | | |
371 | o | 1: 792845bb77ee 'b2' b |
|
371 | o | 1: 792845bb77ee 'b2' b | |
372 | |/ |
|
372 | |/ | |
373 | o 0: d681519c3ea7 '0' |
|
373 | o 0: d681519c3ea7 '0' | |
374 |
|
374 | |||
375 | $ hg rebase |
|
375 | $ hg rebase | |
376 | abort: branch 'c' has one head - please rebase to an explicit rev |
|
376 | abort: branch 'c' has one head - please rebase to an explicit rev | |
377 | (run 'hg heads' to see all heads) |
|
377 | (run 'hg heads' to see all heads, specify destination with -d) | |
378 | [255] |
|
378 | [255] | |
379 | $ hg tglog |
|
379 | $ hg tglog | |
380 | _ 4: 8427af5d86f2 'c2 closed' c |
|
380 | _ 4: 8427af5d86f2 'c2 closed' c | |
381 | | |
|
381 | | | |
382 | o 3: 76abc1c6f8c7 'b1' b |
|
382 | o 3: 76abc1c6f8c7 'b1' b | |
383 | | |
|
383 | | | |
384 | | @ 2: c062e3ecd6c6 'c1' c |
|
384 | | @ 2: c062e3ecd6c6 'c1' c | |
385 | | | |
|
385 | | | | |
386 | o | 1: 792845bb77ee 'b2' b |
|
386 | o | 1: 792845bb77ee 'b2' b | |
387 | |/ |
|
387 | |/ | |
388 | o 0: d681519c3ea7 '0' |
|
388 | o 0: d681519c3ea7 '0' | |
389 |
|
389 | |||
390 |
|
390 | |||
391 | $ hg up -cr 1 |
|
391 | $ hg up -cr 1 | |
392 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
392 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
393 | $ hg branch x |
|
393 | $ hg branch x | |
394 | marked working directory as branch x |
|
394 | marked working directory as branch x | |
395 | $ hg rebase -r 3:: -d . |
|
395 | $ hg rebase -r 3:: -d . | |
396 | rebasing 3:76abc1c6f8c7 "b1" |
|
396 | rebasing 3:76abc1c6f8c7 "b1" | |
397 | rebasing 4:8427af5d86f2 "c2 closed" (tip) |
|
397 | rebasing 4:8427af5d86f2 "c2 closed" (tip) | |
398 | note: not rebasing 4:8427af5d86f2 "c2 closed" (tip), its destination already has all its changes |
|
398 | note: not rebasing 4:8427af5d86f2 "c2 closed" (tip), its destination already has all its changes | |
399 | saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg |
|
399 | saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg | |
400 | $ hg tglog |
|
400 | $ hg tglog | |
401 | o 3: 117b0ed08075 'b1' x |
|
401 | o 3: 117b0ed08075 'b1' x | |
402 | | |
|
402 | | | |
403 | | o 2: c062e3ecd6c6 'c1' c |
|
403 | | o 2: c062e3ecd6c6 'c1' c | |
404 | | | |
|
404 | | | | |
405 | @ | 1: 792845bb77ee 'b2' b |
|
405 | @ | 1: 792845bb77ee 'b2' b | |
406 | |/ |
|
406 | |/ | |
407 | o 0: d681519c3ea7 '0' |
|
407 | o 0: d681519c3ea7 '0' | |
408 |
|
408 | |||
409 |
|
409 | |||
410 | $ cd .. |
|
410 | $ cd .. |
@@ -1,521 +1,521 b'' | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > rebase= |
|
3 | > rebase= | |
4 | > |
|
4 | > | |
5 | > [phases] |
|
5 | > [phases] | |
6 | > publish=False |
|
6 | > publish=False | |
7 | > |
|
7 | > | |
8 | > [alias] |
|
8 | > [alias] | |
9 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" |
|
9 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 |
|
12 | |||
13 | $ hg init a |
|
13 | $ hg init a | |
14 | $ cd a |
|
14 | $ cd a | |
15 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
15 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | |
16 | adding changesets |
|
16 | adding changesets | |
17 | adding manifests |
|
17 | adding manifests | |
18 | adding file changes |
|
18 | adding file changes | |
19 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
19 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
20 | new changesets cd010b8cd998:02de42196ebe (8 drafts) |
|
20 | new changesets cd010b8cd998:02de42196ebe (8 drafts) | |
21 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
21 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
22 | $ hg up tip |
|
22 | $ hg up tip | |
23 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
23 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
24 |
|
24 | |||
25 | $ echo I > I |
|
25 | $ echo I > I | |
26 | $ hg ci -AmI |
|
26 | $ hg ci -AmI | |
27 | adding I |
|
27 | adding I | |
28 |
|
28 | |||
29 | $ hg tglog |
|
29 | $ hg tglog | |
30 | @ 8: e7ec4e813ba6 'I' |
|
30 | @ 8: e7ec4e813ba6 'I' | |
31 | | |
|
31 | | | |
32 | o 7: 02de42196ebe 'H' |
|
32 | o 7: 02de42196ebe 'H' | |
33 | | |
|
33 | | | |
34 | | o 6: eea13746799a 'G' |
|
34 | | o 6: eea13746799a 'G' | |
35 | |/| |
|
35 | |/| | |
36 | o | 5: 24b6387c8c8c 'F' |
|
36 | o | 5: 24b6387c8c8c 'F' | |
37 | | | |
|
37 | | | | |
38 | | o 4: 9520eea781bc 'E' |
|
38 | | o 4: 9520eea781bc 'E' | |
39 | |/ |
|
39 | |/ | |
40 | | o 3: 32af7686d403 'D' |
|
40 | | o 3: 32af7686d403 'D' | |
41 | | | |
|
41 | | | | |
42 | | o 2: 5fddd98957c8 'C' |
|
42 | | o 2: 5fddd98957c8 'C' | |
43 | | | |
|
43 | | | | |
44 | | o 1: 42ccdea3bb16 'B' |
|
44 | | o 1: 42ccdea3bb16 'B' | |
45 | |/ |
|
45 | |/ | |
46 | o 0: cd010b8cd998 'A' |
|
46 | o 0: cd010b8cd998 'A' | |
47 |
|
47 | |||
48 | $ cd .. |
|
48 | $ cd .. | |
49 |
|
49 | |||
50 | Version with only two heads (to allow default destination to work) |
|
50 | Version with only two heads (to allow default destination to work) | |
51 |
|
51 | |||
52 | $ hg clone -q -u . a a2heads -r 3 -r 8 |
|
52 | $ hg clone -q -u . a a2heads -r 3 -r 8 | |
53 |
|
53 | |||
54 | These fail: |
|
54 | These fail: | |
55 |
|
55 | |||
56 | $ hg clone -q -u . a a0 |
|
56 | $ hg clone -q -u . a a0 | |
57 | $ cd a0 |
|
57 | $ cd a0 | |
58 |
|
58 | |||
59 | $ hg rebase -s 8 -d 7 |
|
59 | $ hg rebase -s 8 -d 7 | |
60 | nothing to rebase |
|
60 | nothing to rebase | |
61 | [1] |
|
61 | [1] | |
62 |
|
62 | |||
63 | $ hg rebase --continue --abort |
|
63 | $ hg rebase --continue --abort | |
64 | abort: cannot use --abort with --continue |
|
64 | abort: cannot use --abort with --continue | |
65 | [255] |
|
65 | [255] | |
66 |
|
66 | |||
67 | $ hg rebase --continue --collapse |
|
67 | $ hg rebase --continue --collapse | |
68 | abort: cannot use collapse with continue or abort |
|
68 | abort: cannot use collapse with continue or abort | |
69 | [255] |
|
69 | [255] | |
70 |
|
70 | |||
71 | $ hg rebase --continue --dest 4 |
|
71 | $ hg rebase --continue --dest 4 | |
72 | abort: abort and continue do not allow specifying revisions |
|
72 | abort: abort and continue do not allow specifying revisions | |
73 | [255] |
|
73 | [255] | |
74 |
|
74 | |||
75 | $ hg rebase --base 5 --source 4 |
|
75 | $ hg rebase --base 5 --source 4 | |
76 | abort: cannot specify both a source and a base |
|
76 | abort: cannot specify both a source and a base | |
77 | [255] |
|
77 | [255] | |
78 |
|
78 | |||
79 | $ hg rebase --rev 5 --source 4 |
|
79 | $ hg rebase --rev 5 --source 4 | |
80 | abort: cannot specify both a revision and a source |
|
80 | abort: cannot specify both a revision and a source | |
81 | [255] |
|
81 | [255] | |
82 | $ hg rebase --base 5 --rev 4 |
|
82 | $ hg rebase --base 5 --rev 4 | |
83 | abort: cannot specify both a revision and a base |
|
83 | abort: cannot specify both a revision and a base | |
84 | [255] |
|
84 | [255] | |
85 |
|
85 | |||
86 | $ hg rebase --base 6 |
|
86 | $ hg rebase --base 6 | |
87 | abort: branch 'default' has 3 heads - please rebase to an explicit rev |
|
87 | abort: branch 'default' has 3 heads - please rebase to an explicit rev | |
88 | (run 'hg heads .' to see heads) |
|
88 | (run 'hg heads .' to see heads, specify destination with -d) | |
89 | [255] |
|
89 | [255] | |
90 |
|
90 | |||
91 | $ hg rebase --rev '1 & !1' --dest 8 |
|
91 | $ hg rebase --rev '1 & !1' --dest 8 | |
92 | empty "rev" revision set - nothing to rebase |
|
92 | empty "rev" revision set - nothing to rebase | |
93 | [1] |
|
93 | [1] | |
94 |
|
94 | |||
95 | $ hg rebase --source '1 & !1' --dest 8 |
|
95 | $ hg rebase --source '1 & !1' --dest 8 | |
96 | empty "source" revision set - nothing to rebase |
|
96 | empty "source" revision set - nothing to rebase | |
97 | [1] |
|
97 | [1] | |
98 |
|
98 | |||
99 | $ hg rebase --base '1 & !1' --dest 8 |
|
99 | $ hg rebase --base '1 & !1' --dest 8 | |
100 | empty "base" revision set - can't compute rebase set |
|
100 | empty "base" revision set - can't compute rebase set | |
101 | [1] |
|
101 | [1] | |
102 |
|
102 | |||
103 | $ hg rebase --dest 8 |
|
103 | $ hg rebase --dest 8 | |
104 | nothing to rebase - working directory parent is also destination |
|
104 | nothing to rebase - working directory parent is also destination | |
105 | [1] |
|
105 | [1] | |
106 |
|
106 | |||
107 | $ hg rebase -b . --dest 8 |
|
107 | $ hg rebase -b . --dest 8 | |
108 | nothing to rebase - e7ec4e813ba6 is both "base" and destination |
|
108 | nothing to rebase - e7ec4e813ba6 is both "base" and destination | |
109 | [1] |
|
109 | [1] | |
110 |
|
110 | |||
111 | $ hg up -q 7 |
|
111 | $ hg up -q 7 | |
112 |
|
112 | |||
113 | $ hg rebase --dest 8 --traceback |
|
113 | $ hg rebase --dest 8 --traceback | |
114 | nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6 |
|
114 | nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6 | |
115 | [1] |
|
115 | [1] | |
116 |
|
116 | |||
117 | $ hg rebase --dest 8 -b. |
|
117 | $ hg rebase --dest 8 -b. | |
118 | nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6 |
|
118 | nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6 | |
119 | [1] |
|
119 | [1] | |
120 |
|
120 | |||
121 | $ hg rebase --dest '1 & !1' |
|
121 | $ hg rebase --dest '1 & !1' | |
122 | abort: empty revision set |
|
122 | abort: empty revision set | |
123 | [255] |
|
123 | [255] | |
124 |
|
124 | |||
125 | These work: |
|
125 | These work: | |
126 |
|
126 | |||
127 | Rebase with no arguments (from 3 onto 8): |
|
127 | Rebase with no arguments (from 3 onto 8): | |
128 |
|
128 | |||
129 | $ cd .. |
|
129 | $ cd .. | |
130 | $ hg clone -q -u . a2heads a1 |
|
130 | $ hg clone -q -u . a2heads a1 | |
131 | $ cd a1 |
|
131 | $ cd a1 | |
132 | $ hg up -q -C 3 |
|
132 | $ hg up -q -C 3 | |
133 |
|
133 | |||
134 | $ hg rebase |
|
134 | $ hg rebase | |
135 | rebasing 1:42ccdea3bb16 "B" |
|
135 | rebasing 1:42ccdea3bb16 "B" | |
136 | rebasing 2:5fddd98957c8 "C" |
|
136 | rebasing 2:5fddd98957c8 "C" | |
137 | rebasing 3:32af7686d403 "D" |
|
137 | rebasing 3:32af7686d403 "D" | |
138 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
138 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
139 |
|
139 | |||
140 | $ hg tglog |
|
140 | $ hg tglog | |
141 | @ 6: ed65089c18f8 'D' |
|
141 | @ 6: ed65089c18f8 'D' | |
142 | | |
|
142 | | | |
143 | o 5: 7621bf1a2f17 'C' |
|
143 | o 5: 7621bf1a2f17 'C' | |
144 | | |
|
144 | | | |
145 | o 4: 9430a62369c6 'B' |
|
145 | o 4: 9430a62369c6 'B' | |
146 | | |
|
146 | | | |
147 | o 3: e7ec4e813ba6 'I' |
|
147 | o 3: e7ec4e813ba6 'I' | |
148 | | |
|
148 | | | |
149 | o 2: 02de42196ebe 'H' |
|
149 | o 2: 02de42196ebe 'H' | |
150 | | |
|
150 | | | |
151 | o 1: 24b6387c8c8c 'F' |
|
151 | o 1: 24b6387c8c8c 'F' | |
152 | | |
|
152 | | | |
153 | o 0: cd010b8cd998 'A' |
|
153 | o 0: cd010b8cd998 'A' | |
154 |
|
154 | |||
155 | Try to rollback after a rebase (fail): |
|
155 | Try to rollback after a rebase (fail): | |
156 |
|
156 | |||
157 | $ hg rollback |
|
157 | $ hg rollback | |
158 | no rollback information available |
|
158 | no rollback information available | |
159 | [1] |
|
159 | [1] | |
160 |
|
160 | |||
161 | $ cd .. |
|
161 | $ cd .. | |
162 |
|
162 | |||
163 | Rebase with base == '.' => same as no arguments (from 3 onto 8): |
|
163 | Rebase with base == '.' => same as no arguments (from 3 onto 8): | |
164 |
|
164 | |||
165 | $ hg clone -q -u 3 a2heads a2 |
|
165 | $ hg clone -q -u 3 a2heads a2 | |
166 | $ cd a2 |
|
166 | $ cd a2 | |
167 |
|
167 | |||
168 | $ hg rebase --base . |
|
168 | $ hg rebase --base . | |
169 | rebasing 1:42ccdea3bb16 "B" |
|
169 | rebasing 1:42ccdea3bb16 "B" | |
170 | rebasing 2:5fddd98957c8 "C" |
|
170 | rebasing 2:5fddd98957c8 "C" | |
171 | rebasing 3:32af7686d403 "D" |
|
171 | rebasing 3:32af7686d403 "D" | |
172 | saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
172 | saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
173 |
|
173 | |||
174 | $ hg tglog |
|
174 | $ hg tglog | |
175 | @ 6: ed65089c18f8 'D' |
|
175 | @ 6: ed65089c18f8 'D' | |
176 | | |
|
176 | | | |
177 | o 5: 7621bf1a2f17 'C' |
|
177 | o 5: 7621bf1a2f17 'C' | |
178 | | |
|
178 | | | |
179 | o 4: 9430a62369c6 'B' |
|
179 | o 4: 9430a62369c6 'B' | |
180 | | |
|
180 | | | |
181 | o 3: e7ec4e813ba6 'I' |
|
181 | o 3: e7ec4e813ba6 'I' | |
182 | | |
|
182 | | | |
183 | o 2: 02de42196ebe 'H' |
|
183 | o 2: 02de42196ebe 'H' | |
184 | | |
|
184 | | | |
185 | o 1: 24b6387c8c8c 'F' |
|
185 | o 1: 24b6387c8c8c 'F' | |
186 | | |
|
186 | | | |
187 | o 0: cd010b8cd998 'A' |
|
187 | o 0: cd010b8cd998 'A' | |
188 |
|
188 | |||
189 | $ cd .. |
|
189 | $ cd .. | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | Rebase with dest == branch(.) => same as no arguments (from 3 onto 8): |
|
192 | Rebase with dest == branch(.) => same as no arguments (from 3 onto 8): | |
193 |
|
193 | |||
194 | $ hg clone -q -u 3 a a3 |
|
194 | $ hg clone -q -u 3 a a3 | |
195 | $ cd a3 |
|
195 | $ cd a3 | |
196 |
|
196 | |||
197 | $ hg rebase --dest 'branch(.)' |
|
197 | $ hg rebase --dest 'branch(.)' | |
198 | rebasing 1:42ccdea3bb16 "B" |
|
198 | rebasing 1:42ccdea3bb16 "B" | |
199 | rebasing 2:5fddd98957c8 "C" |
|
199 | rebasing 2:5fddd98957c8 "C" | |
200 | rebasing 3:32af7686d403 "D" |
|
200 | rebasing 3:32af7686d403 "D" | |
201 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
201 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
202 |
|
202 | |||
203 | $ hg tglog |
|
203 | $ hg tglog | |
204 | @ 8: ed65089c18f8 'D' |
|
204 | @ 8: ed65089c18f8 'D' | |
205 | | |
|
205 | | | |
206 | o 7: 7621bf1a2f17 'C' |
|
206 | o 7: 7621bf1a2f17 'C' | |
207 | | |
|
207 | | | |
208 | o 6: 9430a62369c6 'B' |
|
208 | o 6: 9430a62369c6 'B' | |
209 | | |
|
209 | | | |
210 | o 5: e7ec4e813ba6 'I' |
|
210 | o 5: e7ec4e813ba6 'I' | |
211 | | |
|
211 | | | |
212 | o 4: 02de42196ebe 'H' |
|
212 | o 4: 02de42196ebe 'H' | |
213 | | |
|
213 | | | |
214 | | o 3: eea13746799a 'G' |
|
214 | | o 3: eea13746799a 'G' | |
215 | |/| |
|
215 | |/| | |
216 | o | 2: 24b6387c8c8c 'F' |
|
216 | o | 2: 24b6387c8c8c 'F' | |
217 | | | |
|
217 | | | | |
218 | | o 1: 9520eea781bc 'E' |
|
218 | | o 1: 9520eea781bc 'E' | |
219 | |/ |
|
219 | |/ | |
220 | o 0: cd010b8cd998 'A' |
|
220 | o 0: cd010b8cd998 'A' | |
221 |
|
221 | |||
222 | $ cd .. |
|
222 | $ cd .. | |
223 |
|
223 | |||
224 |
|
224 | |||
225 | Specify only source (from 2 onto 8): |
|
225 | Specify only source (from 2 onto 8): | |
226 |
|
226 | |||
227 | $ hg clone -q -u . a2heads a4 |
|
227 | $ hg clone -q -u . a2heads a4 | |
228 | $ cd a4 |
|
228 | $ cd a4 | |
229 |
|
229 | |||
230 | $ hg rebase --source 'desc("C")' |
|
230 | $ hg rebase --source 'desc("C")' | |
231 | rebasing 2:5fddd98957c8 "C" |
|
231 | rebasing 2:5fddd98957c8 "C" | |
232 | rebasing 3:32af7686d403 "D" |
|
232 | rebasing 3:32af7686d403 "D" | |
233 | saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg |
|
233 | saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg | |
234 |
|
234 | |||
235 | $ hg tglog |
|
235 | $ hg tglog | |
236 | o 6: 7726e9fd58f7 'D' |
|
236 | o 6: 7726e9fd58f7 'D' | |
237 | | |
|
237 | | | |
238 | o 5: 72c8333623d0 'C' |
|
238 | o 5: 72c8333623d0 'C' | |
239 | | |
|
239 | | | |
240 | @ 4: e7ec4e813ba6 'I' |
|
240 | @ 4: e7ec4e813ba6 'I' | |
241 | | |
|
241 | | | |
242 | o 3: 02de42196ebe 'H' |
|
242 | o 3: 02de42196ebe 'H' | |
243 | | |
|
243 | | | |
244 | o 2: 24b6387c8c8c 'F' |
|
244 | o 2: 24b6387c8c8c 'F' | |
245 | | |
|
245 | | | |
246 | | o 1: 42ccdea3bb16 'B' |
|
246 | | o 1: 42ccdea3bb16 'B' | |
247 | |/ |
|
247 | |/ | |
248 | o 0: cd010b8cd998 'A' |
|
248 | o 0: cd010b8cd998 'A' | |
249 |
|
249 | |||
250 | $ cd .. |
|
250 | $ cd .. | |
251 |
|
251 | |||
252 |
|
252 | |||
253 | Specify only dest (from 3 onto 6): |
|
253 | Specify only dest (from 3 onto 6): | |
254 |
|
254 | |||
255 | $ hg clone -q -u 3 a a5 |
|
255 | $ hg clone -q -u 3 a a5 | |
256 | $ cd a5 |
|
256 | $ cd a5 | |
257 |
|
257 | |||
258 | $ hg rebase --dest 6 |
|
258 | $ hg rebase --dest 6 | |
259 | rebasing 1:42ccdea3bb16 "B" |
|
259 | rebasing 1:42ccdea3bb16 "B" | |
260 | rebasing 2:5fddd98957c8 "C" |
|
260 | rebasing 2:5fddd98957c8 "C" | |
261 | rebasing 3:32af7686d403 "D" |
|
261 | rebasing 3:32af7686d403 "D" | |
262 | saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
262 | saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
263 |
|
263 | |||
264 | $ hg tglog |
|
264 | $ hg tglog | |
265 | @ 8: 8eeb3c33ad33 'D' |
|
265 | @ 8: 8eeb3c33ad33 'D' | |
266 | | |
|
266 | | | |
267 | o 7: 2327fea05063 'C' |
|
267 | o 7: 2327fea05063 'C' | |
268 | | |
|
268 | | | |
269 | o 6: e4e5be0395b2 'B' |
|
269 | o 6: e4e5be0395b2 'B' | |
270 | | |
|
270 | | | |
271 | | o 5: e7ec4e813ba6 'I' |
|
271 | | o 5: e7ec4e813ba6 'I' | |
272 | | | |
|
272 | | | | |
273 | | o 4: 02de42196ebe 'H' |
|
273 | | o 4: 02de42196ebe 'H' | |
274 | | | |
|
274 | | | | |
275 | o | 3: eea13746799a 'G' |
|
275 | o | 3: eea13746799a 'G' | |
276 | |\| |
|
276 | |\| | |
277 | | o 2: 24b6387c8c8c 'F' |
|
277 | | o 2: 24b6387c8c8c 'F' | |
278 | | | |
|
278 | | | | |
279 | o | 1: 9520eea781bc 'E' |
|
279 | o | 1: 9520eea781bc 'E' | |
280 | |/ |
|
280 | |/ | |
281 | o 0: cd010b8cd998 'A' |
|
281 | o 0: cd010b8cd998 'A' | |
282 |
|
282 | |||
283 | $ cd .. |
|
283 | $ cd .. | |
284 |
|
284 | |||
285 |
|
285 | |||
286 | Specify only base (from 1 onto 8): |
|
286 | Specify only base (from 1 onto 8): | |
287 |
|
287 | |||
288 | $ hg clone -q -u . a2heads a6 |
|
288 | $ hg clone -q -u . a2heads a6 | |
289 | $ cd a6 |
|
289 | $ cd a6 | |
290 |
|
290 | |||
291 | $ hg rebase --base 'desc("D")' |
|
291 | $ hg rebase --base 'desc("D")' | |
292 | rebasing 1:42ccdea3bb16 "B" |
|
292 | rebasing 1:42ccdea3bb16 "B" | |
293 | rebasing 2:5fddd98957c8 "C" |
|
293 | rebasing 2:5fddd98957c8 "C" | |
294 | rebasing 3:32af7686d403 "D" |
|
294 | rebasing 3:32af7686d403 "D" | |
295 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
295 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
296 |
|
296 | |||
297 | $ hg tglog |
|
297 | $ hg tglog | |
298 | o 6: ed65089c18f8 'D' |
|
298 | o 6: ed65089c18f8 'D' | |
299 | | |
|
299 | | | |
300 | o 5: 7621bf1a2f17 'C' |
|
300 | o 5: 7621bf1a2f17 'C' | |
301 | | |
|
301 | | | |
302 | o 4: 9430a62369c6 'B' |
|
302 | o 4: 9430a62369c6 'B' | |
303 | | |
|
303 | | | |
304 | @ 3: e7ec4e813ba6 'I' |
|
304 | @ 3: e7ec4e813ba6 'I' | |
305 | | |
|
305 | | | |
306 | o 2: 02de42196ebe 'H' |
|
306 | o 2: 02de42196ebe 'H' | |
307 | | |
|
307 | | | |
308 | o 1: 24b6387c8c8c 'F' |
|
308 | o 1: 24b6387c8c8c 'F' | |
309 | | |
|
309 | | | |
310 | o 0: cd010b8cd998 'A' |
|
310 | o 0: cd010b8cd998 'A' | |
311 |
|
311 | |||
312 | $ cd .. |
|
312 | $ cd .. | |
313 |
|
313 | |||
314 |
|
314 | |||
315 | Specify source and dest (from 2 onto 7): |
|
315 | Specify source and dest (from 2 onto 7): | |
316 |
|
316 | |||
317 | $ hg clone -q -u . a a7 |
|
317 | $ hg clone -q -u . a a7 | |
318 | $ cd a7 |
|
318 | $ cd a7 | |
319 |
|
319 | |||
320 | $ hg rebase --source 2 --dest 7 |
|
320 | $ hg rebase --source 2 --dest 7 | |
321 | rebasing 2:5fddd98957c8 "C" |
|
321 | rebasing 2:5fddd98957c8 "C" | |
322 | rebasing 3:32af7686d403 "D" |
|
322 | rebasing 3:32af7686d403 "D" | |
323 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg |
|
323 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg | |
324 |
|
324 | |||
325 | $ hg tglog |
|
325 | $ hg tglog | |
326 | o 8: 668acadedd30 'D' |
|
326 | o 8: 668acadedd30 'D' | |
327 | | |
|
327 | | | |
328 | o 7: 09eb682ba906 'C' |
|
328 | o 7: 09eb682ba906 'C' | |
329 | | |
|
329 | | | |
330 | | @ 6: e7ec4e813ba6 'I' |
|
330 | | @ 6: e7ec4e813ba6 'I' | |
331 | |/ |
|
331 | |/ | |
332 | o 5: 02de42196ebe 'H' |
|
332 | o 5: 02de42196ebe 'H' | |
333 | | |
|
333 | | | |
334 | | o 4: eea13746799a 'G' |
|
334 | | o 4: eea13746799a 'G' | |
335 | |/| |
|
335 | |/| | |
336 | o | 3: 24b6387c8c8c 'F' |
|
336 | o | 3: 24b6387c8c8c 'F' | |
337 | | | |
|
337 | | | | |
338 | | o 2: 9520eea781bc 'E' |
|
338 | | o 2: 9520eea781bc 'E' | |
339 | |/ |
|
339 | |/ | |
340 | | o 1: 42ccdea3bb16 'B' |
|
340 | | o 1: 42ccdea3bb16 'B' | |
341 | |/ |
|
341 | |/ | |
342 | o 0: cd010b8cd998 'A' |
|
342 | o 0: cd010b8cd998 'A' | |
343 |
|
343 | |||
344 | $ cd .. |
|
344 | $ cd .. | |
345 |
|
345 | |||
346 |
|
346 | |||
347 | Specify base and dest (from 1 onto 7): |
|
347 | Specify base and dest (from 1 onto 7): | |
348 |
|
348 | |||
349 | $ hg clone -q -u . a a8 |
|
349 | $ hg clone -q -u . a a8 | |
350 | $ cd a8 |
|
350 | $ cd a8 | |
351 |
|
351 | |||
352 | $ hg rebase --base 3 --dest 7 |
|
352 | $ hg rebase --base 3 --dest 7 | |
353 | rebasing 1:42ccdea3bb16 "B" |
|
353 | rebasing 1:42ccdea3bb16 "B" | |
354 | rebasing 2:5fddd98957c8 "C" |
|
354 | rebasing 2:5fddd98957c8 "C" | |
355 | rebasing 3:32af7686d403 "D" |
|
355 | rebasing 3:32af7686d403 "D" | |
356 | saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg |
|
356 | saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg | |
357 |
|
357 | |||
358 | $ hg tglog |
|
358 | $ hg tglog | |
359 | o 8: 287cc92ba5a4 'D' |
|
359 | o 8: 287cc92ba5a4 'D' | |
360 | | |
|
360 | | | |
361 | o 7: 6824f610a250 'C' |
|
361 | o 7: 6824f610a250 'C' | |
362 | | |
|
362 | | | |
363 | o 6: 7c6027df6a99 'B' |
|
363 | o 6: 7c6027df6a99 'B' | |
364 | | |
|
364 | | | |
365 | | @ 5: e7ec4e813ba6 'I' |
|
365 | | @ 5: e7ec4e813ba6 'I' | |
366 | |/ |
|
366 | |/ | |
367 | o 4: 02de42196ebe 'H' |
|
367 | o 4: 02de42196ebe 'H' | |
368 | | |
|
368 | | | |
369 | | o 3: eea13746799a 'G' |
|
369 | | o 3: eea13746799a 'G' | |
370 | |/| |
|
370 | |/| | |
371 | o | 2: 24b6387c8c8c 'F' |
|
371 | o | 2: 24b6387c8c8c 'F' | |
372 | | | |
|
372 | | | | |
373 | | o 1: 9520eea781bc 'E' |
|
373 | | o 1: 9520eea781bc 'E' | |
374 | |/ |
|
374 | |/ | |
375 | o 0: cd010b8cd998 'A' |
|
375 | o 0: cd010b8cd998 'A' | |
376 |
|
376 | |||
377 | $ cd .. |
|
377 | $ cd .. | |
378 |
|
378 | |||
379 |
|
379 | |||
380 | Specify only revs (from 2 onto 8) |
|
380 | Specify only revs (from 2 onto 8) | |
381 |
|
381 | |||
382 | $ hg clone -q -u . a2heads a9 |
|
382 | $ hg clone -q -u . a2heads a9 | |
383 | $ cd a9 |
|
383 | $ cd a9 | |
384 |
|
384 | |||
385 | $ hg rebase --rev 'desc("C")::' |
|
385 | $ hg rebase --rev 'desc("C")::' | |
386 | rebasing 2:5fddd98957c8 "C" |
|
386 | rebasing 2:5fddd98957c8 "C" | |
387 | rebasing 3:32af7686d403 "D" |
|
387 | rebasing 3:32af7686d403 "D" | |
388 | saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg |
|
388 | saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg | |
389 |
|
389 | |||
390 | $ hg tglog |
|
390 | $ hg tglog | |
391 | o 6: 7726e9fd58f7 'D' |
|
391 | o 6: 7726e9fd58f7 'D' | |
392 | | |
|
392 | | | |
393 | o 5: 72c8333623d0 'C' |
|
393 | o 5: 72c8333623d0 'C' | |
394 | | |
|
394 | | | |
395 | @ 4: e7ec4e813ba6 'I' |
|
395 | @ 4: e7ec4e813ba6 'I' | |
396 | | |
|
396 | | | |
397 | o 3: 02de42196ebe 'H' |
|
397 | o 3: 02de42196ebe 'H' | |
398 | | |
|
398 | | | |
399 | o 2: 24b6387c8c8c 'F' |
|
399 | o 2: 24b6387c8c8c 'F' | |
400 | | |
|
400 | | | |
401 | | o 1: 42ccdea3bb16 'B' |
|
401 | | o 1: 42ccdea3bb16 'B' | |
402 | |/ |
|
402 | |/ | |
403 | o 0: cd010b8cd998 'A' |
|
403 | o 0: cd010b8cd998 'A' | |
404 |
|
404 | |||
405 | $ cd .. |
|
405 | $ cd .. | |
406 |
|
406 | |||
407 | Rebasing both a single revision and a merge in one command |
|
407 | Rebasing both a single revision and a merge in one command | |
408 |
|
408 | |||
409 | $ hg clone -q -u . a aX |
|
409 | $ hg clone -q -u . a aX | |
410 | $ cd aX |
|
410 | $ cd aX | |
411 | $ hg rebase -r 3 -r 6 --dest 8 |
|
411 | $ hg rebase -r 3 -r 6 --dest 8 | |
412 | rebasing 3:32af7686d403 "D" |
|
412 | rebasing 3:32af7686d403 "D" | |
413 | rebasing 6:eea13746799a "G" |
|
413 | rebasing 6:eea13746799a "G" | |
414 | saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg |
|
414 | saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg | |
415 | $ cd .. |
|
415 | $ cd .. | |
416 |
|
416 | |||
417 | Test --tool parameter: |
|
417 | Test --tool parameter: | |
418 |
|
418 | |||
419 | $ hg init b |
|
419 | $ hg init b | |
420 | $ cd b |
|
420 | $ cd b | |
421 |
|
421 | |||
422 | $ echo c1 > c1 |
|
422 | $ echo c1 > c1 | |
423 | $ hg ci -Am c1 |
|
423 | $ hg ci -Am c1 | |
424 | adding c1 |
|
424 | adding c1 | |
425 |
|
425 | |||
426 | $ echo c2 > c2 |
|
426 | $ echo c2 > c2 | |
427 | $ hg ci -Am c2 |
|
427 | $ hg ci -Am c2 | |
428 | adding c2 |
|
428 | adding c2 | |
429 |
|
429 | |||
430 | $ hg up -q 0 |
|
430 | $ hg up -q 0 | |
431 | $ echo c2b > c2 |
|
431 | $ echo c2b > c2 | |
432 | $ hg ci -Am c2b |
|
432 | $ hg ci -Am c2b | |
433 | adding c2 |
|
433 | adding c2 | |
434 | created new head |
|
434 | created new head | |
435 |
|
435 | |||
436 | $ cd .. |
|
436 | $ cd .. | |
437 |
|
437 | |||
438 | $ hg clone -q -u . b b1 |
|
438 | $ hg clone -q -u . b b1 | |
439 | $ cd b1 |
|
439 | $ cd b1 | |
440 |
|
440 | |||
441 | $ hg rebase -s 2 -d 1 --tool internal:local |
|
441 | $ hg rebase -s 2 -d 1 --tool internal:local | |
442 | rebasing 2:e4e3f3546619 "c2b" (tip) |
|
442 | rebasing 2:e4e3f3546619 "c2b" (tip) | |
443 | note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes |
|
443 | note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes | |
444 | saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg |
|
444 | saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg | |
445 |
|
445 | |||
446 | $ hg cat c2 |
|
446 | $ hg cat c2 | |
447 | c2 |
|
447 | c2 | |
448 |
|
448 | |||
449 | $ cd .. |
|
449 | $ cd .. | |
450 |
|
450 | |||
451 |
|
451 | |||
452 | $ hg clone -q -u . b b2 |
|
452 | $ hg clone -q -u . b b2 | |
453 | $ cd b2 |
|
453 | $ cd b2 | |
454 |
|
454 | |||
455 | $ hg rebase -s 2 -d 1 --tool internal:other |
|
455 | $ hg rebase -s 2 -d 1 --tool internal:other | |
456 | rebasing 2:e4e3f3546619 "c2b" (tip) |
|
456 | rebasing 2:e4e3f3546619 "c2b" (tip) | |
457 | saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg |
|
457 | saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg | |
458 |
|
458 | |||
459 | $ hg cat c2 |
|
459 | $ hg cat c2 | |
460 | c2b |
|
460 | c2b | |
461 |
|
461 | |||
462 | $ cd .. |
|
462 | $ cd .. | |
463 |
|
463 | |||
464 |
|
464 | |||
465 | $ hg clone -q -u . b b3 |
|
465 | $ hg clone -q -u . b b3 | |
466 | $ cd b3 |
|
466 | $ cd b3 | |
467 |
|
467 | |||
468 | $ hg rebase -s 2 -d 1 --tool internal:fail |
|
468 | $ hg rebase -s 2 -d 1 --tool internal:fail | |
469 | rebasing 2:e4e3f3546619 "c2b" (tip) |
|
469 | rebasing 2:e4e3f3546619 "c2b" (tip) | |
470 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
470 | unresolved conflicts (see hg resolve, then hg rebase --continue) | |
471 | [1] |
|
471 | [1] | |
472 |
|
472 | |||
473 | $ hg summary |
|
473 | $ hg summary | |
474 | parent: 1:56daeba07f4b |
|
474 | parent: 1:56daeba07f4b | |
475 | c2 |
|
475 | c2 | |
476 | parent: 2:e4e3f3546619 tip |
|
476 | parent: 2:e4e3f3546619 tip | |
477 | c2b |
|
477 | c2b | |
478 | branch: default |
|
478 | branch: default | |
479 | commit: 1 modified, 1 unresolved (merge) |
|
479 | commit: 1 modified, 1 unresolved (merge) | |
480 | update: (current) |
|
480 | update: (current) | |
481 | phases: 3 draft |
|
481 | phases: 3 draft | |
482 | rebase: 0 rebased, 1 remaining (rebase --continue) |
|
482 | rebase: 0 rebased, 1 remaining (rebase --continue) | |
483 |
|
483 | |||
484 | $ hg resolve -l |
|
484 | $ hg resolve -l | |
485 | U c2 |
|
485 | U c2 | |
486 |
|
486 | |||
487 | $ hg resolve -m c2 |
|
487 | $ hg resolve -m c2 | |
488 | (no more unresolved files) |
|
488 | (no more unresolved files) | |
489 | continue: hg rebase --continue |
|
489 | continue: hg rebase --continue | |
490 | $ hg graft --continue |
|
490 | $ hg graft --continue | |
491 | abort: no graft in progress |
|
491 | abort: no graft in progress | |
492 | (continue: hg rebase --continue) |
|
492 | (continue: hg rebase --continue) | |
493 | [255] |
|
493 | [255] | |
494 | $ hg rebase -c --tool internal:fail |
|
494 | $ hg rebase -c --tool internal:fail | |
495 | rebasing 2:e4e3f3546619 "c2b" (tip) |
|
495 | rebasing 2:e4e3f3546619 "c2b" (tip) | |
496 | note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes |
|
496 | note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes | |
497 | saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg |
|
497 | saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg | |
498 |
|
498 | |||
499 | $ hg rebase -i |
|
499 | $ hg rebase -i | |
500 | abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit") |
|
500 | abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit") | |
501 | [255] |
|
501 | [255] | |
502 |
|
502 | |||
503 | $ hg rebase --interactive |
|
503 | $ hg rebase --interactive | |
504 | abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit") |
|
504 | abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit") | |
505 | [255] |
|
505 | [255] | |
506 |
|
506 | |||
507 | $ cd .. |
|
507 | $ cd .. | |
508 |
|
508 | |||
509 | No common ancestor |
|
509 | No common ancestor | |
510 |
|
510 | |||
511 | $ hg init separaterepo |
|
511 | $ hg init separaterepo | |
512 | $ cd separaterepo |
|
512 | $ cd separaterepo | |
513 | $ touch a |
|
513 | $ touch a | |
514 | $ hg commit -Aqm a |
|
514 | $ hg commit -Aqm a | |
515 | $ hg up -q null |
|
515 | $ hg up -q null | |
516 | $ touch b |
|
516 | $ touch b | |
517 | $ hg commit -Aqm b |
|
517 | $ hg commit -Aqm b | |
518 | $ hg rebase -d 0 |
|
518 | $ hg rebase -d 0 | |
519 | nothing to rebase from d7486e00c6f1 to 3903775176ed |
|
519 | nothing to rebase from d7486e00c6f1 to 3903775176ed | |
520 | [1] |
|
520 | [1] | |
521 | $ cd .. |
|
521 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now