##// END OF EJS Templates
rev-branch-cache: schedule a write of the "v2" format if we read from "v1"...
marmoute -
r52801:16efed18 default
parent child Browse files
Show More
@@ -1,416 +1,426
1 # rev_cache.py - caching branch information per revision
1 # rev_cache.py - caching branch information per revision
2 #
2 #
3 # This software may be used and distributed according to the terms of the
3 # This software may be used and distributed according to the terms of the
4 # GNU General Public License version 2 or any later version.
4 # GNU General Public License version 2 or any later version.
5 from __future__ import annotations
5 from __future__ import annotations
6
6
7 import os
7 import os
8 import struct
8 import struct
9
9
10 from ..node import (
10 from ..node import (
11 nullrev,
11 nullrev,
12 )
12 )
13
13
14 from .. import (
14 from .. import (
15 encoding,
15 encoding,
16 error,
16 error,
17 util,
17 util,
18 )
18 )
19
19
20 from ..utils import (
20 from ..utils import (
21 stringutil,
21 stringutil,
22 )
22 )
23
23
24 calcsize = struct.calcsize
24 calcsize = struct.calcsize
25 pack_into = struct.pack_into
25 pack_into = struct.pack_into
26 unpack_from = struct.unpack_from
26 unpack_from = struct.unpack_from
27
27
28
28
29 # Revision branch info cache
29 # Revision branch info cache
30
30
31 # The "V2" version use the same format as the "V1" but garantee it won't be
31 # The "V2" version use the same format as the "V1" but garantee it won't be
32 # truncated, preventing SIGBUS when it is mmap-ed
32 # truncated, preventing SIGBUS when it is mmap-ed
33 _rbcversion = b'-v2'
33 _rbcversion = b'-v2'
34 _rbcnames = b'rbc-names' + _rbcversion
34 _rbcnames = b'rbc-names' + _rbcversion
35 _rbcrevs = b'rbc-revs' + _rbcversion
35 _rbcrevs = b'rbc-revs' + _rbcversion
36 _rbc_legacy_version = b'-v1'
36 _rbc_legacy_version = b'-v1'
37 _rbc_legacy_names = b'rbc-names' + _rbc_legacy_version
37 _rbc_legacy_names = b'rbc-names' + _rbc_legacy_version
38 _rbc_legacy_revs = b'rbc-revs' + _rbc_legacy_version
38 _rbc_legacy_revs = b'rbc-revs' + _rbc_legacy_version
39 # [4 byte hash prefix][4 byte branch name number with sign bit indicating open]
39 # [4 byte hash prefix][4 byte branch name number with sign bit indicating open]
40 _rbcrecfmt = b'>4sI'
40 _rbcrecfmt = b'>4sI'
41 _rbcrecsize = calcsize(_rbcrecfmt)
41 _rbcrecsize = calcsize(_rbcrecfmt)
42 _rbcmininc = 64 * _rbcrecsize
42 _rbcmininc = 64 * _rbcrecsize
43 _rbcnodelen = 4
43 _rbcnodelen = 4
44 _rbcbranchidxmask = 0x7FFFFFFF
44 _rbcbranchidxmask = 0x7FFFFFFF
45 _rbccloseflag = 0x80000000
45 _rbccloseflag = 0x80000000
46
46
47
47
48 # with atomic replacement.
48 # with atomic replacement.
49 REWRITE_RATIO = 0.2
49 REWRITE_RATIO = 0.2
50
50
51
51
52 class rbcrevs:
52 class rbcrevs:
53 """a byte string consisting of an immutable prefix followed by a mutable suffix"""
53 """a byte string consisting of an immutable prefix followed by a mutable suffix"""
54
54
55 def __init__(self, revs):
55 def __init__(self, revs):
56 self._prefix = revs
56 self._prefix = revs
57 self._rest = bytearray()
57 self._rest = bytearray()
58
58
59 def __len__(self):
59 def __len__(self):
60 return len(self._prefix) + len(self._rest)
60 return len(self._prefix) + len(self._rest)
61
61
62 def unpack_record(self, rbcrevidx):
62 def unpack_record(self, rbcrevidx):
63 if rbcrevidx < len(self._prefix):
63 if rbcrevidx < len(self._prefix):
64 return unpack_from(_rbcrecfmt, util.buffer(self._prefix), rbcrevidx)
64 return unpack_from(_rbcrecfmt, util.buffer(self._prefix), rbcrevidx)
65 else:
65 else:
66 return unpack_from(
66 return unpack_from(
67 _rbcrecfmt,
67 _rbcrecfmt,
68 util.buffer(self._rest),
68 util.buffer(self._rest),
69 rbcrevidx - len(self._prefix),
69 rbcrevidx - len(self._prefix),
70 )
70 )
71
71
72 def make_mutable(self):
72 def make_mutable(self):
73 if len(self._prefix) > 0:
73 if len(self._prefix) > 0:
74 entirety = bytearray()
74 entirety = bytearray()
75 entirety[:] = self._prefix
75 entirety[:] = self._prefix
76 entirety.extend(self._rest)
76 entirety.extend(self._rest)
77 self._rest = entirety
77 self._rest = entirety
78 self._prefix = bytearray()
78 self._prefix = bytearray()
79
79
80 def truncate(self, pos):
80 def truncate(self, pos):
81 self.make_mutable()
81 self.make_mutable()
82 del self._rest[pos:]
82 del self._rest[pos:]
83
83
84 def pack_into(self, rbcrevidx, node, branchidx):
84 def pack_into(self, rbcrevidx, node, branchidx):
85 if rbcrevidx < len(self._prefix):
85 if rbcrevidx < len(self._prefix):
86 self.make_mutable()
86 self.make_mutable()
87 buf = self._rest
87 buf = self._rest
88 start_offset = rbcrevidx - len(self._prefix)
88 start_offset = rbcrevidx - len(self._prefix)
89 end_offset = start_offset + _rbcrecsize
89 end_offset = start_offset + _rbcrecsize
90
90
91 if len(self._rest) < end_offset:
91 if len(self._rest) < end_offset:
92 # bytearray doesn't allocate extra space at least in Python 3.7.
92 # bytearray doesn't allocate extra space at least in Python 3.7.
93 # When multiple changesets are added in a row, precise resize would
93 # When multiple changesets are added in a row, precise resize would
94 # result in quadratic complexity. Overallocate to compensate by
94 # result in quadratic complexity. Overallocate to compensate by
95 # using the classic doubling technique for dynamic arrays instead.
95 # using the classic doubling technique for dynamic arrays instead.
96 # If there was a gap in the map before, less space will be reserved.
96 # If there was a gap in the map before, less space will be reserved.
97 self._rest.extend(b'\0' * end_offset)
97 self._rest.extend(b'\0' * end_offset)
98 return pack_into(
98 return pack_into(
99 _rbcrecfmt,
99 _rbcrecfmt,
100 buf,
100 buf,
101 start_offset,
101 start_offset,
102 node,
102 node,
103 branchidx,
103 branchidx,
104 )
104 )
105
105
106 def extend(self, extension):
106 def extend(self, extension):
107 return self._rest.extend(extension)
107 return self._rest.extend(extension)
108
108
109 def slice(self, begin, end):
109 def slice(self, begin, end):
110 if begin < len(self._prefix):
110 if begin < len(self._prefix):
111 acc = bytearray()
111 acc = bytearray()
112 acc[:] = self._prefix[begin:end]
112 acc[:] = self._prefix[begin:end]
113 acc.extend(
113 acc.extend(
114 self._rest[begin - len(self._prefix) : end - len(self._prefix)]
114 self._rest[begin - len(self._prefix) : end - len(self._prefix)]
115 )
115 )
116 return acc
116 return acc
117 return self._rest[begin - len(self._prefix) : end - len(self._prefix)]
117 return self._rest[begin - len(self._prefix) : end - len(self._prefix)]
118
118
119
119
120 class revbranchcache:
120 class revbranchcache:
121 """Persistent cache, mapping from revision number to branch name and close.
121 """Persistent cache, mapping from revision number to branch name and close.
122 This is a low level cache, independent of filtering.
122 This is a low level cache, independent of filtering.
123
123
124 Branch names are stored in rbc-names in internal encoding separated by 0.
124 Branch names are stored in rbc-names in internal encoding separated by 0.
125 rbc-names is append-only, and each branch name is only stored once and will
125 rbc-names is append-only, and each branch name is only stored once and will
126 thus have a unique index.
126 thus have a unique index.
127
127
128 The branch info for each revision is stored in rbc-revs as constant size
128 The branch info for each revision is stored in rbc-revs as constant size
129 records. The whole file is read into memory, but it is only 'parsed' on
129 records. The whole file is read into memory, but it is only 'parsed' on
130 demand. The file is usually append-only but will be truncated if repo
130 demand. The file is usually append-only but will be truncated if repo
131 modification is detected.
131 modification is detected.
132 The record for each revision contains the first 4 bytes of the
132 The record for each revision contains the first 4 bytes of the
133 corresponding node hash, and the record is only used if it still matches.
133 corresponding node hash, and the record is only used if it still matches.
134 Even a completely trashed rbc-revs fill thus still give the right result
134 Even a completely trashed rbc-revs fill thus still give the right result
135 while converging towards full recovery ... assuming no incorrectly matching
135 while converging towards full recovery ... assuming no incorrectly matching
136 node hashes.
136 node hashes.
137 The record also contains 4 bytes where 31 bits contains the index of the
137 The record also contains 4 bytes where 31 bits contains the index of the
138 branch and the last bit indicate that it is a branch close commit.
138 branch and the last bit indicate that it is a branch close commit.
139 The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i
139 The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i
140 and will grow with it but be 1/8th of its size.
140 and will grow with it but be 1/8th of its size.
141 """
141 """
142
142
143 def __init__(self, repo, readonly=True):
143 def __init__(self, repo, readonly=True):
144 assert repo.filtername is None
144 assert repo.filtername is None
145 self._repo = repo
145 self._repo = repo
146 self._names = [] # branch names in local encoding with static index
146 self._names = [] # branch names in local encoding with static index
147 self._rbcrevs = rbcrevs(bytearray())
147 self._rbcrevs = rbcrevs(bytearray())
148 self._rbcsnameslen = 0 # length of names read at _rbcsnameslen
148 self._rbcsnameslen = 0 # length of names read at _rbcsnameslen
149 self._force_overwrite = False
149 v1_fallback = False
150 v1_fallback = False
150 try:
151 try:
151 try:
152 try:
152 bndata = repo.cachevfs.read(_rbcnames)
153 bndata = repo.cachevfs.read(_rbcnames)
153 except (IOError, OSError):
154 except (IOError, OSError):
154 # If we don't have "v2" data, we might have "v1" data worth
155 # If we don't have "v2" data, we might have "v1" data worth
155 # using.
156 # using.
156 #
157 #
157 # consider stop doing this many version after hg-6.9 release
158 # consider stop doing this many version after hg-6.9 release
158 bndata = repo.cachevfs.read(_rbc_legacy_names)
159 bndata = repo.cachevfs.read(_rbc_legacy_names)
159 v1_fallback = True
160 v1_fallback = True
161 self._force_overwrite = True
160 self._rbcsnameslen = len(bndata) # for verification before writing
162 self._rbcsnameslen = len(bndata) # for verification before writing
161 if bndata:
163 if bndata:
162 self._names = [
164 self._names = [
163 encoding.tolocal(bn) for bn in bndata.split(b'\0')
165 encoding.tolocal(bn) for bn in bndata.split(b'\0')
164 ]
166 ]
165 except (IOError, OSError):
167 except (IOError, OSError):
166 if readonly:
168 if readonly:
167 # don't try to use cache - fall back to the slow path
169 # don't try to use cache - fall back to the slow path
168 self.branchinfo = self._branchinfo
170 self.branchinfo = self._branchinfo
169
171
170 if self._names:
172 if self._names:
171 try:
173 try:
172 usemmap = repo.ui.configbool(b'storage', b'revbranchcache.mmap')
174 usemmap = repo.ui.configbool(b'storage', b'revbranchcache.mmap')
173 if not v1_fallback:
175 if not v1_fallback:
174 with repo.cachevfs(_rbcrevs) as fp:
176 with repo.cachevfs(_rbcrevs) as fp:
175 if usemmap and repo.cachevfs.is_mmap_safe(_rbcrevs):
177 if usemmap and repo.cachevfs.is_mmap_safe(_rbcrevs):
176 data = util.buffer(util.mmapread(fp))
178 data = util.buffer(util.mmapread(fp))
177 else:
179 else:
178 data = fp.read()
180 data = fp.read()
179 else:
181 else:
180 # If we don't have "v2" data, we might have "v1" data worth
182 # If we don't have "v2" data, we might have "v1" data worth
181 # using.
183 # using.
182 #
184 #
183 # Consider stop doing this many version after hg-6.9
185 # Consider stop doing this many version after hg-6.9
184 # release.
186 # release.
185 with repo.cachevfs(_rbc_legacy_revs) as fp:
187 with repo.cachevfs(_rbc_legacy_revs) as fp:
186 data = fp.read()
188 data = fp.read()
187 self._rbcrevs = rbcrevs(data)
189 self._rbcrevs = rbcrevs(data)
188 except (IOError, OSError) as inst:
190 except (IOError, OSError) as inst:
189 repo.ui.debug(
191 repo.ui.debug(
190 b"couldn't read revision branch cache: %s\n"
192 b"couldn't read revision branch cache: %s\n"
191 % stringutil.forcebytestr(inst)
193 % stringutil.forcebytestr(inst)
192 )
194 )
193 # remember number of good records on disk
195 # remember number of good records on disk
194 self._rbcrevslen = min(
196 self._rbcrevslen = min(
195 len(self._rbcrevs) // _rbcrecsize, len(repo.changelog)
197 len(self._rbcrevs) // _rbcrecsize, len(repo.changelog)
196 )
198 )
197 if self._rbcrevslen == 0:
199 if self._rbcrevslen == 0:
198 self._names = []
200 self._names = []
199 self._rbcnamescount = len(self._names) # number of names read at
201 self._rbcnamescount = len(self._names) # number of names read at
200 # _rbcsnameslen
202 # _rbcsnameslen
201 self._force_overwrite = False
202
203
203 def _clear(self):
204 def _clear(self):
204 self._rbcsnameslen = 0
205 self._rbcsnameslen = 0
205 del self._names[:]
206 del self._names[:]
206 self._rbcnamescount = 0
207 self._rbcnamescount = 0
207 self._rbcrevslen = len(self._repo.changelog)
208 self._rbcrevslen = len(self._repo.changelog)
208 self._rbcrevs = rbcrevs(bytearray(self._rbcrevslen * _rbcrecsize))
209 self._rbcrevs = rbcrevs(bytearray(self._rbcrevslen * _rbcrecsize))
209 util.clearcachedproperty(self, b'_namesreverse')
210 util.clearcachedproperty(self, b'_namesreverse')
210 self._force_overwrite = True
211 self._force_overwrite = True
211
212
212 def invalidate(self, rev=0):
213 def invalidate(self, rev=0):
213 self._rbcrevslen = rev
214 self._rbcrevslen = rev
214 self._rbcrevs.truncate(rev)
215 self._rbcrevs.truncate(rev)
215 self._force_overwrite = True
216 self._force_overwrite = True
216
217
217 @util.propertycache
218 @util.propertycache
218 def _namesreverse(self):
219 def _namesreverse(self):
219 return {b: r for r, b in enumerate(self._names)}
220 return {b: r for r, b in enumerate(self._names)}
220
221
221 def branchinfo(self, rev):
222 def branchinfo(self, rev):
222 """Return branch name and close flag for rev, using and updating
223 """Return branch name and close flag for rev, using and updating
223 persistent cache."""
224 persistent cache."""
224 changelog = self._repo.changelog
225 changelog = self._repo.changelog
225 rbcrevidx = rev * _rbcrecsize
226 rbcrevidx = rev * _rbcrecsize
226
227
227 # avoid negative index, changelog.read(nullrev) is fast without cache
228 # avoid negative index, changelog.read(nullrev) is fast without cache
228 if rev == nullrev:
229 if rev == nullrev:
229 return changelog.branchinfo(rev)
230 return changelog.branchinfo(rev)
230
231
231 # if requested rev isn't allocated, grow and cache the rev info
232 # if requested rev isn't allocated, grow and cache the rev info
232 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
233 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
233 return self._branchinfo(rev)
234 return self._branchinfo(rev)
234
235
235 # fast path: extract data from cache, use it if node is matching
236 # fast path: extract data from cache, use it if node is matching
236 reponode = changelog.node(rev)[:_rbcnodelen]
237 reponode = changelog.node(rev)[:_rbcnodelen]
237 cachenode, branchidx = self._rbcrevs.unpack_record(rbcrevidx)
238 cachenode, branchidx = self._rbcrevs.unpack_record(rbcrevidx)
238 close = bool(branchidx & _rbccloseflag)
239 close = bool(branchidx & _rbccloseflag)
239 if close:
240 if close:
240 branchidx &= _rbcbranchidxmask
241 branchidx &= _rbcbranchidxmask
241 if cachenode == b'\0\0\0\0':
242 if cachenode == b'\0\0\0\0':
242 pass
243 pass
243 elif cachenode == reponode:
244 elif cachenode == reponode:
244 try:
245 try:
245 return self._names[branchidx], close
246 return self._names[branchidx], close
246 except IndexError:
247 except IndexError:
247 # recover from invalid reference to unknown branch
248 # recover from invalid reference to unknown branch
248 self._repo.ui.debug(
249 self._repo.ui.debug(
249 b"referenced branch names not found"
250 b"referenced branch names not found"
250 b" - rebuilding revision branch cache from scratch\n"
251 b" - rebuilding revision branch cache from scratch\n"
251 )
252 )
252 self._clear()
253 self._clear()
253 else:
254 else:
254 # rev/node map has changed, invalidate the cache from here up
255 # rev/node map has changed, invalidate the cache from here up
255 self._repo.ui.debug(
256 self._repo.ui.debug(
256 b"history modification detected - truncating "
257 b"history modification detected - truncating "
257 b"revision branch cache to revision %d\n" % rev
258 b"revision branch cache to revision %d\n" % rev
258 )
259 )
259 truncate = rbcrevidx + _rbcrecsize
260 truncate = rbcrevidx + _rbcrecsize
260 self._rbcrevs.truncate(truncate)
261 self._rbcrevs.truncate(truncate)
261 self._rbcrevslen = min(self._rbcrevslen, truncate)
262 self._rbcrevslen = min(self._rbcrevslen, truncate)
262
263
263 # fall back to slow path and make sure it will be written to disk
264 # fall back to slow path and make sure it will be written to disk
264 return self._branchinfo(rev)
265 return self._branchinfo(rev)
265
266
266 def _branchinfo(self, rev):
267 def _branchinfo(self, rev):
267 """Retrieve branch info from changelog and update _rbcrevs"""
268 """Retrieve branch info from changelog and update _rbcrevs"""
268 changelog = self._repo.changelog
269 changelog = self._repo.changelog
269 b, close = changelog.branchinfo(rev)
270 b, close = changelog.branchinfo(rev)
270 if b in self._namesreverse:
271 if b in self._namesreverse:
271 branchidx = self._namesreverse[b]
272 branchidx = self._namesreverse[b]
272 else:
273 else:
273 branchidx = len(self._names)
274 branchidx = len(self._names)
274 self._names.append(b)
275 self._names.append(b)
275 self._namesreverse[b] = branchidx
276 self._namesreverse[b] = branchidx
276 reponode = changelog.node(rev)
277 reponode = changelog.node(rev)
277 if close:
278 if close:
278 branchidx |= _rbccloseflag
279 branchidx |= _rbccloseflag
279 self._setcachedata(rev, reponode, branchidx)
280 self._setcachedata(rev, reponode, branchidx)
280 return b, close
281 return b, close
281
282
282 def setdata(self, rev, changelogrevision):
283 def setdata(self, rev, changelogrevision):
283 """add new data information to the cache"""
284 """add new data information to the cache"""
284 branch, close = changelogrevision.branchinfo
285 branch, close = changelogrevision.branchinfo
285
286
286 if branch in self._namesreverse:
287 if branch in self._namesreverse:
287 branchidx = self._namesreverse[branch]
288 branchidx = self._namesreverse[branch]
288 else:
289 else:
289 branchidx = len(self._names)
290 branchidx = len(self._names)
290 self._names.append(branch)
291 self._names.append(branch)
291 self._namesreverse[branch] = branchidx
292 self._namesreverse[branch] = branchidx
292 if close:
293 if close:
293 branchidx |= _rbccloseflag
294 branchidx |= _rbccloseflag
294 self._setcachedata(rev, self._repo.changelog.node(rev), branchidx)
295 self._setcachedata(rev, self._repo.changelog.node(rev), branchidx)
295 # If no cache data were readable (non exists, bad permission, etc)
296 # If no cache data were readable (non exists, bad permission, etc)
296 # the cache was bypassing itself by setting:
297 # the cache was bypassing itself by setting:
297 #
298 #
298 # self.branchinfo = self._branchinfo
299 # self.branchinfo = self._branchinfo
299 #
300 #
300 # Since we now have data in the cache, we need to drop this bypassing.
301 # Since we now have data in the cache, we need to drop this bypassing.
301 if 'branchinfo' in vars(self):
302 if 'branchinfo' in vars(self):
302 del self.branchinfo
303 del self.branchinfo
303
304
304 def _setcachedata(self, rev, node, branchidx):
305 def _setcachedata(self, rev, node, branchidx):
305 """Writes the node's branch data to the in-memory cache data."""
306 """Writes the node's branch data to the in-memory cache data."""
306 if rev == nullrev:
307 if rev == nullrev:
307 return
308 return
308 rbcrevidx = rev * _rbcrecsize
309 rbcrevidx = rev * _rbcrecsize
309 self._rbcrevs.pack_into(rbcrevidx, node, branchidx)
310 self._rbcrevs.pack_into(rbcrevidx, node, branchidx)
310 self._rbcrevslen = min(self._rbcrevslen, rev)
311 self._rbcrevslen = min(self._rbcrevslen, rev)
311
312
312 tr = self._repo.currenttransaction()
313 tr = self._repo.currenttransaction()
313 if tr:
314 if tr:
314 tr.addfinalize(b'write-revbranchcache', self.write)
315 tr.addfinalize(b'write-revbranchcache', self.write)
315
316
316 def write(self, tr=None):
317 def write(self, tr=None):
317 """Save branch cache if it is dirty."""
318 """Save branch cache if it is dirty."""
318 repo = self._repo
319 repo = self._repo
319 wlock = None
320 wlock = None
320 step = b''
321 step = b''
321 try:
322 try:
322 # write the new names
323 # write the new names
323 if self._rbcnamescount < len(self._names):
324 if self._force_overwrite or self._rbcnamescount < len(self._names):
324 wlock = repo.wlock(wait=False)
325 wlock = repo.wlock(wait=False)
325 step = b' names'
326 step = b' names'
326 self._writenames(repo)
327 self._writenames(repo)
327
328
328 # write the new revs
329 # write the new revs
329 start = self._rbcrevslen * _rbcrecsize
330 start = self._rbcrevslen * _rbcrecsize
330 if self._force_overwrite or start != len(self._rbcrevs):
331 if self._force_overwrite or start != len(self._rbcrevs):
331 step = b''
332 step = b''
332 if wlock is None:
333 if wlock is None:
333 wlock = repo.wlock(wait=False)
334 wlock = repo.wlock(wait=False)
334 self._writerevs(repo, start)
335 self._writerevs(repo, start)
335
336
336 except (IOError, OSError, error.Abort, error.LockError) as inst:
337 except (IOError, OSError, error.Abort, error.LockError) as inst:
337 repo.ui.debug(
338 repo.ui.debug(
338 b"couldn't write revision branch cache%s: %s\n"
339 b"couldn't write revision branch cache%s: %s\n"
339 % (step, stringutil.forcebytestr(inst))
340 % (step, stringutil.forcebytestr(inst))
340 )
341 )
341 finally:
342 finally:
342 if wlock is not None:
343 if wlock is not None:
343 wlock.release()
344 wlock.release()
344
345
345 def _writenames(self, repo):
346 def _writenames(self, repo):
346 """write the new branch names to revbranchcache"""
347 """write the new branch names to revbranchcache"""
347 f = None
348 f = None
349 if self._force_overwrite:
350 self._rbcsnameslen = 0
351 self._rbcnamescount = 0
348 try:
352 try:
349 if self._rbcnamescount != 0:
353 if self._force_overwrite or self._rbcnamescount != 0:
350 f = repo.cachevfs.open(_rbcnames, b'ab')
354 f = repo.cachevfs.open(_rbcnames, b'ab')
351 if f.tell() == self._rbcsnameslen:
355 current_size = f.tell()
356 if current_size == self._rbcsnameslen:
352 f.write(b'\0')
357 f.write(b'\0')
353 else:
358 else:
354 f.close()
359 f.close()
355 f = None
360 if self._force_overwrite:
356 repo.ui.debug(b"%s changed - rewriting it\n" % _rbcnames)
361 dbg = b"resetting content of %s\n"
362 elif current_size > 0:
363 dbg = b"%s changed - rewriting it\n"
364 else:
365 dbg = b"%s is missing - rewriting it\n"
366 repo.ui.debug(dbg % _rbcnames)
357 self._rbcnamescount = 0
367 self._rbcnamescount = 0
358 self._rbcrevslen = 0
368 self._rbcrevslen = 0
359 if self._rbcnamescount == 0:
369 if self._rbcnamescount == 0:
360 # before rewriting names, make sure references are removed
370 # before rewriting names, make sure references are removed
361 repo.cachevfs.unlinkpath(_rbcrevs, ignoremissing=True)
371 repo.cachevfs.unlinkpath(_rbcrevs, ignoremissing=True)
362 f = repo.cachevfs.open(_rbcnames, b'wb')
372 f = repo.cachevfs.open(_rbcnames, b'wb')
363 names = self._names[self._rbcnamescount :]
373 names = self._names[self._rbcnamescount :]
364 from_local = encoding.fromlocal
374 from_local = encoding.fromlocal
365 data = b'\0'.join(from_local(b) for b in names)
375 data = b'\0'.join(from_local(b) for b in names)
366 f.write(data)
376 f.write(data)
367 self._rbcsnameslen = f.tell()
377 self._rbcsnameslen = f.tell()
368 finally:
378 finally:
369 if f is not None:
379 if f is not None:
370 f.close()
380 f.close()
371 self._rbcnamescount = len(self._names)
381 self._rbcnamescount = len(self._names)
372
382
373 def _writerevs(self, repo, start):
383 def _writerevs(self, repo, start):
374 """write the new revs to revbranchcache"""
384 """write the new revs to revbranchcache"""
375 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize)
385 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize)
376
386
377 end = revs * _rbcrecsize
387 end = revs * _rbcrecsize
378 if self._force_overwrite:
388 if self._force_overwrite:
379 start = 0
389 start = 0
380
390
381 with repo.cachevfs.open(_rbcrevs, b'a+b') as f:
391 with repo.cachevfs.open(_rbcrevs, b'a+b') as f:
382 pass # this make sure the file exist…
392 pass # this make sure the file exist…
383 with repo.cachevfs.open(_rbcrevs, b'r+b') as f:
393 with repo.cachevfs.open(_rbcrevs, b'r+b') as f:
384 f.seek(0, os.SEEK_END)
394 f.seek(0, os.SEEK_END)
385 current_size = f.tell()
395 current_size = f.tell()
386 if current_size < start:
396 if current_size < start:
387 start = 0
397 start = 0
388 if current_size != start:
398 if current_size != start:
389 threshold = current_size * REWRITE_RATIO
399 threshold = current_size * REWRITE_RATIO
390 if (max(end, current_size) - start) < threshold:
400 if (max(end, current_size) - start) < threshold:
391 # end affected, let overwrite the bad value
401 # end affected, let overwrite the bad value
392 dbg = b"overwriting %d bytes from %d in cache/%s"
402 dbg = b"overwriting %d bytes from %d in cache/%s"
393 dbg %= (current_size - start, start, _rbcrevs)
403 dbg %= (current_size - start, start, _rbcrevs)
394 if end < current_size:
404 if end < current_size:
395 extra = b" leaving (%d trailing bytes)"
405 extra = b" leaving (%d trailing bytes)"
396 extra %= current_size - end
406 extra %= current_size - end
397 dbg += extra
407 dbg += extra
398 dbg += b'\n'
408 dbg += b'\n'
399 repo.ui.debug(dbg)
409 repo.ui.debug(dbg)
400 else:
410 else:
401 start = 0
411 start = 0
402 dbg = b"resetting content of cache/%s\n" % _rbcrevs
412 dbg = b"resetting content of cache/%s\n" % _rbcrevs
403 repo.ui.debug(dbg)
413 repo.ui.debug(dbg)
404 if start > 0:
414 if start > 0:
405 f.seek(start)
415 f.seek(start)
406 f.write(self._rbcrevs.slice(start, end))
416 f.write(self._rbcrevs.slice(start, end))
407 else:
417 else:
408 f.close()
418 f.close()
409 with repo.cachevfs.open(
419 with repo.cachevfs.open(
410 _rbcrevs,
420 _rbcrevs,
411 b'wb',
421 b'wb',
412 atomictemp=True,
422 atomictemp=True,
413 ) as rev_file:
423 ) as rev_file:
414 rev_file.write(self._rbcrevs.slice(start, end))
424 rev_file.write(self._rbcrevs.slice(start, end))
415 self._rbcrevslen = revs
425 self._rbcrevslen = revs
416 self._force_overwrite = False
426 self._force_overwrite = False
@@ -1,1447 +1,1454
1 #testcases mmap nommap
1 #testcases mmap nommap
2 #testcases v2 v3
2 #testcases v2 v3
3
3
4 #if mmap
4 #if mmap
5 $ cat <<EOF >> $HGRCPATH
5 $ cat <<EOF >> $HGRCPATH
6 > [storage]
6 > [storage]
7 > revbranchcache.mmap=true
7 > revbranchcache.mmap=true
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 #if v3
11 #if v3
12 $ cat <<EOF >> $HGRCPATH
12 $ cat <<EOF >> $HGRCPATH
13 > [experimental]
13 > [experimental]
14 > branch-cache-v3=yes
14 > branch-cache-v3=yes
15 > EOF
15 > EOF
16 #else
16 #else
17 $ cat <<EOF >> $HGRCPATH
17 $ cat <<EOF >> $HGRCPATH
18 > [experimental]
18 > [experimental]
19 > branch-cache-v3=no
19 > branch-cache-v3=no
20 > EOF
20 > EOF
21 #endif
21 #endif
22
22
23 $ hg init a
23 $ hg init a
24 $ cd a
24 $ cd a
25
25
26 Verify checking branch of nullrev before the cache is created doesnt crash
26 Verify checking branch of nullrev before the cache is created doesnt crash
27 $ hg log -r 'branch(.)' -T '{branch}\n'
27 $ hg log -r 'branch(.)' -T '{branch}\n'
28
28
29 Basic test
29 Basic test
30 $ echo 'root' >root
30 $ echo 'root' >root
31 $ hg add root
31 $ hg add root
32 $ hg commit -d '0 0' -m "Adding root node"
32 $ hg commit -d '0 0' -m "Adding root node"
33
33
34 $ echo 'a' >a
34 $ echo 'a' >a
35 $ hg add a
35 $ hg add a
36 $ hg branch a
36 $ hg branch a
37 marked working directory as branch a
37 marked working directory as branch a
38 (branches are permanent and global, did you want a bookmark?)
38 (branches are permanent and global, did you want a bookmark?)
39 $ hg commit -d '1 0' -m "Adding a branch"
39 $ hg commit -d '1 0' -m "Adding a branch"
40
40
41 $ hg branch q
41 $ hg branch q
42 marked working directory as branch q
42 marked working directory as branch q
43 $ echo 'aa' >a
43 $ echo 'aa' >a
44 $ hg branch -C
44 $ hg branch -C
45 reset working directory to branch a
45 reset working directory to branch a
46 $ hg commit -d '2 0' -m "Adding to a branch"
46 $ hg commit -d '2 0' -m "Adding to a branch"
47
47
48 $ hg update -C 0
48 $ hg update -C 0
49 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
49 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
50 $ echo 'b' >b
50 $ echo 'b' >b
51 $ hg add b
51 $ hg add b
52 $ hg branch b
52 $ hg branch b
53 marked working directory as branch b
53 marked working directory as branch b
54 $ hg commit -d '2 0' -m "Adding b branch"
54 $ hg commit -d '2 0' -m "Adding b branch"
55
55
56 $ echo 'bh1' >bh1
56 $ echo 'bh1' >bh1
57 $ hg add bh1
57 $ hg add bh1
58 $ hg commit -d '3 0' -m "Adding b branch head 1"
58 $ hg commit -d '3 0' -m "Adding b branch head 1"
59
59
60 $ hg update -C 2
60 $ hg update -C 2
61 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
61 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 $ echo 'bh2' >bh2
62 $ echo 'bh2' >bh2
63 $ hg add bh2
63 $ hg add bh2
64 $ hg commit -d '4 0' -m "Adding b branch head 2"
64 $ hg commit -d '4 0' -m "Adding b branch head 2"
65
65
66 $ echo 'c' >c
66 $ echo 'c' >c
67 $ hg add c
67 $ hg add c
68 $ hg branch c
68 $ hg branch c
69 marked working directory as branch c
69 marked working directory as branch c
70 $ hg commit -d '5 0' -m "Adding c branch"
70 $ hg commit -d '5 0' -m "Adding c branch"
71
71
72 reserved names
72 reserved names
73
73
74 $ hg branch tip
74 $ hg branch tip
75 abort: the name 'tip' is reserved
75 abort: the name 'tip' is reserved
76 [10]
76 [10]
77 $ hg branch null
77 $ hg branch null
78 abort: the name 'null' is reserved
78 abort: the name 'null' is reserved
79 [10]
79 [10]
80 $ hg branch .
80 $ hg branch .
81 abort: the name '.' is reserved
81 abort: the name '.' is reserved
82 [10]
82 [10]
83
83
84 invalid characters
84 invalid characters
85
85
86 $ hg branch 'foo:bar'
86 $ hg branch 'foo:bar'
87 abort: ':' cannot be used in a name
87 abort: ':' cannot be used in a name
88 [10]
88 [10]
89
89
90 $ hg branch 'foo
90 $ hg branch 'foo
91 > bar'
91 > bar'
92 abort: '\n' cannot be used in a name
92 abort: '\n' cannot be used in a name
93 [10]
93 [10]
94
94
95 trailing or leading spaces should be stripped before testing duplicates
95 trailing or leading spaces should be stripped before testing duplicates
96
96
97 $ hg branch 'b '
97 $ hg branch 'b '
98 abort: a branch of the same name already exists
98 abort: a branch of the same name already exists
99 (use 'hg update' to switch to it)
99 (use 'hg update' to switch to it)
100 [10]
100 [10]
101
101
102 $ hg branch ' b'
102 $ hg branch ' b'
103 abort: a branch of the same name already exists
103 abort: a branch of the same name already exists
104 (use 'hg update' to switch to it)
104 (use 'hg update' to switch to it)
105 [10]
105 [10]
106
106
107 underscores in numeric branch names (issue6737)
107 underscores in numeric branch names (issue6737)
108
108
109 $ hg branch 2700_210
109 $ hg branch 2700_210
110 marked working directory as branch 2700_210
110 marked working directory as branch 2700_210
111
111
112 verify update will accept invalid legacy branch names
112 verify update will accept invalid legacy branch names
113
113
114 $ hg init test-invalid-branch-name
114 $ hg init test-invalid-branch-name
115 $ cd test-invalid-branch-name
115 $ cd test-invalid-branch-name
116 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
116 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
117 adding changesets
117 adding changesets
118 adding manifests
118 adding manifests
119 adding file changes
119 adding file changes
120 added 3 changesets with 3 changes to 2 files
120 added 3 changesets with 3 changes to 2 files
121 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
121 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123
123
124 $ hg update '"colon:test"'
124 $ hg update '"colon:test"'
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 $ cd ..
126 $ cd ..
127
127
128 $ echo 'd' >d
128 $ echo 'd' >d
129 $ hg add d
129 $ hg add d
130 $ hg branch 'a branch name much longer than the default justification used by branches'
130 $ hg branch 'a branch name much longer than the default justification used by branches'
131 marked working directory as branch a branch name much longer than the default justification used by branches
131 marked working directory as branch a branch name much longer than the default justification used by branches
132 $ hg commit -d '6 0' -m "Adding d branch"
132 $ hg commit -d '6 0' -m "Adding d branch"
133
133
134 $ hg branches
134 $ hg branches
135 a branch name much longer than the default justification used by branches 7:10ff5895aa57
135 a branch name much longer than the default justification used by branches 7:10ff5895aa57
136 b 4:aee39cd168d0
136 b 4:aee39cd168d0
137 c 6:589736a22561 (inactive)
137 c 6:589736a22561 (inactive)
138 a 5:d8cbc61dbaa6 (inactive)
138 a 5:d8cbc61dbaa6 (inactive)
139 default 0:19709c5a4e75 (inactive)
139 default 0:19709c5a4e75 (inactive)
140
140
141 -------
141 -------
142
142
143 $ hg branches -a
143 $ hg branches -a
144 a branch name much longer than the default justification used by branches 7:10ff5895aa57
144 a branch name much longer than the default justification used by branches 7:10ff5895aa57
145 b 4:aee39cd168d0
145 b 4:aee39cd168d0
146
146
147 --- Branch a
147 --- Branch a
148
148
149 $ hg log -b a
149 $ hg log -b a
150 changeset: 5:d8cbc61dbaa6
150 changeset: 5:d8cbc61dbaa6
151 branch: a
151 branch: a
152 parent: 2:881fe2b92ad0
152 parent: 2:881fe2b92ad0
153 user: test
153 user: test
154 date: Thu Jan 01 00:00:04 1970 +0000
154 date: Thu Jan 01 00:00:04 1970 +0000
155 summary: Adding b branch head 2
155 summary: Adding b branch head 2
156
156
157 changeset: 2:881fe2b92ad0
157 changeset: 2:881fe2b92ad0
158 branch: a
158 branch: a
159 user: test
159 user: test
160 date: Thu Jan 01 00:00:02 1970 +0000
160 date: Thu Jan 01 00:00:02 1970 +0000
161 summary: Adding to a branch
161 summary: Adding to a branch
162
162
163 changeset: 1:dd6b440dd85a
163 changeset: 1:dd6b440dd85a
164 branch: a
164 branch: a
165 user: test
165 user: test
166 date: Thu Jan 01 00:00:01 1970 +0000
166 date: Thu Jan 01 00:00:01 1970 +0000
167 summary: Adding a branch
167 summary: Adding a branch
168
168
169
169
170 ---- Branch b
170 ---- Branch b
171
171
172 $ hg log -b b
172 $ hg log -b b
173 changeset: 4:aee39cd168d0
173 changeset: 4:aee39cd168d0
174 branch: b
174 branch: b
175 user: test
175 user: test
176 date: Thu Jan 01 00:00:03 1970 +0000
176 date: Thu Jan 01 00:00:03 1970 +0000
177 summary: Adding b branch head 1
177 summary: Adding b branch head 1
178
178
179 changeset: 3:ac22033332d1
179 changeset: 3:ac22033332d1
180 branch: b
180 branch: b
181 parent: 0:19709c5a4e75
181 parent: 0:19709c5a4e75
182 user: test
182 user: test
183 date: Thu Jan 01 00:00:02 1970 +0000
183 date: Thu Jan 01 00:00:02 1970 +0000
184 summary: Adding b branch
184 summary: Adding b branch
185
185
186
186
187 ---- going to test branch listing by rev
187 ---- going to test branch listing by rev
188 $ hg branches -r0
188 $ hg branches -r0
189 default 0:19709c5a4e75 (inactive)
189 default 0:19709c5a4e75 (inactive)
190 $ hg branches -qr0
190 $ hg branches -qr0
191 default
191 default
192 --- now more than one rev
192 --- now more than one rev
193 $ hg branches -r2:5
193 $ hg branches -r2:5
194 b 4:aee39cd168d0
194 b 4:aee39cd168d0
195 a 5:d8cbc61dbaa6 (inactive)
195 a 5:d8cbc61dbaa6 (inactive)
196 $ hg branches -qr2:5
196 $ hg branches -qr2:5
197 b
197 b
198 a
198 a
199 ---- going to test branch closing
199 ---- going to test branch closing
200
200
201 $ hg branches
201 $ hg branches
202 a branch name much longer than the default justification used by branches 7:10ff5895aa57
202 a branch name much longer than the default justification used by branches 7:10ff5895aa57
203 b 4:aee39cd168d0
203 b 4:aee39cd168d0
204 c 6:589736a22561 (inactive)
204 c 6:589736a22561 (inactive)
205 a 5:d8cbc61dbaa6 (inactive)
205 a 5:d8cbc61dbaa6 (inactive)
206 default 0:19709c5a4e75 (inactive)
206 default 0:19709c5a4e75 (inactive)
207 $ hg up -C b
207 $ hg up -C b
208 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
208 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
209 $ echo 'xxx1' >> b
209 $ echo 'xxx1' >> b
210 $ hg commit -d '7 0' -m 'adding cset to branch b'
210 $ hg commit -d '7 0' -m 'adding cset to branch b'
211 $ hg up -C aee39cd168d0
211 $ hg up -C aee39cd168d0
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 $ echo 'xxx2' >> b
213 $ echo 'xxx2' >> b
214 $ hg commit -d '8 0' -m 'adding head to branch b'
214 $ hg commit -d '8 0' -m 'adding head to branch b'
215 created new head
215 created new head
216 $ echo 'xxx3' >> b
216 $ echo 'xxx3' >> b
217 $ hg commit -d '9 0' -m 'adding another cset to branch b'
217 $ hg commit -d '9 0' -m 'adding another cset to branch b'
218 $ hg branches
218 $ hg branches
219 b 10:bfbe841b666e
219 b 10:bfbe841b666e
220 a branch name much longer than the default justification used by branches 7:10ff5895aa57
220 a branch name much longer than the default justification used by branches 7:10ff5895aa57
221 c 6:589736a22561 (inactive)
221 c 6:589736a22561 (inactive)
222 a 5:d8cbc61dbaa6 (inactive)
222 a 5:d8cbc61dbaa6 (inactive)
223 default 0:19709c5a4e75 (inactive)
223 default 0:19709c5a4e75 (inactive)
224 $ hg heads --closed
224 $ hg heads --closed
225 changeset: 10:bfbe841b666e
225 changeset: 10:bfbe841b666e
226 branch: b
226 branch: b
227 tag: tip
227 tag: tip
228 user: test
228 user: test
229 date: Thu Jan 01 00:00:09 1970 +0000
229 date: Thu Jan 01 00:00:09 1970 +0000
230 summary: adding another cset to branch b
230 summary: adding another cset to branch b
231
231
232 changeset: 8:eebb944467c9
232 changeset: 8:eebb944467c9
233 branch: b
233 branch: b
234 parent: 4:aee39cd168d0
234 parent: 4:aee39cd168d0
235 user: test
235 user: test
236 date: Thu Jan 01 00:00:07 1970 +0000
236 date: Thu Jan 01 00:00:07 1970 +0000
237 summary: adding cset to branch b
237 summary: adding cset to branch b
238
238
239 changeset: 7:10ff5895aa57
239 changeset: 7:10ff5895aa57
240 branch: a branch name much longer than the default justification used by branches
240 branch: a branch name much longer than the default justification used by branches
241 user: test
241 user: test
242 date: Thu Jan 01 00:00:06 1970 +0000
242 date: Thu Jan 01 00:00:06 1970 +0000
243 summary: Adding d branch
243 summary: Adding d branch
244
244
245 changeset: 6:589736a22561
245 changeset: 6:589736a22561
246 branch: c
246 branch: c
247 user: test
247 user: test
248 date: Thu Jan 01 00:00:05 1970 +0000
248 date: Thu Jan 01 00:00:05 1970 +0000
249 summary: Adding c branch
249 summary: Adding c branch
250
250
251 changeset: 5:d8cbc61dbaa6
251 changeset: 5:d8cbc61dbaa6
252 branch: a
252 branch: a
253 parent: 2:881fe2b92ad0
253 parent: 2:881fe2b92ad0
254 user: test
254 user: test
255 date: Thu Jan 01 00:00:04 1970 +0000
255 date: Thu Jan 01 00:00:04 1970 +0000
256 summary: Adding b branch head 2
256 summary: Adding b branch head 2
257
257
258 changeset: 0:19709c5a4e75
258 changeset: 0:19709c5a4e75
259 user: test
259 user: test
260 date: Thu Jan 01 00:00:00 1970 +0000
260 date: Thu Jan 01 00:00:00 1970 +0000
261 summary: Adding root node
261 summary: Adding root node
262
262
263 $ hg heads
263 $ hg heads
264 changeset: 10:bfbe841b666e
264 changeset: 10:bfbe841b666e
265 branch: b
265 branch: b
266 tag: tip
266 tag: tip
267 user: test
267 user: test
268 date: Thu Jan 01 00:00:09 1970 +0000
268 date: Thu Jan 01 00:00:09 1970 +0000
269 summary: adding another cset to branch b
269 summary: adding another cset to branch b
270
270
271 changeset: 8:eebb944467c9
271 changeset: 8:eebb944467c9
272 branch: b
272 branch: b
273 parent: 4:aee39cd168d0
273 parent: 4:aee39cd168d0
274 user: test
274 user: test
275 date: Thu Jan 01 00:00:07 1970 +0000
275 date: Thu Jan 01 00:00:07 1970 +0000
276 summary: adding cset to branch b
276 summary: adding cset to branch b
277
277
278 changeset: 7:10ff5895aa57
278 changeset: 7:10ff5895aa57
279 branch: a branch name much longer than the default justification used by branches
279 branch: a branch name much longer than the default justification used by branches
280 user: test
280 user: test
281 date: Thu Jan 01 00:00:06 1970 +0000
281 date: Thu Jan 01 00:00:06 1970 +0000
282 summary: Adding d branch
282 summary: Adding d branch
283
283
284 changeset: 6:589736a22561
284 changeset: 6:589736a22561
285 branch: c
285 branch: c
286 user: test
286 user: test
287 date: Thu Jan 01 00:00:05 1970 +0000
287 date: Thu Jan 01 00:00:05 1970 +0000
288 summary: Adding c branch
288 summary: Adding c branch
289
289
290 changeset: 5:d8cbc61dbaa6
290 changeset: 5:d8cbc61dbaa6
291 branch: a
291 branch: a
292 parent: 2:881fe2b92ad0
292 parent: 2:881fe2b92ad0
293 user: test
293 user: test
294 date: Thu Jan 01 00:00:04 1970 +0000
294 date: Thu Jan 01 00:00:04 1970 +0000
295 summary: Adding b branch head 2
295 summary: Adding b branch head 2
296
296
297 changeset: 0:19709c5a4e75
297 changeset: 0:19709c5a4e75
298 user: test
298 user: test
299 date: Thu Jan 01 00:00:00 1970 +0000
299 date: Thu Jan 01 00:00:00 1970 +0000
300 summary: Adding root node
300 summary: Adding root node
301
301
302 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
302 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
303 $ hg branches -a
303 $ hg branches -a
304 b 8:eebb944467c9
304 b 8:eebb944467c9
305 a branch name much longer than the default justification used by branches 7:10ff5895aa57
305 a branch name much longer than the default justification used by branches 7:10ff5895aa57
306 $ hg up -C b
306 $ hg up -C b
307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
308 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
309 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
309 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
310 abort: current revision is already a branch closing head
310 abort: current revision is already a branch closing head
311 [10]
311 [10]
312
312
313 $ echo foo > b
313 $ echo foo > b
314 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
314 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
315
315
316 $ echo bar > b
316 $ echo bar > b
317 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' bh1
317 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' bh1
318 abort: current revision is already a branch closing head
318 abort: current revision is already a branch closing head
319 [10]
319 [10]
320 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' b
320 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' b
321
321
322 $ echo baz > b
322 $ echo baz > b
323 $ hg commit -d '9 0' --close-branch -m 'empty re-closing this branch' -X b
323 $ hg commit -d '9 0' --close-branch -m 'empty re-closing this branch' -X b
324 abort: current revision is already a branch closing head
324 abort: current revision is already a branch closing head
325 [10]
325 [10]
326 $ hg revert b
326 $ hg revert b
327
327
328 $ hg debugstrip --rev 13: --no-backup
328 $ hg debugstrip --rev 13: --no-backup
329 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
329 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 $ hg revert --all --no-backup
330 $ hg revert --all --no-backup
331
331
332 $ hg log -r tip --debug
332 $ hg log -r tip --debug
333 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
333 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
334 branch: b
334 branch: b
335 tag: tip
335 tag: tip
336 phase: draft
336 phase: draft
337 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
337 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
338 parent: -1:0000000000000000000000000000000000000000
338 parent: -1:0000000000000000000000000000000000000000
339 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
339 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
340 user: test
340 user: test
341 date: Thu Jan 01 00:00:09 1970 +0000
341 date: Thu Jan 01 00:00:09 1970 +0000
342 extra: branch=b
342 extra: branch=b
343 extra: close=1
343 extra: close=1
344 description:
344 description:
345 close this part branch too
345 close this part branch too
346
346
347
347
348 --- b branch should be inactive
348 --- b branch should be inactive
349
349
350 $ hg branches
350 $ hg branches
351 a branch name much longer than the default justification used by branches 7:10ff5895aa57
351 a branch name much longer than the default justification used by branches 7:10ff5895aa57
352 c 6:589736a22561 (inactive)
352 c 6:589736a22561 (inactive)
353 a 5:d8cbc61dbaa6 (inactive)
353 a 5:d8cbc61dbaa6 (inactive)
354 default 0:19709c5a4e75 (inactive)
354 default 0:19709c5a4e75 (inactive)
355 $ hg branches -c
355 $ hg branches -c
356 a branch name much longer than the default justification used by branches 7:10ff5895aa57
356 a branch name much longer than the default justification used by branches 7:10ff5895aa57
357 b 12:e3d49c0575d8 (closed)
357 b 12:e3d49c0575d8 (closed)
358 c 6:589736a22561 (inactive)
358 c 6:589736a22561 (inactive)
359 a 5:d8cbc61dbaa6 (inactive)
359 a 5:d8cbc61dbaa6 (inactive)
360 default 0:19709c5a4e75 (inactive)
360 default 0:19709c5a4e75 (inactive)
361 $ hg branches -a
361 $ hg branches -a
362 a branch name much longer than the default justification used by branches 7:10ff5895aa57
362 a branch name much longer than the default justification used by branches 7:10ff5895aa57
363 $ hg branches -q
363 $ hg branches -q
364 a branch name much longer than the default justification used by branches
364 a branch name much longer than the default justification used by branches
365 c
365 c
366 a
366 a
367 default
367 default
368 $ hg heads b
368 $ hg heads b
369 no open branch heads found on branches b
369 no open branch heads found on branches b
370 [1]
370 [1]
371 $ hg heads --closed b
371 $ hg heads --closed b
372 changeset: 12:e3d49c0575d8
372 changeset: 12:e3d49c0575d8
373 branch: b
373 branch: b
374 tag: tip
374 tag: tip
375 parent: 8:eebb944467c9
375 parent: 8:eebb944467c9
376 user: test
376 user: test
377 date: Thu Jan 01 00:00:09 1970 +0000
377 date: Thu Jan 01 00:00:09 1970 +0000
378 summary: close this part branch too
378 summary: close this part branch too
379
379
380 changeset: 11:d3f163457ebf
380 changeset: 11:d3f163457ebf
381 branch: b
381 branch: b
382 user: test
382 user: test
383 date: Thu Jan 01 00:00:09 1970 +0000
383 date: Thu Jan 01 00:00:09 1970 +0000
384 summary: prune bad branch
384 summary: prune bad branch
385
385
386 $ echo 'xxx4' >> b
386 $ echo 'xxx4' >> b
387 $ hg commit -d '9 0' -m 'reopen branch with a change'
387 $ hg commit -d '9 0' -m 'reopen branch with a change'
388 reopening closed branch head 12
388 reopening closed branch head 12
389
389
390 --- branch b is back in action
390 --- branch b is back in action
391
391
392 $ hg branches -a
392 $ hg branches -a
393 b 13:e23b5505d1ad
393 b 13:e23b5505d1ad
394 a branch name much longer than the default justification used by branches 7:10ff5895aa57
394 a branch name much longer than the default justification used by branches 7:10ff5895aa57
395
395
396 ---- test heads listings
396 ---- test heads listings
397
397
398 $ hg heads
398 $ hg heads
399 changeset: 13:e23b5505d1ad
399 changeset: 13:e23b5505d1ad
400 branch: b
400 branch: b
401 tag: tip
401 tag: tip
402 user: test
402 user: test
403 date: Thu Jan 01 00:00:09 1970 +0000
403 date: Thu Jan 01 00:00:09 1970 +0000
404 summary: reopen branch with a change
404 summary: reopen branch with a change
405
405
406 changeset: 7:10ff5895aa57
406 changeset: 7:10ff5895aa57
407 branch: a branch name much longer than the default justification used by branches
407 branch: a branch name much longer than the default justification used by branches
408 user: test
408 user: test
409 date: Thu Jan 01 00:00:06 1970 +0000
409 date: Thu Jan 01 00:00:06 1970 +0000
410 summary: Adding d branch
410 summary: Adding d branch
411
411
412 changeset: 6:589736a22561
412 changeset: 6:589736a22561
413 branch: c
413 branch: c
414 user: test
414 user: test
415 date: Thu Jan 01 00:00:05 1970 +0000
415 date: Thu Jan 01 00:00:05 1970 +0000
416 summary: Adding c branch
416 summary: Adding c branch
417
417
418 changeset: 5:d8cbc61dbaa6
418 changeset: 5:d8cbc61dbaa6
419 branch: a
419 branch: a
420 parent: 2:881fe2b92ad0
420 parent: 2:881fe2b92ad0
421 user: test
421 user: test
422 date: Thu Jan 01 00:00:04 1970 +0000
422 date: Thu Jan 01 00:00:04 1970 +0000
423 summary: Adding b branch head 2
423 summary: Adding b branch head 2
424
424
425 changeset: 0:19709c5a4e75
425 changeset: 0:19709c5a4e75
426 user: test
426 user: test
427 date: Thu Jan 01 00:00:00 1970 +0000
427 date: Thu Jan 01 00:00:00 1970 +0000
428 summary: Adding root node
428 summary: Adding root node
429
429
430
430
431 branch default
431 branch default
432
432
433 $ hg heads default
433 $ hg heads default
434 changeset: 0:19709c5a4e75
434 changeset: 0:19709c5a4e75
435 user: test
435 user: test
436 date: Thu Jan 01 00:00:00 1970 +0000
436 date: Thu Jan 01 00:00:00 1970 +0000
437 summary: Adding root node
437 summary: Adding root node
438
438
439
439
440 branch a
440 branch a
441
441
442 $ hg heads a
442 $ hg heads a
443 changeset: 5:d8cbc61dbaa6
443 changeset: 5:d8cbc61dbaa6
444 branch: a
444 branch: a
445 parent: 2:881fe2b92ad0
445 parent: 2:881fe2b92ad0
446 user: test
446 user: test
447 date: Thu Jan 01 00:00:04 1970 +0000
447 date: Thu Jan 01 00:00:04 1970 +0000
448 summary: Adding b branch head 2
448 summary: Adding b branch head 2
449
449
450 $ hg heads --active a
450 $ hg heads --active a
451 no open branch heads found on branches a
451 no open branch heads found on branches a
452 [1]
452 [1]
453
453
454 branch b
454 branch b
455
455
456 $ hg heads b
456 $ hg heads b
457 changeset: 13:e23b5505d1ad
457 changeset: 13:e23b5505d1ad
458 branch: b
458 branch: b
459 tag: tip
459 tag: tip
460 user: test
460 user: test
461 date: Thu Jan 01 00:00:09 1970 +0000
461 date: Thu Jan 01 00:00:09 1970 +0000
462 summary: reopen branch with a change
462 summary: reopen branch with a change
463
463
464 $ hg heads --closed b
464 $ hg heads --closed b
465 changeset: 13:e23b5505d1ad
465 changeset: 13:e23b5505d1ad
466 branch: b
466 branch: b
467 tag: tip
467 tag: tip
468 user: test
468 user: test
469 date: Thu Jan 01 00:00:09 1970 +0000
469 date: Thu Jan 01 00:00:09 1970 +0000
470 summary: reopen branch with a change
470 summary: reopen branch with a change
471
471
472 changeset: 11:d3f163457ebf
472 changeset: 11:d3f163457ebf
473 branch: b
473 branch: b
474 user: test
474 user: test
475 date: Thu Jan 01 00:00:09 1970 +0000
475 date: Thu Jan 01 00:00:09 1970 +0000
476 summary: prune bad branch
476 summary: prune bad branch
477
477
478
478
479 reclose branch
479 reclose branch
480
480
481 $ hg up -C c
481 $ hg up -C c
482 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
482 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
483 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
483 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
484 $ hg branches
484 $ hg branches
485 b 13:e23b5505d1ad
485 b 13:e23b5505d1ad
486 a branch name much longer than the default justification used by branches 7:10ff5895aa57
486 a branch name much longer than the default justification used by branches 7:10ff5895aa57
487 a 5:d8cbc61dbaa6 (inactive)
487 a 5:d8cbc61dbaa6 (inactive)
488 default 0:19709c5a4e75 (inactive)
488 default 0:19709c5a4e75 (inactive)
489 $ hg branches --closed
489 $ hg branches --closed
490 b 13:e23b5505d1ad
490 b 13:e23b5505d1ad
491 a branch name much longer than the default justification used by branches 7:10ff5895aa57
491 a branch name much longer than the default justification used by branches 7:10ff5895aa57
492 c 14:f894c25619d3 (closed)
492 c 14:f894c25619d3 (closed)
493 a 5:d8cbc61dbaa6 (inactive)
493 a 5:d8cbc61dbaa6 (inactive)
494 default 0:19709c5a4e75 (inactive)
494 default 0:19709c5a4e75 (inactive)
495
495
496 multihead branch
496 multihead branch
497
497
498 $ hg up -C default
498 $ hg up -C default
499 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
499 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
500 $ hg branch m
500 $ hg branch m
501 marked working directory as branch m
501 marked working directory as branch m
502 $ touch m
502 $ touch m
503 $ hg add m
503 $ hg add m
504 $ hg commit -d '10 0' -m 'multihead base'
504 $ hg commit -d '10 0' -m 'multihead base'
505 $ echo "m1" >m
505 $ echo "m1" >m
506 $ hg commit -d '10 0' -m 'head 1'
506 $ hg commit -d '10 0' -m 'head 1'
507 $ hg up -C '.^'
507 $ hg up -C '.^'
508 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
508 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
509 $ echo "m2" >m
509 $ echo "m2" >m
510 $ hg commit -d '10 0' -m 'head 2'
510 $ hg commit -d '10 0' -m 'head 2'
511 created new head
511 created new head
512 $ hg log -b m
512 $ hg log -b m
513 changeset: 17:df343b0df04f
513 changeset: 17:df343b0df04f
514 branch: m
514 branch: m
515 tag: tip
515 tag: tip
516 parent: 15:f3447637f53e
516 parent: 15:f3447637f53e
517 user: test
517 user: test
518 date: Thu Jan 01 00:00:10 1970 +0000
518 date: Thu Jan 01 00:00:10 1970 +0000
519 summary: head 2
519 summary: head 2
520
520
521 changeset: 16:a58ca5d3bdf3
521 changeset: 16:a58ca5d3bdf3
522 branch: m
522 branch: m
523 user: test
523 user: test
524 date: Thu Jan 01 00:00:10 1970 +0000
524 date: Thu Jan 01 00:00:10 1970 +0000
525 summary: head 1
525 summary: head 1
526
526
527 changeset: 15:f3447637f53e
527 changeset: 15:f3447637f53e
528 branch: m
528 branch: m
529 parent: 0:19709c5a4e75
529 parent: 0:19709c5a4e75
530 user: test
530 user: test
531 date: Thu Jan 01 00:00:10 1970 +0000
531 date: Thu Jan 01 00:00:10 1970 +0000
532 summary: multihead base
532 summary: multihead base
533
533
534 $ hg heads --topo m
534 $ hg heads --topo m
535 changeset: 17:df343b0df04f
535 changeset: 17:df343b0df04f
536 branch: m
536 branch: m
537 tag: tip
537 tag: tip
538 parent: 15:f3447637f53e
538 parent: 15:f3447637f53e
539 user: test
539 user: test
540 date: Thu Jan 01 00:00:10 1970 +0000
540 date: Thu Jan 01 00:00:10 1970 +0000
541 summary: head 2
541 summary: head 2
542
542
543 changeset: 16:a58ca5d3bdf3
543 changeset: 16:a58ca5d3bdf3
544 branch: m
544 branch: m
545 user: test
545 user: test
546 date: Thu Jan 01 00:00:10 1970 +0000
546 date: Thu Jan 01 00:00:10 1970 +0000
547 summary: head 1
547 summary: head 1
548
548
549 $ hg branches
549 $ hg branches
550 m 17:df343b0df04f
550 m 17:df343b0df04f
551 b 13:e23b5505d1ad
551 b 13:e23b5505d1ad
552 a branch name much longer than the default justification used by branches 7:10ff5895aa57
552 a branch name much longer than the default justification used by branches 7:10ff5895aa57
553 a 5:d8cbc61dbaa6 (inactive)
553 a 5:d8cbc61dbaa6 (inactive)
554 default 0:19709c5a4e75 (inactive)
554 default 0:19709c5a4e75 (inactive)
555
555
556 partially merge multihead branch
556 partially merge multihead branch
557
557
558 $ hg up -C default
558 $ hg up -C default
559 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
559 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
560 $ hg branch md
560 $ hg branch md
561 marked working directory as branch md
561 marked working directory as branch md
562 $ hg merge m
562 $ hg merge m
563 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
563 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 (branch merge, don't forget to commit)
564 (branch merge, don't forget to commit)
565 $ hg commit -d '11 0' -m 'merge head 2'
565 $ hg commit -d '11 0' -m 'merge head 2'
566 $ hg heads --topo m
566 $ hg heads --topo m
567 changeset: 16:a58ca5d3bdf3
567 changeset: 16:a58ca5d3bdf3
568 branch: m
568 branch: m
569 user: test
569 user: test
570 date: Thu Jan 01 00:00:10 1970 +0000
570 date: Thu Jan 01 00:00:10 1970 +0000
571 summary: head 1
571 summary: head 1
572
572
573 $ hg branches
573 $ hg branches
574 md 18:c914c99f1fbb
574 md 18:c914c99f1fbb
575 m 17:df343b0df04f
575 m 17:df343b0df04f
576 b 13:e23b5505d1ad
576 b 13:e23b5505d1ad
577 a branch name much longer than the default justification used by branches 7:10ff5895aa57
577 a branch name much longer than the default justification used by branches 7:10ff5895aa57
578 a 5:d8cbc61dbaa6 (inactive)
578 a 5:d8cbc61dbaa6 (inactive)
579 default 0:19709c5a4e75 (inactive)
579 default 0:19709c5a4e75 (inactive)
580
580
581 partially close multihead branch
581 partially close multihead branch
582
582
583 $ hg up -C a58ca5d3bdf3
583 $ hg up -C a58ca5d3bdf3
584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 $ hg commit -d '12 0' -m 'close head 1' --close-branch
585 $ hg commit -d '12 0' -m 'close head 1' --close-branch
586 $ hg heads --topo m
586 $ hg heads --topo m
587 changeset: 19:cd21a80baa3d
587 changeset: 19:cd21a80baa3d
588 branch: m
588 branch: m
589 tag: tip
589 tag: tip
590 parent: 16:a58ca5d3bdf3
590 parent: 16:a58ca5d3bdf3
591 user: test
591 user: test
592 date: Thu Jan 01 00:00:12 1970 +0000
592 date: Thu Jan 01 00:00:12 1970 +0000
593 summary: close head 1
593 summary: close head 1
594
594
595 $ hg branches
595 $ hg branches
596 md 18:c914c99f1fbb
596 md 18:c914c99f1fbb
597 b 13:e23b5505d1ad
597 b 13:e23b5505d1ad
598 a branch name much longer than the default justification used by branches 7:10ff5895aa57
598 a branch name much longer than the default justification used by branches 7:10ff5895aa57
599 m 17:df343b0df04f (inactive)
599 m 17:df343b0df04f (inactive)
600 a 5:d8cbc61dbaa6 (inactive)
600 a 5:d8cbc61dbaa6 (inactive)
601 default 0:19709c5a4e75 (inactive)
601 default 0:19709c5a4e75 (inactive)
602
602
603 default branch colors:
603 default branch colors:
604
604
605 $ cat <<EOF >> $HGRCPATH
605 $ cat <<EOF >> $HGRCPATH
606 > [extensions]
606 > [extensions]
607 > color =
607 > color =
608 > [color]
608 > [color]
609 > mode = ansi
609 > mode = ansi
610 > EOF
610 > EOF
611
611
612 $ hg up -C b
612 $ hg up -C b
613 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
613 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 $ hg branches --color=always
614 $ hg branches --color=always
615 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
615 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
616 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
616 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
617 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
617 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
618 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
618 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
619 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
619 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
620 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
620 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
621
621
622 default closed branch color:
622 default closed branch color:
623
623
624 $ hg branches --color=always --closed
624 $ hg branches --color=always --closed
625 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
625 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
626 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
626 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
627 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
627 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
628 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
628 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
629 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
629 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
630 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
630 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
631 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
631 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
632
632
633 $ cat <<EOF >> $HGRCPATH
633 $ cat <<EOF >> $HGRCPATH
634 > [extensions]
634 > [extensions]
635 > color =
635 > color =
636 > [color]
636 > [color]
637 > branches.active = green
637 > branches.active = green
638 > branches.closed = blue
638 > branches.closed = blue
639 > branches.current = red
639 > branches.current = red
640 > branches.inactive = magenta
640 > branches.inactive = magenta
641 > log.changeset = cyan
641 > log.changeset = cyan
642 > EOF
642 > EOF
643
643
644 custom branch colors:
644 custom branch colors:
645
645
646 $ hg branches --color=always
646 $ hg branches --color=always
647 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
647 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
648 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
648 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
649 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
649 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
650 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
650 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
651 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
651 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
652 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
652 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
653
653
654 custom closed branch color:
654 custom closed branch color:
655
655
656 $ hg branches --color=always --closed
656 $ hg branches --color=always --closed
657 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
657 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
658 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
658 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
659 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
659 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
660 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
660 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
661 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
661 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
662 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
662 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
663 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
663 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
664
664
665 template output:
665 template output:
666
666
667 $ hg branches -Tjson --closed
667 $ hg branches -Tjson --closed
668 [
668 [
669 {
669 {
670 "active": true,
670 "active": true,
671 "branch": "md",
671 "branch": "md",
672 "closed": false,
672 "closed": false,
673 "current": false,
673 "current": false,
674 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
674 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
675 "rev": 18
675 "rev": 18
676 },
676 },
677 {
677 {
678 "active": true,
678 "active": true,
679 "branch": "b",
679 "branch": "b",
680 "closed": false,
680 "closed": false,
681 "current": true,
681 "current": true,
682 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
682 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
683 "rev": 13
683 "rev": 13
684 },
684 },
685 {
685 {
686 "active": true,
686 "active": true,
687 "branch": "a branch name much longer than the default justification used by branches",
687 "branch": "a branch name much longer than the default justification used by branches",
688 "closed": false,
688 "closed": false,
689 "current": false,
689 "current": false,
690 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
690 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
691 "rev": 7
691 "rev": 7
692 },
692 },
693 {
693 {
694 "active": false,
694 "active": false,
695 "branch": "m",
695 "branch": "m",
696 "closed": false,
696 "closed": false,
697 "current": false,
697 "current": false,
698 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
698 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
699 "rev": 17
699 "rev": 17
700 },
700 },
701 {
701 {
702 "active": false,
702 "active": false,
703 "branch": "c",
703 "branch": "c",
704 "closed": true,
704 "closed": true,
705 "current": false,
705 "current": false,
706 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
706 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
707 "rev": 14
707 "rev": 14
708 },
708 },
709 {
709 {
710 "active": false,
710 "active": false,
711 "branch": "a",
711 "branch": "a",
712 "closed": false,
712 "closed": false,
713 "current": false,
713 "current": false,
714 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
714 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
715 "rev": 5
715 "rev": 5
716 },
716 },
717 {
717 {
718 "active": false,
718 "active": false,
719 "branch": "default",
719 "branch": "default",
720 "closed": false,
720 "closed": false,
721 "current": false,
721 "current": false,
722 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
722 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
723 "rev": 0
723 "rev": 0
724 }
724 }
725 ]
725 ]
726
726
727 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
727 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
728 c
728 c
729
729
730 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
730 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
731 md: merge head 2
731 md: merge head 2
732 b: reopen branch with a change
732 b: reopen branch with a change
733 a: Adding d branch
733 a: Adding d branch
734 m: head 2
734 m: head 2
735 a: Adding b branch head 2
735 a: Adding b branch head 2
736 default: Adding root node
736 default: Adding root node
737
737
738 $ cat <<'EOF' > "$TESTTMP/map-myjson"
738 $ cat <<'EOF' > "$TESTTMP/map-myjson"
739 > docheader = '\{\n'
739 > docheader = '\{\n'
740 > docfooter = '\n}\n'
740 > docfooter = '\n}\n'
741 > separator = ',\n'
741 > separator = ',\n'
742 > branches = ' {dict(branch, node|short)|json}'
742 > branches = ' {dict(branch, node|short)|json}'
743 > EOF
743 > EOF
744 $ hg branches -T "$TESTTMP/map-myjson"
744 $ hg branches -T "$TESTTMP/map-myjson"
745 {
745 {
746 {"branch": "md", "node": "c914c99f1fbb"},
746 {"branch": "md", "node": "c914c99f1fbb"},
747 {"branch": "b", "node": "e23b5505d1ad"},
747 {"branch": "b", "node": "e23b5505d1ad"},
748 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
748 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
749 {"branch": "m", "node": "df343b0df04f"},
749 {"branch": "m", "node": "df343b0df04f"},
750 {"branch": "a", "node": "d8cbc61dbaa6"},
750 {"branch": "a", "node": "d8cbc61dbaa6"},
751 {"branch": "default", "node": "19709c5a4e75"}
751 {"branch": "default", "node": "19709c5a4e75"}
752 }
752 }
753
753
754 $ cat <<'EOF' >> .hg/hgrc
754 $ cat <<'EOF' >> .hg/hgrc
755 > [templates]
755 > [templates]
756 > myjson = ' {dict(branch, node|short)|json}'
756 > myjson = ' {dict(branch, node|short)|json}'
757 > myjson:docheader = '\{\n'
757 > myjson:docheader = '\{\n'
758 > myjson:docfooter = '\n}\n'
758 > myjson:docfooter = '\n}\n'
759 > myjson:separator = ',\n'
759 > myjson:separator = ',\n'
760 > EOF
760 > EOF
761 $ hg branches -T myjson
761 $ hg branches -T myjson
762 {
762 {
763 {"branch": "md", "node": "c914c99f1fbb"},
763 {"branch": "md", "node": "c914c99f1fbb"},
764 {"branch": "b", "node": "e23b5505d1ad"},
764 {"branch": "b", "node": "e23b5505d1ad"},
765 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
765 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
766 {"branch": "m", "node": "df343b0df04f"},
766 {"branch": "m", "node": "df343b0df04f"},
767 {"branch": "a", "node": "d8cbc61dbaa6"},
767 {"branch": "a", "node": "d8cbc61dbaa6"},
768 {"branch": "default", "node": "19709c5a4e75"}
768 {"branch": "default", "node": "19709c5a4e75"}
769 }
769 }
770
770
771 $ cat <<'EOF' >> .hg/hgrc
771 $ cat <<'EOF' >> .hg/hgrc
772 > [templates]
772 > [templates]
773 > :docheader = 'should not be selected as a docheader for literal templates\n'
773 > :docheader = 'should not be selected as a docheader for literal templates\n'
774 > EOF
774 > EOF
775 $ hg branches -T '{branch}\n'
775 $ hg branches -T '{branch}\n'
776 md
776 md
777 b
777 b
778 a branch name much longer than the default justification used by branches
778 a branch name much longer than the default justification used by branches
779 m
779 m
780 a
780 a
781 default
781 default
782
782
783 Tests of revision branch name caching
783 Tests of revision branch name caching
784
784
785 We rev branch cache is updated automatically. In these tests we use a trick to
785 We rev branch cache is updated automatically. In these tests we use a trick to
786 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
786 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
787 rebuild that also will populate the rev branch cache.
787 rebuild that also will populate the rev branch cache.
788
788
789 revision branch cache is created when building the branch head cache
789 revision branch cache is created when building the branch head cache
790 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
790 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
791 5
791 5
792 $ f --hexdump --size .hg/cache/rbc-*
792 $ f --hexdump --size .hg/cache/rbc-*
793 .hg/cache/rbc-names-v2: size=92
793 .hg/cache/rbc-names-v2: size=92
794 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
794 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
795 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
795 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
796 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
796 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
797 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
797 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
798 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
798 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
799 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
799 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
800 .hg/cache/rbc-revs-v2: size=160
800 .hg/cache/rbc-revs-v2: size=160
801 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
801 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
802 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
802 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
803 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
803 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
804 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
804 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
805 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
805 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
806 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
806 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
807 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
807 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
808 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
808 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
809 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
809 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
810 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
810 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
811
811
812 no errors when revbranchcache is not writable
812 no errors when revbranchcache is not writable
813
813
814 $ echo >> .hg/cache/rbc-revs-v2
814 $ echo >> .hg/cache/rbc-revs-v2
815 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
815 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
816 $ mkdir .hg/cache/rbc-revs-v2
816 $ mkdir .hg/cache/rbc-revs-v2
817 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
817 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
818 5
818 5
819 $ rmdir .hg/cache/rbc-revs-v2
819 $ rmdir .hg/cache/rbc-revs-v2
820 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
820 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
821
821
822 no errors when wlock cannot be acquired
822 no errors when wlock cannot be acquired
823
823
824 #if unix-permissions
824 #if unix-permissions
825 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
825 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
826 $ rm -f .hg/cache/branch*
826 $ rm -f .hg/cache/branch*
827 $ chmod 555 .hg
827 $ chmod 555 .hg
828 $ hg head a -T '{rev}\n'
828 $ hg head a -T '{rev}\n'
829 5
829 5
830 $ chmod 755 .hg
830 $ chmod 755 .hg
831 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
831 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
832 #endif
832 #endif
833
833
834 recovery from invalid cache revs file with trailing data
834 recovery from invalid cache revs file with trailing data
835 $ echo >> .hg/cache/rbc-revs-v2
835 $ echo >> .hg/cache/rbc-revs-v2
836 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
836 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
837 5
837 5
838 overwriting 2 bytes from 160 in cache/rbc-revs-v2 leaving (2 trailing bytes)
838 overwriting 2 bytes from 160 in cache/rbc-revs-v2 leaving (2 trailing bytes)
839 $ f --size .hg/cache/rbc-revs*
839 $ f --size .hg/cache/rbc-revs*
840 .hg/cache/rbc-revs-v2: size=162
840 .hg/cache/rbc-revs-v2: size=162
841
841
842 recovery from invalid cache file with partial last record
842 recovery from invalid cache file with partial last record
843 $ mv .hg/cache/rbc-revs-v2 .
843 $ mv .hg/cache/rbc-revs-v2 .
844 $ f -qDB 119 rbc-revs-v2 > .hg/cache/rbc-revs-v2
844 $ f -qDB 119 rbc-revs-v2 > .hg/cache/rbc-revs-v2
845 $ f --size .hg/cache/rbc-revs*
845 $ f --size .hg/cache/rbc-revs*
846 .hg/cache/rbc-revs-v2: size=119
846 .hg/cache/rbc-revs-v2: size=119
847 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
847 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
848 5
848 5
849 resetting content of cache/rbc-revs-v2
849 resetting content of cache/rbc-revs-v2
850 $ f --size .hg/cache/rbc-revs*
850 $ f --size .hg/cache/rbc-revs*
851 .hg/cache/rbc-revs-v2: size=160
851 .hg/cache/rbc-revs-v2: size=160
852
852
853 recovery from invalid cache file with missing record - no truncation
853 recovery from invalid cache file with missing record - no truncation
854 $ mv .hg/cache/rbc-revs-v2 .
854 $ mv .hg/cache/rbc-revs-v2 .
855 $ f -qDB 112 rbc-revs-v2 > .hg/cache/rbc-revs-v2
855 $ f -qDB 112 rbc-revs-v2 > .hg/cache/rbc-revs-v2
856 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
856 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
857 5
857 5
858 $ f --size .hg/cache/rbc-revs*
858 $ f --size .hg/cache/rbc-revs*
859 .hg/cache/rbc-revs-v2: size=160
859 .hg/cache/rbc-revs-v2: size=160
860
860
861 recovery from invalid cache file with some bad records
861 recovery from invalid cache file with some bad records
862 $ mv .hg/cache/rbc-revs-v2 .
862 $ mv .hg/cache/rbc-revs-v2 .
863 $ f -qDB 8 rbc-revs-v2 > .hg/cache/rbc-revs-v2
863 $ f -qDB 8 rbc-revs-v2 > .hg/cache/rbc-revs-v2
864 $ f --size .hg/cache/rbc-revs*
864 $ f --size .hg/cache/rbc-revs*
865 .hg/cache/rbc-revs-v2: size=8
865 .hg/cache/rbc-revs-v2: size=8
866 $ f -qDB 112 rbc-revs-v2 >> .hg/cache/rbc-revs-v2
866 $ f -qDB 112 rbc-revs-v2 >> .hg/cache/rbc-revs-v2
867 $ f --size .hg/cache/rbc-revs*
867 $ f --size .hg/cache/rbc-revs*
868 .hg/cache/rbc-revs-v2: size=120
868 .hg/cache/rbc-revs-v2: size=120
869 $ hg log -r 'branch(.)' -T '{rev} ' --debug
869 $ hg log -r 'branch(.)' -T '{rev} ' --debug
870 history modification detected - truncating revision branch cache to revision * (glob)
870 history modification detected - truncating revision branch cache to revision * (glob)
871 history modification detected - truncating revision branch cache to revision 1
871 history modification detected - truncating revision branch cache to revision 1
872 3 4 8 9 10 11 12 13 resetting content of cache/rbc-revs-v2
872 3 4 8 9 10 11 12 13 resetting content of cache/rbc-revs-v2
873 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
873 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
874 5
874 5
875 resetting content of cache/rbc-revs-v2
875 resetting content of cache/rbc-revs-v2
876 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
876 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
877 .hg/cache/rbc-revs-v2: size=160
877 .hg/cache/rbc-revs-v2: size=160
878 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
878 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
879
879
880 Smoothly reuse "v1" format if no v2 exists
880 Smoothly reuse "v1" format if no v2 exists
881 ------------------------------------------
881 ------------------------------------------
882
882
883 read only operation with valid data(
883 read only operation with valid data
884 (does not need to rewrite anything, maybe we should force it?)
884 (actively rewrite data)
885
885
886 $ rm .hg/cache/rbc-names-v2
886 $ rm .hg/cache/rbc-names-v2
887 $ rm .hg/cache/rbc-revs-v2
887 $ rm .hg/cache/rbc-revs-v2
888 $ rm .hg/cache/branch*
888 $ rm .hg/cache/branch*
889 $ hg head a -T '{rev}\n' --debug
889 $ hg head a -T '{rev}\n' --debug
890 5
890 5
891 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
891 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
892 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
892 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
893 $ rm .hg/cache/branch*
893 $ rm .hg/cache/branch*
894 $ hg head a -T '{rev}\n' --debug
894 $ hg head a -T '{rev}\n' --debug
895 5
895 5
896 $ f --size .hg/cache/rbc-*-*
896 $ f --size .hg/cache/rbc-*-*
897 .hg/cache/rbc-names-v1: size=92
897 .hg/cache/rbc-names-v1: size=92
898 .hg/cache/rbc-names-v2: size=92
898 .hg/cache/rbc-revs-v1: size=160
899 .hg/cache/rbc-revs-v1: size=160
900 .hg/cache/rbc-revs-v2: size=160
899
901
900
902
901 Write operation write a full v2 files
903 Write operation write a full v2 files
902
904
905 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
906 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
907 $ f --size .hg/cache/rbc-*
908 .hg/cache/rbc-names-v1: size=92
909 .hg/cache/rbc-revs-v1: size=160
903 $ hg branch not-here-for-long
910 $ hg branch not-here-for-long
904 marked working directory as branch not-here-for-long
911 marked working directory as branch not-here-for-long
905 $ hg ci -m not-long --debug
912 $ hg ci -m not-long --debug
906 reusing manifest from p1 (no file change)
913 reusing manifest from p1 (no file change)
907 committing changelog
914 committing changelog
908 rbc-names-v2 changed - rewriting it
909 updating the branch cache
915 updating the branch cache
910 committed changeset * (glob)
916 committed changeset * (glob)
911 $ f --size .hg/cache/rbc-*
917 $ f --size .hg/cache/rbc-*
912 .hg/cache/rbc-names-v1: size=92
918 .hg/cache/rbc-names-v1: size=92
913 .hg/cache/rbc-names-v2: size=110
919 .hg/cache/rbc-names-v2: size=110
914 .hg/cache/rbc-revs-v1: size=160
920 .hg/cache/rbc-revs-v1: size=160
915 .hg/cache/rbc-revs-v2: size=168
921 .hg/cache/rbc-revs-v2: size=168
916
922
917
923
918 With invalid v1 data, we rewrite it too (as v2)
924 With invalid v1 data, we rewrite it too (as v2)
919
925
920 $ cp .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
926 $ cp .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
921 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-revs-v1
927 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-revs-v1
922 $ rm .hg/cache/rbc-revs-v2
928 $ rm .hg/cache/rbc-revs-v2
923 $ rm .hg/cache/branch*
929 $ rm .hg/cache/branch*
924 $
930 $
925 $ hg head a -T '{rev}\n' --debug
931 $ hg head a -T '{rev}\n' --debug
926 history modification detected - truncating revision branch cache to revision 0
932 history modification detected - truncating revision branch cache to revision 0
927 5
933 5
928 $ f --size .hg/cache/rbc-*-*
934 $ f --size .hg/cache/rbc-*-*
929 .hg/cache/rbc-names-v1: size=110
935 .hg/cache/rbc-names-v1: size=110
936 .hg/cache/rbc-names-v2: size=110
930 .hg/cache/rbc-revs-v1: size=110
937 .hg/cache/rbc-revs-v1: size=110
931 .hg/cache/rbc-revs-v2: size=168
938 .hg/cache/rbc-revs-v2: size=168
932
939
933 cleanup
940 cleanup
934
941
935 $ hg up -qr '.^'
942 $ hg up -qr '.^'
936 $ hg rollback -qf
943 $ hg rollback -qf
937 $ rm .hg/cache/*
944 $ rm .hg/cache/*
938 $ hg debugupdatecache
945 $ hg debugupdatecache
939 $ f --size .hg/cache/rbc-*
946 $ f --size .hg/cache/rbc-*
940 .hg/cache/rbc-names-v2: size=92
947 .hg/cache/rbc-names-v2: size=92
941 .hg/cache/rbc-revs-v2: size=160
948 .hg/cache/rbc-revs-v2: size=160
942
949
943 cache is updated when committing
950 cache is updated when committing
944 $ hg branch i-will-regret-this
951 $ hg branch i-will-regret-this
945 marked working directory as branch i-will-regret-this
952 marked working directory as branch i-will-regret-this
946 $ hg ci -m regrets
953 $ hg ci -m regrets
947 $ f --size .hg/cache/rbc-*
954 $ f --size .hg/cache/rbc-*
948 .hg/cache/rbc-names-v2: size=111
955 .hg/cache/rbc-names-v2: size=111
949 .hg/cache/rbc-revs-v2: size=168
956 .hg/cache/rbc-revs-v2: size=168
950
957
951 update after rollback - the cache will be correct but rbc-names will will still
958 update after rollback - the cache will be correct but rbc-names will will still
952 contain the branch name even though it no longer is used
959 contain the branch name even though it no longer is used
953 $ hg up -qr '.^'
960 $ hg up -qr '.^'
954 $ hg rollback -qf
961 $ hg rollback -qf
955 $ f --size .hg/cache/rbc-names-*
962 $ f --size .hg/cache/rbc-names-*
956 .hg/cache/rbc-names-v2: size=111
963 .hg/cache/rbc-names-v2: size=111
957 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
964 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
958 $ f --size .hg/cache/rbc-revs-*
965 $ f --size .hg/cache/rbc-revs-*
959 .hg/cache/rbc-revs-v2: size=168
966 .hg/cache/rbc-revs-v2: size=168
960
967
961 cache is updated/truncated when stripping - it is thus very hard to get in a
968 cache is updated/truncated when stripping - it is thus very hard to get in a
962 situation where the cache is out of sync and the hash check detects it
969 situation where the cache is out of sync and the hash check detects it
963 $ hg --config extensions.strip= strip -r tip --nob
970 $ hg --config extensions.strip= strip -r tip --nob
964 $ f --size .hg/cache/rbc-revs*
971 $ f --size .hg/cache/rbc-revs*
965 .hg/cache/rbc-revs-v2: size=152
972 .hg/cache/rbc-revs-v2: size=152
966
973
967 cache is rebuilt when corruption is detected
974 cache is rebuilt when corruption is detected
968 $ echo > .hg/cache/rbc-names-v2
975 $ echo > .hg/cache/rbc-names-v2
969 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
976 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
970 referenced branch names not found - rebuilding revision branch cache from scratch
977 referenced branch names not found - rebuilding revision branch cache from scratch
971 8 9 10 11 12 13 (no-eol)
978 8 9 10 11 12 13 resetting content of rbc-names-v2
972 $ f --size .hg/cache/rbc-names-*
979 $ f --size .hg/cache/rbc-names-*
973 .hg/cache/rbc-names-v2: size=84
980 .hg/cache/rbc-names-v2: size=84
974 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
981 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
975 [1]
982 [1]
976 $ f --size .hg/cache/rbc-revs-*
983 $ f --size .hg/cache/rbc-revs-*
977 .hg/cache/rbc-revs-v2: size=152
984 .hg/cache/rbc-revs-v2: size=152
978
985
979 Test that cache files are created and grows correctly:
986 Test that cache files are created and grows correctly:
980
987
981 $ rm .hg/cache/rbc*
988 $ rm .hg/cache/rbc*
982 $ hg log -r "5 & branch(5)" -T "{rev}\n"
989 $ hg log -r "5 & branch(5)" -T "{rev}\n"
983 5
990 5
984
991
985 (here v3 is querying branch info for heads so it warm much more of the cache)
992 (here v3 is querying branch info for heads so it warm much more of the cache)
986
993
987 #if v2
994 #if v2
988 $ f --size .hg/cache/rbc-*
995 $ f --size .hg/cache/rbc-*
989 .hg/cache/rbc-names-v2: size=1
996 .hg/cache/rbc-names-v2: size=1
990 .hg/cache/rbc-revs-v2: size=48
997 .hg/cache/rbc-revs-v2: size=48
991 #else
998 #else
992 $ f --size .hg/cache/rbc-*
999 $ f --size .hg/cache/rbc-*
993 .hg/cache/rbc-names-v2: size=84
1000 .hg/cache/rbc-names-v2: size=84
994 .hg/cache/rbc-revs-v2: size=152
1001 .hg/cache/rbc-revs-v2: size=152
995 #endif
1002 #endif
996
1003
997 $ cd ..
1004 $ cd ..
998
1005
999 Test for multiple incorrect branch cache entries:
1006 Test for multiple incorrect branch cache entries:
1000
1007
1001 $ hg init b
1008 $ hg init b
1002 $ cd b
1009 $ cd b
1003 $ touch f
1010 $ touch f
1004 $ hg ci -Aqmf
1011 $ hg ci -Aqmf
1005 $ echo >> f
1012 $ echo >> f
1006 $ hg ci -Amf
1013 $ hg ci -Amf
1007 $ hg branch -q branch
1014 $ hg branch -q branch
1008 $ hg ci -Amf
1015 $ hg ci -Amf
1009
1016
1010 #if v2
1017 #if v2
1011
1018
1012 $ f --size --sha256 .hg/cache/rbc-*
1019 $ f --size --sha256 .hg/cache/rbc-*
1013 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1020 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1014 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1021 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1015
1022
1016 $ : > .hg/cache/rbc-revs-v2
1023 $ : > .hg/cache/rbc-revs-v2
1017
1024
1018 No superfluous rebuilding of cache:
1025 No superfluous rebuilding of cache:
1019 $ hg log -r "branch(null)&branch(branch)" --debug
1026 $ hg log -r "branch(null)&branch(branch)" --debug
1020 $ f --size --sha256 .hg/cache/rbc-*
1027 $ f --size --sha256 .hg/cache/rbc-*
1021 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1028 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1022 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1029 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1023 #endif
1030 #endif
1024
1031
1025 $ cd ..
1032 $ cd ..
1026
1033
1027 Test to make sure that `--close-branch` only works on a branch head:
1034 Test to make sure that `--close-branch` only works on a branch head:
1028 --------------------------------------------------------------------
1035 --------------------------------------------------------------------
1029 $ hg init closebranch
1036 $ hg init closebranch
1030 $ cd closebranch
1037 $ cd closebranch
1031 $ for ch in a b c; do
1038 $ for ch in a b c; do
1032 > echo $ch > $ch
1039 > echo $ch > $ch
1033 > hg add $ch
1040 > hg add $ch
1034 > hg ci -m "added "$ch
1041 > hg ci -m "added "$ch
1035 > done;
1042 > done;
1036
1043
1037 $ hg up -r "desc('added b')"
1044 $ hg up -r "desc('added b')"
1038 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1045 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1039
1046
1040 trying to close branch from a cset which is not a branch head
1047 trying to close branch from a cset which is not a branch head
1041 it should abort:
1048 it should abort:
1042 $ hg ci -m "closing branch" --close-branch
1049 $ hg ci -m "closing branch" --close-branch
1043 abort: can only close branch heads
1050 abort: can only close branch heads
1044 (use --force-close-branch to close branch from a non-head changeset)
1051 (use --force-close-branch to close branch from a non-head changeset)
1045 [10]
1052 [10]
1046
1053
1047 $ hg up 0
1054 $ hg up 0
1048 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1055 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1049 $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
1056 $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
1050 o 2: 155349b645be added c
1057 o 2: 155349b645be added c
1051 | default
1058 | default
1052 |
1059 |
1053 o 1: 5f6d8a4bf34a added b
1060 o 1: 5f6d8a4bf34a added b
1054 | default
1061 | default
1055 |
1062 |
1056 @ 0: 9092f1db7931 added a
1063 @ 0: 9092f1db7931 added a
1057 default
1064 default
1058
1065
1059 Test --force-close-branch to close a branch from a non-head changeset:
1066 Test --force-close-branch to close a branch from a non-head changeset:
1060 ---------------------------------------------------------------------
1067 ---------------------------------------------------------------------
1061
1068
1062 $ hg show stack --config extensions.show=
1069 $ hg show stack --config extensions.show=
1063 o 1553 added c
1070 o 1553 added c
1064 o 5f6d added b
1071 o 5f6d added b
1065 @ 9092 added a
1072 @ 9092 added a
1066
1073
1067 $ hg ci -m "branch closed" --close-branch
1074 $ hg ci -m "branch closed" --close-branch
1068 abort: can only close branch heads
1075 abort: can only close branch heads
1069 (use --force-close-branch to close branch from a non-head changeset)
1076 (use --force-close-branch to close branch from a non-head changeset)
1070 [10]
1077 [10]
1071
1078
1072 $ hg ci -m "branch closed" --force-close-branch
1079 $ hg ci -m "branch closed" --force-close-branch
1073 created new head
1080 created new head
1074 $ cd ..
1081 $ cd ..
1075
1082
1076 Test various special cases for the branchmap
1083 Test various special cases for the branchmap
1077 --------------------------------------------
1084 --------------------------------------------
1078
1085
1079 Basic fork of the same branch
1086 Basic fork of the same branch
1080
1087
1081 $ hg init branchmap-testing1
1088 $ hg init branchmap-testing1
1082 $ cd branchmap-testing1
1089 $ cd branchmap-testing1
1083 $ hg debugbuild '@A . :base . :p1 *base /p1'
1090 $ hg debugbuild '@A . :base . :p1 *base /p1'
1084 $ hg log -G
1091 $ hg log -G
1085 o changeset: 3:71ca9a6d524e
1092 o changeset: 3:71ca9a6d524e
1086 |\ branch: A
1093 |\ branch: A
1087 | | tag: tip
1094 | | tag: tip
1088 | | parent: 2:a3b807b3ff0b
1095 | | parent: 2:a3b807b3ff0b
1089 | | parent: 1:99ba08759bc7
1096 | | parent: 1:99ba08759bc7
1090 | | user: debugbuilddag
1097 | | user: debugbuilddag
1091 | | date: Thu Jan 01 00:00:03 1970 +0000
1098 | | date: Thu Jan 01 00:00:03 1970 +0000
1092 | | summary: r3
1099 | | summary: r3
1093 | |
1100 | |
1094 | o changeset: 2:a3b807b3ff0b
1101 | o changeset: 2:a3b807b3ff0b
1095 | | branch: A
1102 | | branch: A
1096 | | parent: 0:2ab8003a1750
1103 | | parent: 0:2ab8003a1750
1097 | | user: debugbuilddag
1104 | | user: debugbuilddag
1098 | | date: Thu Jan 01 00:00:02 1970 +0000
1105 | | date: Thu Jan 01 00:00:02 1970 +0000
1099 | | summary: r2
1106 | | summary: r2
1100 | |
1107 | |
1101 o | changeset: 1:99ba08759bc7
1108 o | changeset: 1:99ba08759bc7
1102 |/ branch: A
1109 |/ branch: A
1103 | tag: p1
1110 | tag: p1
1104 | user: debugbuilddag
1111 | user: debugbuilddag
1105 | date: Thu Jan 01 00:00:01 1970 +0000
1112 | date: Thu Jan 01 00:00:01 1970 +0000
1106 | summary: r1
1113 | summary: r1
1107 |
1114 |
1108 o changeset: 0:2ab8003a1750
1115 o changeset: 0:2ab8003a1750
1109 branch: A
1116 branch: A
1110 tag: base
1117 tag: base
1111 user: debugbuilddag
1118 user: debugbuilddag
1112 date: Thu Jan 01 00:00:00 1970 +0000
1119 date: Thu Jan 01 00:00:00 1970 +0000
1113 summary: r0
1120 summary: r0
1114
1121
1115 $ hg branches
1122 $ hg branches
1116 A 3:71ca9a6d524e
1123 A 3:71ca9a6d524e
1117 $ hg clone -r 1 -r 2 . ../branchmap-testing1-clone
1124 $ hg clone -r 1 -r 2 . ../branchmap-testing1-clone
1118 adding changesets
1125 adding changesets
1119 adding manifests
1126 adding manifests
1120 adding file changes
1127 adding file changes
1121 added 3 changesets with 0 changes to 0 files (+1 heads)
1128 added 3 changesets with 0 changes to 0 files (+1 heads)
1122 new changesets 2ab8003a1750:a3b807b3ff0b
1129 new changesets 2ab8003a1750:a3b807b3ff0b
1123 updating to branch A
1130 updating to branch A
1124 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1131 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1125 $ cd ../branchmap-testing1-clone
1132 $ cd ../branchmap-testing1-clone
1126 $ hg pull ../branchmap-testing1
1133 $ hg pull ../branchmap-testing1
1127 pulling from ../branchmap-testing1
1134 pulling from ../branchmap-testing1
1128 searching for changes
1135 searching for changes
1129 adding changesets
1136 adding changesets
1130 adding manifests
1137 adding manifests
1131 adding file changes
1138 adding file changes
1132 added 1 changesets with 0 changes to 0 files (-1 heads)
1139 added 1 changesets with 0 changes to 0 files (-1 heads)
1133 new changesets 71ca9a6d524e
1140 new changesets 71ca9a6d524e
1134 (run 'hg update' to get a working copy)
1141 (run 'hg update' to get a working copy)
1135 $ hg branches
1142 $ hg branches
1136 A 3:71ca9a6d524e
1143 A 3:71ca9a6d524e
1137 $ cd ..
1144 $ cd ..
1138
1145
1139 Switching to a different branch and back
1146 Switching to a different branch and back
1140
1147
1141 $ hg init branchmap-testing2
1148 $ hg init branchmap-testing2
1142 $ cd branchmap-testing2
1149 $ cd branchmap-testing2
1143 $ hg debugbuild '@A . @B . @A .'
1150 $ hg debugbuild '@A . @B . @A .'
1144 $ hg log -G
1151 $ hg log -G
1145 o changeset: 2:9699e9f260b5
1152 o changeset: 2:9699e9f260b5
1146 | branch: A
1153 | branch: A
1147 | tag: tip
1154 | tag: tip
1148 | user: debugbuilddag
1155 | user: debugbuilddag
1149 | date: Thu Jan 01 00:00:02 1970 +0000
1156 | date: Thu Jan 01 00:00:02 1970 +0000
1150 | summary: r2
1157 | summary: r2
1151 |
1158 |
1152 o changeset: 1:0bc7d348d965
1159 o changeset: 1:0bc7d348d965
1153 | branch: B
1160 | branch: B
1154 | user: debugbuilddag
1161 | user: debugbuilddag
1155 | date: Thu Jan 01 00:00:01 1970 +0000
1162 | date: Thu Jan 01 00:00:01 1970 +0000
1156 | summary: r1
1163 | summary: r1
1157 |
1164 |
1158 o changeset: 0:2ab8003a1750
1165 o changeset: 0:2ab8003a1750
1159 branch: A
1166 branch: A
1160 user: debugbuilddag
1167 user: debugbuilddag
1161 date: Thu Jan 01 00:00:00 1970 +0000
1168 date: Thu Jan 01 00:00:00 1970 +0000
1162 summary: r0
1169 summary: r0
1163
1170
1164 $ hg branches
1171 $ hg branches
1165 A 2:9699e9f260b5
1172 A 2:9699e9f260b5
1166 B 1:0bc7d348d965 (inactive)
1173 B 1:0bc7d348d965 (inactive)
1167 $ hg clone -r 1 . ../branchmap-testing2-clone
1174 $ hg clone -r 1 . ../branchmap-testing2-clone
1168 adding changesets
1175 adding changesets
1169 adding manifests
1176 adding manifests
1170 adding file changes
1177 adding file changes
1171 added 2 changesets with 0 changes to 0 files
1178 added 2 changesets with 0 changes to 0 files
1172 new changesets 2ab8003a1750:0bc7d348d965
1179 new changesets 2ab8003a1750:0bc7d348d965
1173 updating to branch B
1180 updating to branch B
1174 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1175 $ cd ../branchmap-testing2-clone
1182 $ cd ../branchmap-testing2-clone
1176 $ hg pull ../branchmap-testing2
1183 $ hg pull ../branchmap-testing2
1177 pulling from ../branchmap-testing2
1184 pulling from ../branchmap-testing2
1178 searching for changes
1185 searching for changes
1179 adding changesets
1186 adding changesets
1180 adding manifests
1187 adding manifests
1181 adding file changes
1188 adding file changes
1182 added 1 changesets with 0 changes to 0 files
1189 added 1 changesets with 0 changes to 0 files
1183 new changesets 9699e9f260b5
1190 new changesets 9699e9f260b5
1184 (run 'hg update' to get a working copy)
1191 (run 'hg update' to get a working copy)
1185 $ hg branches
1192 $ hg branches
1186 A 2:9699e9f260b5
1193 A 2:9699e9f260b5
1187 B 1:0bc7d348d965 (inactive)
1194 B 1:0bc7d348d965 (inactive)
1188 $ cd ..
1195 $ cd ..
1189
1196
1190 A fork on a branch switching to a different branch and back
1197 A fork on a branch switching to a different branch and back
1191 is still collecting the fork.
1198 is still collecting the fork.
1192
1199
1193 $ hg init branchmap-testing3
1200 $ hg init branchmap-testing3
1194 $ cd branchmap-testing3
1201 $ cd branchmap-testing3
1195 $ hg debugbuild '@A . :base . :p1 *base @B . @A /p1'
1202 $ hg debugbuild '@A . :base . :p1 *base @B . @A /p1'
1196 $ hg log -G
1203 $ hg log -G
1197 o changeset: 4:3614a1711d23
1204 o changeset: 4:3614a1711d23
1198 |\ branch: A
1205 |\ branch: A
1199 | | tag: tip
1206 | | tag: tip
1200 | | parent: 3:e9c8abcf65aa
1207 | | parent: 3:e9c8abcf65aa
1201 | | parent: 1:99ba08759bc7
1208 | | parent: 1:99ba08759bc7
1202 | | user: debugbuilddag
1209 | | user: debugbuilddag
1203 | | date: Thu Jan 01 00:00:04 1970 +0000
1210 | | date: Thu Jan 01 00:00:04 1970 +0000
1204 | | summary: r4
1211 | | summary: r4
1205 | |
1212 | |
1206 | o changeset: 3:e9c8abcf65aa
1213 | o changeset: 3:e9c8abcf65aa
1207 | | branch: B
1214 | | branch: B
1208 | | user: debugbuilddag
1215 | | user: debugbuilddag
1209 | | date: Thu Jan 01 00:00:03 1970 +0000
1216 | | date: Thu Jan 01 00:00:03 1970 +0000
1210 | | summary: r3
1217 | | summary: r3
1211 | |
1218 | |
1212 | o changeset: 2:a3b807b3ff0b
1219 | o changeset: 2:a3b807b3ff0b
1213 | | branch: A
1220 | | branch: A
1214 | | parent: 0:2ab8003a1750
1221 | | parent: 0:2ab8003a1750
1215 | | user: debugbuilddag
1222 | | user: debugbuilddag
1216 | | date: Thu Jan 01 00:00:02 1970 +0000
1223 | | date: Thu Jan 01 00:00:02 1970 +0000
1217 | | summary: r2
1224 | | summary: r2
1218 | |
1225 | |
1219 o | changeset: 1:99ba08759bc7
1226 o | changeset: 1:99ba08759bc7
1220 |/ branch: A
1227 |/ branch: A
1221 | tag: p1
1228 | tag: p1
1222 | user: debugbuilddag
1229 | user: debugbuilddag
1223 | date: Thu Jan 01 00:00:01 1970 +0000
1230 | date: Thu Jan 01 00:00:01 1970 +0000
1224 | summary: r1
1231 | summary: r1
1225 |
1232 |
1226 o changeset: 0:2ab8003a1750
1233 o changeset: 0:2ab8003a1750
1227 branch: A
1234 branch: A
1228 tag: base
1235 tag: base
1229 user: debugbuilddag
1236 user: debugbuilddag
1230 date: Thu Jan 01 00:00:00 1970 +0000
1237 date: Thu Jan 01 00:00:00 1970 +0000
1231 summary: r0
1238 summary: r0
1232
1239
1233 $ hg branches
1240 $ hg branches
1234 A 4:3614a1711d23
1241 A 4:3614a1711d23
1235 B 3:e9c8abcf65aa (inactive)
1242 B 3:e9c8abcf65aa (inactive)
1236 $ hg clone -r 1 -r 3 . ../branchmap-testing3-clone
1243 $ hg clone -r 1 -r 3 . ../branchmap-testing3-clone
1237 adding changesets
1244 adding changesets
1238 adding manifests
1245 adding manifests
1239 adding file changes
1246 adding file changes
1240 added 4 changesets with 0 changes to 0 files (+1 heads)
1247 added 4 changesets with 0 changes to 0 files (+1 heads)
1241 new changesets 2ab8003a1750:e9c8abcf65aa
1248 new changesets 2ab8003a1750:e9c8abcf65aa
1242 updating to branch A
1249 updating to branch A
1243 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1244 $ cd ../branchmap-testing3-clone
1251 $ cd ../branchmap-testing3-clone
1245 $ hg pull ../branchmap-testing3
1252 $ hg pull ../branchmap-testing3
1246 pulling from ../branchmap-testing3
1253 pulling from ../branchmap-testing3
1247 searching for changes
1254 searching for changes
1248 adding changesets
1255 adding changesets
1249 adding manifests
1256 adding manifests
1250 adding file changes
1257 adding file changes
1251 added 1 changesets with 0 changes to 0 files (-1 heads)
1258 added 1 changesets with 0 changes to 0 files (-1 heads)
1252 new changesets 3614a1711d23
1259 new changesets 3614a1711d23
1253 (run 'hg update' to get a working copy)
1260 (run 'hg update' to get a working copy)
1254 $ hg branches
1261 $ hg branches
1255 A 4:3614a1711d23
1262 A 4:3614a1711d23
1256 B 3:e9c8abcf65aa (inactive)
1263 B 3:e9c8abcf65aa (inactive)
1257 $ cd ..
1264 $ cd ..
1258
1265
1259 Intermediary parents are on different branches.
1266 Intermediary parents are on different branches.
1260
1267
1261 $ hg init branchmap-testing4
1268 $ hg init branchmap-testing4
1262 $ cd branchmap-testing4
1269 $ cd branchmap-testing4
1263 $ hg debugbuild '@A . @B :base . @A :p1 *base @C . @A /p1'
1270 $ hg debugbuild '@A . @B :base . @A :p1 *base @C . @A /p1'
1264 $ hg log -G
1271 $ hg log -G
1265 o changeset: 4:4bf67499b70a
1272 o changeset: 4:4bf67499b70a
1266 |\ branch: A
1273 |\ branch: A
1267 | | tag: tip
1274 | | tag: tip
1268 | | parent: 3:4a546028fa8f
1275 | | parent: 3:4a546028fa8f
1269 | | parent: 1:0bc7d348d965
1276 | | parent: 1:0bc7d348d965
1270 | | user: debugbuilddag
1277 | | user: debugbuilddag
1271 | | date: Thu Jan 01 00:00:04 1970 +0000
1278 | | date: Thu Jan 01 00:00:04 1970 +0000
1272 | | summary: r4
1279 | | summary: r4
1273 | |
1280 | |
1274 | o changeset: 3:4a546028fa8f
1281 | o changeset: 3:4a546028fa8f
1275 | | branch: C
1282 | | branch: C
1276 | | user: debugbuilddag
1283 | | user: debugbuilddag
1277 | | date: Thu Jan 01 00:00:03 1970 +0000
1284 | | date: Thu Jan 01 00:00:03 1970 +0000
1278 | | summary: r3
1285 | | summary: r3
1279 | |
1286 | |
1280 | o changeset: 2:a3b807b3ff0b
1287 | o changeset: 2:a3b807b3ff0b
1281 | | branch: A
1288 | | branch: A
1282 | | parent: 0:2ab8003a1750
1289 | | parent: 0:2ab8003a1750
1283 | | user: debugbuilddag
1290 | | user: debugbuilddag
1284 | | date: Thu Jan 01 00:00:02 1970 +0000
1291 | | date: Thu Jan 01 00:00:02 1970 +0000
1285 | | summary: r2
1292 | | summary: r2
1286 | |
1293 | |
1287 o | changeset: 1:0bc7d348d965
1294 o | changeset: 1:0bc7d348d965
1288 |/ branch: B
1295 |/ branch: B
1289 | tag: p1
1296 | tag: p1
1290 | user: debugbuilddag
1297 | user: debugbuilddag
1291 | date: Thu Jan 01 00:00:01 1970 +0000
1298 | date: Thu Jan 01 00:00:01 1970 +0000
1292 | summary: r1
1299 | summary: r1
1293 |
1300 |
1294 o changeset: 0:2ab8003a1750
1301 o changeset: 0:2ab8003a1750
1295 branch: A
1302 branch: A
1296 tag: base
1303 tag: base
1297 user: debugbuilddag
1304 user: debugbuilddag
1298 date: Thu Jan 01 00:00:00 1970 +0000
1305 date: Thu Jan 01 00:00:00 1970 +0000
1299 summary: r0
1306 summary: r0
1300
1307
1301 $ hg branches
1308 $ hg branches
1302 A 4:4bf67499b70a
1309 A 4:4bf67499b70a
1303 C 3:4a546028fa8f (inactive)
1310 C 3:4a546028fa8f (inactive)
1304 B 1:0bc7d348d965 (inactive)
1311 B 1:0bc7d348d965 (inactive)
1305 $ hg clone -r 1 -r 3 . ../branchmap-testing4-clone
1312 $ hg clone -r 1 -r 3 . ../branchmap-testing4-clone
1306 adding changesets
1313 adding changesets
1307 adding manifests
1314 adding manifests
1308 adding file changes
1315 adding file changes
1309 added 4 changesets with 0 changes to 0 files (+1 heads)
1316 added 4 changesets with 0 changes to 0 files (+1 heads)
1310 new changesets 2ab8003a1750:4a546028fa8f
1317 new changesets 2ab8003a1750:4a546028fa8f
1311 updating to branch B
1318 updating to branch B
1312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1319 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1313 $ cd ../branchmap-testing4-clone
1320 $ cd ../branchmap-testing4-clone
1314 $ hg pull ../branchmap-testing4
1321 $ hg pull ../branchmap-testing4
1315 pulling from ../branchmap-testing4
1322 pulling from ../branchmap-testing4
1316 searching for changes
1323 searching for changes
1317 adding changesets
1324 adding changesets
1318 adding manifests
1325 adding manifests
1319 adding file changes
1326 adding file changes
1320 added 1 changesets with 0 changes to 0 files (-1 heads)
1327 added 1 changesets with 0 changes to 0 files (-1 heads)
1321 new changesets 4bf67499b70a
1328 new changesets 4bf67499b70a
1322 (run 'hg update' to get a working copy)
1329 (run 'hg update' to get a working copy)
1323 $ hg branches
1330 $ hg branches
1324 A 4:4bf67499b70a
1331 A 4:4bf67499b70a
1325 C 3:4a546028fa8f (inactive)
1332 C 3:4a546028fa8f (inactive)
1326 B 1:0bc7d348d965 (inactive)
1333 B 1:0bc7d348d965 (inactive)
1327 $ cd ..
1334 $ cd ..
1328
1335
1329 Check that the cache are not written too early
1336 Check that the cache are not written too early
1330 ----------------------------------------------
1337 ----------------------------------------------
1331
1338
1332 $ hg log -R branchmap-testing1 -G
1339 $ hg log -R branchmap-testing1 -G
1333 o changeset: 3:71ca9a6d524e
1340 o changeset: 3:71ca9a6d524e
1334 |\ branch: A
1341 |\ branch: A
1335 | | tag: tip
1342 | | tag: tip
1336 | | parent: 2:a3b807b3ff0b
1343 | | parent: 2:a3b807b3ff0b
1337 | | parent: 1:99ba08759bc7
1344 | | parent: 1:99ba08759bc7
1338 | | user: debugbuilddag
1345 | | user: debugbuilddag
1339 | | date: Thu Jan 01 00:00:03 1970 +0000
1346 | | date: Thu Jan 01 00:00:03 1970 +0000
1340 | | summary: r3
1347 | | summary: r3
1341 | |
1348 | |
1342 | o changeset: 2:a3b807b3ff0b
1349 | o changeset: 2:a3b807b3ff0b
1343 | | branch: A
1350 | | branch: A
1344 | | parent: 0:2ab8003a1750
1351 | | parent: 0:2ab8003a1750
1345 | | user: debugbuilddag
1352 | | user: debugbuilddag
1346 | | date: Thu Jan 01 00:00:02 1970 +0000
1353 | | date: Thu Jan 01 00:00:02 1970 +0000
1347 | | summary: r2
1354 | | summary: r2
1348 | |
1355 | |
1349 o | changeset: 1:99ba08759bc7
1356 o | changeset: 1:99ba08759bc7
1350 |/ branch: A
1357 |/ branch: A
1351 | tag: p1
1358 | tag: p1
1352 | user: debugbuilddag
1359 | user: debugbuilddag
1353 | date: Thu Jan 01 00:00:01 1970 +0000
1360 | date: Thu Jan 01 00:00:01 1970 +0000
1354 | summary: r1
1361 | summary: r1
1355 |
1362 |
1356 o changeset: 0:2ab8003a1750
1363 o changeset: 0:2ab8003a1750
1357 branch: A
1364 branch: A
1358 tag: base
1365 tag: base
1359 user: debugbuilddag
1366 user: debugbuilddag
1360 date: Thu Jan 01 00:00:00 1970 +0000
1367 date: Thu Jan 01 00:00:00 1970 +0000
1361 summary: r0
1368 summary: r0
1362
1369
1363 $ hg bundle -R branchmap-testing1 --base 1 bundle.hg --rev 'head()'
1370 $ hg bundle -R branchmap-testing1 --base 1 bundle.hg --rev 'head()'
1364 2 changesets found
1371 2 changesets found
1365
1372
1366 Unbundling revision should warm the served cache
1373 Unbundling revision should warm the served cache
1367
1374
1368 $ hg clone branchmap-testing1 --rev 1 branchmap-update-01
1375 $ hg clone branchmap-testing1 --rev 1 branchmap-update-01
1369 adding changesets
1376 adding changesets
1370 adding manifests
1377 adding manifests
1371 adding file changes
1378 adding file changes
1372 added 2 changesets with 0 changes to 0 files
1379 added 2 changesets with 0 changes to 0 files
1373 new changesets 2ab8003a1750:99ba08759bc7
1380 new changesets 2ab8003a1750:99ba08759bc7
1374 updating to branch A
1381 updating to branch A
1375 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1382 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1376 #if v3
1383 #if v3
1377 $ cat branchmap-update-01/.hg/cache/branch3-exp-base
1384 $ cat branchmap-update-01/.hg/cache/branch3-exp-base
1378 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1385 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1379 A
1386 A
1380 #else
1387 #else
1381 $ cat branchmap-update-01/.hg/cache/branch2-base
1388 $ cat branchmap-update-01/.hg/cache/branch2-base
1382 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1389 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1383 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1390 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1384 #endif
1391 #endif
1385 $ hg -R branchmap-update-01 unbundle bundle.hg
1392 $ hg -R branchmap-update-01 unbundle bundle.hg
1386 adding changesets
1393 adding changesets
1387 adding manifests
1394 adding manifests
1388 adding file changes
1395 adding file changes
1389 added 2 changesets with 0 changes to 0 files
1396 added 2 changesets with 0 changes to 0 files
1390 new changesets a3b807b3ff0b:71ca9a6d524e (2 drafts)
1397 new changesets a3b807b3ff0b:71ca9a6d524e (2 drafts)
1391 (run 'hg update' to get a working copy)
1398 (run 'hg update' to get a working copy)
1392 #if v3
1399 #if v3
1393 $ cat branchmap-update-01/.hg/cache/branch3-exp-served
1400 $ cat branchmap-update-01/.hg/cache/branch3-exp-served
1394 tip-node=71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 tip-rev=3 topo-mode=pure
1401 tip-node=71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 tip-rev=3 topo-mode=pure
1395 A
1402 A
1396 #else
1403 #else
1397 $ cat branchmap-update-01/.hg/cache/branch2-served
1404 $ cat branchmap-update-01/.hg/cache/branch2-served
1398 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 3
1405 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 3
1399 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 o A
1406 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 o A
1400 #endif
1407 #endif
1401
1408
1402 aborted Unbundle should not update the on disk cache
1409 aborted Unbundle should not update the on disk cache
1403
1410
1404 $ cat >> simplehook.py << EOF
1411 $ cat >> simplehook.py << EOF
1405 > import sys
1412 > import sys
1406 > from mercurial import node
1413 > from mercurial import node
1407 > from mercurial import branchmap
1414 > from mercurial import branchmap
1408 > def hook(ui, repo, *args, **kwargs):
1415 > def hook(ui, repo, *args, **kwargs):
1409 > s = repo.filtered(b"served")
1416 > s = repo.filtered(b"served")
1410 > s.branchmap()
1417 > s.branchmap()
1411 > return 1
1418 > return 1
1412 > EOF
1419 > EOF
1413 $ hg clone branchmap-testing1 --rev 1 branchmap-update-02
1420 $ hg clone branchmap-testing1 --rev 1 branchmap-update-02
1414 adding changesets
1421 adding changesets
1415 adding manifests
1422 adding manifests
1416 adding file changes
1423 adding file changes
1417 added 2 changesets with 0 changes to 0 files
1424 added 2 changesets with 0 changes to 0 files
1418 new changesets 2ab8003a1750:99ba08759bc7
1425 new changesets 2ab8003a1750:99ba08759bc7
1419 updating to branch A
1426 updating to branch A
1420 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1427 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1421
1428
1422 #if v3
1429 #if v3
1423 $ cat branchmap-update-02/.hg/cache/branch3-exp-base
1430 $ cat branchmap-update-02/.hg/cache/branch3-exp-base
1424 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1431 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1425 A
1432 A
1426 #else
1433 #else
1427 $ cat branchmap-update-02/.hg/cache/branch2-base
1434 $ cat branchmap-update-02/.hg/cache/branch2-base
1428 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1435 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1429 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1436 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1430 #endif
1437 #endif
1431 $ hg -R branchmap-update-02 unbundle bundle.hg --config "hooks.pretxnclose=python:$TESTTMP/simplehook.py:hook"
1438 $ hg -R branchmap-update-02 unbundle bundle.hg --config "hooks.pretxnclose=python:$TESTTMP/simplehook.py:hook"
1432 adding changesets
1439 adding changesets
1433 adding manifests
1440 adding manifests
1434 adding file changes
1441 adding file changes
1435 transaction abort!
1442 transaction abort!
1436 rollback completed
1443 rollback completed
1437 abort: pretxnclose hook failed
1444 abort: pretxnclose hook failed
1438 [40]
1445 [40]
1439 #if v3
1446 #if v3
1440 $ cat branchmap-update-02/.hg/cache/branch3-exp-base
1447 $ cat branchmap-update-02/.hg/cache/branch3-exp-base
1441 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1448 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1442 A
1449 A
1443 #else
1450 #else
1444 $ cat branchmap-update-02/.hg/cache/branch2-base
1451 $ cat branchmap-update-02/.hg/cache/branch2-base
1445 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1452 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1446 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1453 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1447 #endif
1454 #endif
@@ -1,500 +1,500
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
4 > drawdag=$TESTDIR/drawdag.py
5 >
5 >
6 > [phases]
6 > [phases]
7 > publish=False
7 > publish=False
8 >
8 >
9 > [alias]
9 > [alias]
10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
11 > EOF
11 > EOF
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15 $ echo c1 >common
15 $ echo c1 >common
16 $ hg add common
16 $ hg add common
17 $ hg ci -m C1
17 $ hg ci -m C1
18
18
19 $ echo c2 >>common
19 $ echo c2 >>common
20 $ hg ci -m C2
20 $ hg ci -m C2
21
21
22 $ echo c3 >>common
22 $ echo c3 >>common
23 $ hg ci -m C3
23 $ hg ci -m C3
24
24
25 $ hg up -q -C 1
25 $ hg up -q -C 1
26
26
27 $ echo l1 >>extra
27 $ echo l1 >>extra
28 $ hg add extra
28 $ hg add extra
29 $ hg ci -m L1
29 $ hg ci -m L1
30 created new head
30 created new head
31
31
32 $ sed -e 's/c2/l2/' common > common.new
32 $ sed -e 's/c2/l2/' common > common.new
33 $ mv common.new common
33 $ mv common.new common
34 $ hg ci -m L2
34 $ hg ci -m L2
35
35
36 $ echo l3 >> extra2
36 $ echo l3 >> extra2
37 $ hg add extra2
37 $ hg add extra2
38 $ hg ci -m L3
38 $ hg ci -m L3
39 $ hg bookmark mybook
39 $ hg bookmark mybook
40
40
41 $ hg phase --force --secret 4
41 $ hg phase --force --secret 4
42
42
43 $ hg tglog
43 $ hg tglog
44 @ 5:secret 'L3' mybook
44 @ 5:secret 'L3' mybook
45 |
45 |
46 o 4:secret 'L2'
46 o 4:secret 'L2'
47 |
47 |
48 o 3:draft 'L1'
48 o 3:draft 'L1'
49 |
49 |
50 | o 2:draft 'C3'
50 | o 2:draft 'C3'
51 |/
51 |/
52 o 1:draft 'C2'
52 o 1:draft 'C2'
53 |
53 |
54 o 0:draft 'C1'
54 o 0:draft 'C1'
55
55
56 Try to call --continue:
56 Try to call --continue:
57
57
58 $ hg rebase --continue
58 $ hg rebase --continue
59 abort: no rebase in progress
59 abort: no rebase in progress
60 [20]
60 [20]
61
61
62 Conflicting rebase:
62 Conflicting rebase:
63
63
64 $ hg rebase -s 3 -d 2
64 $ hg rebase -s 3 -d 2
65 rebasing 3:3163e20567cc "L1"
65 rebasing 3:3163e20567cc "L1"
66 rebasing 4:46f0b057b5c0 "L2"
66 rebasing 4:46f0b057b5c0 "L2"
67 merging common
67 merging common
68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
70 [240]
70 [240]
71
71
72 $ hg status --config commands.status.verbose=1
72 $ hg status --config commands.status.verbose=1
73 M common
73 M common
74 ? common.orig
74 ? common.orig
75 # The repository is in an unfinished *rebase* state.
75 # The repository is in an unfinished *rebase* state.
76
76
77 # Unresolved merge conflicts:
77 # Unresolved merge conflicts:
78 #
78 #
79 # common
79 # common
80 #
80 #
81 # To mark files as resolved: hg resolve --mark FILE
81 # To mark files as resolved: hg resolve --mark FILE
82
82
83 # To continue: hg rebase --continue
83 # To continue: hg rebase --continue
84 # To abort: hg rebase --abort
84 # To abort: hg rebase --abort
85 # To stop: hg rebase --stop
85 # To stop: hg rebase --stop
86
86
87
87
88 Try to continue without solving the conflict:
88 Try to continue without solving the conflict:
89
89
90 $ hg rebase --continue
90 $ hg rebase --continue
91 abort: unresolved merge conflicts (see 'hg help resolve')
91 abort: unresolved merge conflicts (see 'hg help resolve')
92 [20]
92 [20]
93
93
94 Conclude rebase:
94 Conclude rebase:
95
95
96 $ echo 'resolved merge' >common
96 $ echo 'resolved merge' >common
97 $ hg resolve -m common
97 $ hg resolve -m common
98 (no more unresolved files)
98 (no more unresolved files)
99 continue: hg rebase --continue
99 continue: hg rebase --continue
100 $ hg rebase --continue
100 $ hg rebase --continue
101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
102 rebasing 4:46f0b057b5c0 "L2"
102 rebasing 4:46f0b057b5c0 "L2"
103 rebasing 5:8029388f38dc mybook "L3"
103 rebasing 5:8029388f38dc mybook "L3"
104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
105
105
106 $ hg tglog
106 $ hg tglog
107 @ 5:secret 'L3' mybook
107 @ 5:secret 'L3' mybook
108 |
108 |
109 o 4:secret 'L2'
109 o 4:secret 'L2'
110 |
110 |
111 o 3:draft 'L1'
111 o 3:draft 'L1'
112 |
112 |
113 o 2:draft 'C3'
113 o 2:draft 'C3'
114 |
114 |
115 o 1:draft 'C2'
115 o 1:draft 'C2'
116 |
116 |
117 o 0:draft 'C1'
117 o 0:draft 'C1'
118
118
119 Check correctness:
119 Check correctness:
120
120
121 $ hg cat -r 0 common
121 $ hg cat -r 0 common
122 c1
122 c1
123
123
124 $ hg cat -r 1 common
124 $ hg cat -r 1 common
125 c1
125 c1
126 c2
126 c2
127
127
128 $ hg cat -r 2 common
128 $ hg cat -r 2 common
129 c1
129 c1
130 c2
130 c2
131 c3
131 c3
132
132
133 $ hg cat -r 3 common
133 $ hg cat -r 3 common
134 c1
134 c1
135 c2
135 c2
136 c3
136 c3
137
137
138 $ hg cat -r 4 common
138 $ hg cat -r 4 common
139 resolved merge
139 resolved merge
140
140
141 $ hg cat -r 5 common
141 $ hg cat -r 5 common
142 resolved merge
142 resolved merge
143
143
144 Bookmark stays active after --continue
144 Bookmark stays active after --continue
145 $ hg bookmarks
145 $ hg bookmarks
146 * mybook 5:d67b21408fc0
146 * mybook 5:d67b21408fc0
147
147
148 $ cd ..
148 $ cd ..
149
149
150 Check that the right ancestors is used while rebasing a merge (issue4041)
150 Check that the right ancestors is used while rebasing a merge (issue4041)
151
151
152 $ hg init issue4041
152 $ hg init issue4041
153 $ cd issue4041
153 $ cd issue4041
154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
155 adding changesets
155 adding changesets
156 adding manifests
156 adding manifests
157 adding file changes
157 adding file changes
158 added 11 changesets with 8 changes to 3 files (+1 heads)
158 added 11 changesets with 8 changes to 3 files (+1 heads)
159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
160 (run 'hg heads' to see heads)
160 (run 'hg heads' to see heads)
161 $ hg up default
161 $ hg up default
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 $ hg log -G
163 $ hg log -G
164 o changeset: 10:2f2496ddf49d
164 o changeset: 10:2f2496ddf49d
165 |\ branch: f1
165 |\ branch: f1
166 | | tag: tip
166 | | tag: tip
167 | | parent: 7:4c9fbe56a16f
167 | | parent: 7:4c9fbe56a16f
168 | | parent: 9:e31216eec445
168 | | parent: 9:e31216eec445
169 | | user: szhang
169 | | user: szhang
170 | | date: Thu Sep 05 12:59:39 2013 -0400
170 | | date: Thu Sep 05 12:59:39 2013 -0400
171 | | summary: merge
171 | | summary: merge
172 | |
172 | |
173 | o changeset: 9:e31216eec445
173 | o changeset: 9:e31216eec445
174 | | branch: f1
174 | | branch: f1
175 | | user: szhang
175 | | user: szhang
176 | | date: Thu Sep 05 12:59:10 2013 -0400
176 | | date: Thu Sep 05 12:59:10 2013 -0400
177 | | summary: more changes to f1
177 | | summary: more changes to f1
178 | |
178 | |
179 | o changeset: 8:8e4e2c1a07ae
179 | o changeset: 8:8e4e2c1a07ae
180 | |\ branch: f1
180 | |\ branch: f1
181 | | | parent: 2:4bc80088dc6b
181 | | | parent: 2:4bc80088dc6b
182 | | | parent: 6:400110238667
182 | | | parent: 6:400110238667
183 | | | user: szhang
183 | | | user: szhang
184 | | | date: Thu Sep 05 12:57:59 2013 -0400
184 | | | date: Thu Sep 05 12:57:59 2013 -0400
185 | | | summary: bad merge
185 | | | summary: bad merge
186 | | |
186 | | |
187 o | | changeset: 7:4c9fbe56a16f
187 o | | changeset: 7:4c9fbe56a16f
188 |/ / branch: f1
188 |/ / branch: f1
189 | | parent: 2:4bc80088dc6b
189 | | parent: 2:4bc80088dc6b
190 | | user: szhang
190 | | user: szhang
191 | | date: Thu Sep 05 12:54:00 2013 -0400
191 | | date: Thu Sep 05 12:54:00 2013 -0400
192 | | summary: changed f1
192 | | summary: changed f1
193 | |
193 | |
194 | o changeset: 6:400110238667
194 | o changeset: 6:400110238667
195 | | branch: f2
195 | | branch: f2
196 | | parent: 4:12e8ec6bb010
196 | | parent: 4:12e8ec6bb010
197 | | user: szhang
197 | | user: szhang
198 | | date: Tue Sep 03 13:58:02 2013 -0400
198 | | date: Tue Sep 03 13:58:02 2013 -0400
199 | | summary: changed f2 on f2
199 | | summary: changed f2 on f2
200 | |
200 | |
201 | | @ changeset: 5:d79e2059b5c0
201 | | @ changeset: 5:d79e2059b5c0
202 | | | parent: 3:8a951942e016
202 | | | parent: 3:8a951942e016
203 | | | user: szhang
203 | | | user: szhang
204 | | | date: Tue Sep 03 13:57:39 2013 -0400
204 | | | date: Tue Sep 03 13:57:39 2013 -0400
205 | | | summary: changed f2 on default
205 | | | summary: changed f2 on default
206 | | |
206 | | |
207 | o | changeset: 4:12e8ec6bb010
207 | o | changeset: 4:12e8ec6bb010
208 | |/ branch: f2
208 | |/ branch: f2
209 | | user: szhang
209 | | user: szhang
210 | | date: Tue Sep 03 13:57:18 2013 -0400
210 | | date: Tue Sep 03 13:57:18 2013 -0400
211 | | summary: created f2 branch
211 | | summary: created f2 branch
212 | |
212 | |
213 | o changeset: 3:8a951942e016
213 | o changeset: 3:8a951942e016
214 | | parent: 0:24797d4f68de
214 | | parent: 0:24797d4f68de
215 | | user: szhang
215 | | user: szhang
216 | | date: Tue Sep 03 13:57:11 2013 -0400
216 | | date: Tue Sep 03 13:57:11 2013 -0400
217 | | summary: added f2.txt
217 | | summary: added f2.txt
218 | |
218 | |
219 o | changeset: 2:4bc80088dc6b
219 o | changeset: 2:4bc80088dc6b
220 | | branch: f1
220 | | branch: f1
221 | | user: szhang
221 | | user: szhang
222 | | date: Tue Sep 03 13:56:20 2013 -0400
222 | | date: Tue Sep 03 13:56:20 2013 -0400
223 | | summary: added f1.txt
223 | | summary: added f1.txt
224 | |
224 | |
225 o | changeset: 1:ef53c9e6b608
225 o | changeset: 1:ef53c9e6b608
226 |/ branch: f1
226 |/ branch: f1
227 | user: szhang
227 | user: szhang
228 | date: Tue Sep 03 13:55:26 2013 -0400
228 | date: Tue Sep 03 13:55:26 2013 -0400
229 | summary: created f1 branch
229 | summary: created f1 branch
230 |
230 |
231 o changeset: 0:24797d4f68de
231 o changeset: 0:24797d4f68de
232 user: szhang
232 user: szhang
233 date: Tue Sep 03 13:55:08 2013 -0400
233 date: Tue Sep 03 13:55:08 2013 -0400
234 summary: added default.txt
234 summary: added default.txt
235
235
236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
237 rebase onto 4bc80088dc6b starting from e31216eec445
237 rebase onto 4bc80088dc6b starting from e31216eec445
238 rebasing on disk
238 rebasing on disk
239 rebase status stored
239 rebase status stored
240 rebasing 9:e31216eec445 "more changes to f1"
240 rebasing 9:e31216eec445 "more changes to f1"
241 future parents are 2 and -1
241 future parents are 2 and -1
242 update to 2:4bc80088dc6b
242 update to 2:4bc80088dc6b
243 resolving manifests
243 resolving manifests
244 branchmerge: False, force: True, partial: False
244 branchmerge: False, force: True, partial: False
245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
246 f2.txt: other deleted -> r
246 f2.txt: other deleted -> r
247 removing f2.txt
247 removing f2.txt
248 f1.txt: remote created -> g
248 f1.txt: remote created -> g
249 getting f1.txt
249 getting f1.txt
250 merge against 9:e31216eec445
250 merge against 9:e31216eec445
251 detach base 8:8e4e2c1a07ae
251 detach base 8:8e4e2c1a07ae
252 resolving manifests
252 resolving manifests
253 branchmerge: True, force: True, partial: False
253 branchmerge: True, force: True, partial: False
254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
255 f1.txt: remote is newer -> g
255 f1.txt: remote is newer -> g
256 getting f1.txt
256 getting f1.txt
257 committing files:
257 committing files:
258 f1.txt
258 f1.txt
259 committing manifest
259 committing manifest
260 committing changelog
260 committing changelog
261 updating the branch cache
261 updating the branch cache
262 rebased as 19c888675e13
262 rebased as 19c888675e13
263 rebase status stored
263 rebase status stored
264 rebasing 10:2f2496ddf49d tip "merge"
264 rebasing 10:2f2496ddf49d tip "merge"
265 future parents are 11 and 7
265 future parents are 11 and 7
266 already in destination
266 already in destination
267 merge against 10:2f2496ddf49d
267 merge against 10:2f2496ddf49d
268 detach base 9:e31216eec445
268 detach base 9:e31216eec445
269 resolving manifests
269 resolving manifests
270 branchmerge: True, force: True, partial: False
270 branchmerge: True, force: True, partial: False
271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
272 f1.txt: remote is newer -> g
272 f1.txt: remote is newer -> g
273 getting f1.txt
273 getting f1.txt
274 committing files:
274 committing files:
275 f1.txt
275 f1.txt
276 committing manifest
276 committing manifest
277 committing changelog
277 committing changelog
278 updating the branch cache
278 updating the branch cache
279 rebased as c1ffa3b5274e
279 rebased as c1ffa3b5274e
280 rebase status stored
280 rebase status stored
281 rebase merging completed
281 rebase merging completed
282 update back to initial working directory parent
282 update back to initial working directory parent
283 resolving manifests
283 resolving manifests
284 branchmerge: False, force: False, partial: False
284 branchmerge: False, force: False, partial: False
285 ancestor: c1ffa3b5274e, local: c1ffa3b5274e+, remote: d79e2059b5c0
285 ancestor: c1ffa3b5274e, local: c1ffa3b5274e+, remote: d79e2059b5c0
286 f1.txt: other deleted -> r
286 f1.txt: other deleted -> r
287 removing f1.txt
287 removing f1.txt
288 f2.txt: remote created -> g
288 f2.txt: remote created -> g
289 getting f2.txt
289 getting f2.txt
290 2 changesets found
290 2 changesets found
291 list of changesets:
291 list of changesets:
292 e31216eec445e44352c5f01588856059466a24c9
292 e31216eec445e44352c5f01588856059466a24c9
293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
297 bundle2-output-part: "phase-heads" 24 bytes payload
297 bundle2-output-part: "phase-heads" 24 bytes payload
298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
299 2 changesets found
299 2 changesets found
300 list of changesets:
300 list of changesets:
301 19c888675e133ab5dff84516926a65672eaf04d9
301 19c888675e133ab5dff84516926a65672eaf04d9
302 c1ffa3b5274e92a9388fe782854e295d2e8d0443
302 c1ffa3b5274e92a9388fe782854e295d2e8d0443
303 bundle2-output-bundle: "HG20", 3 parts total
303 bundle2-output-bundle: "HG20", 3 parts total
304 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
304 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
305 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
305 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
306 bundle2-output-part: "phase-heads" 24 bytes payload
306 bundle2-output-part: "phase-heads" 24 bytes payload
307 adding branch
307 adding branch
308 bundle2-input-bundle: with-transaction
308 bundle2-input-bundle: with-transaction
309 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
309 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
310 adding changesets
310 adding changesets
311 add changeset 19c888675e13
311 add changeset 19c888675e13
312 add changeset c1ffa3b5274e
312 add changeset c1ffa3b5274e
313 adding manifests
313 adding manifests
314 adding file changes
314 adding file changes
315 adding f1.txt revisions
315 adding f1.txt revisions
316 bundle2-input-part: total payload size 1255
316 bundle2-input-part: total payload size 1255
317 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
317 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
318 bundle2-input-part: total payload size 54
318 bundle2-input-part: total payload size 54
319 bundle2-input-part: "phase-heads" supported
319 bundle2-input-part: "phase-heads" supported
320 bundle2-input-part: total payload size 24
320 bundle2-input-part: total payload size 24
321 bundle2-input-bundle: 3 parts total
321 bundle2-input-bundle: 3 parts total
322 resetting content of cache/rbc-revs-v2
322 resetting content of rbc-names-v2
323 added 2 changesets with 2 changes to 1 files
323 added 2 changesets with 2 changes to 1 files
324 updating the branch cache
324 updating the branch cache
325 invalid branch cache (served): tip differs
325 invalid branch cache (served): tip differs
326 history modification detected - truncating revision branch cache to revision 1
326 history modification detected - truncating revision branch cache to revision 1
327 invalid branch cache (served.hidden): tip differs
327 invalid branch cache (served.hidden): tip differs
328 rebase completed
328 rebase completed
329 resetting content of cache/rbc-revs-v2
329 resetting content of cache/rbc-revs-v2
330
330
331 Test minimization of merge conflicts
331 Test minimization of merge conflicts
332 $ hg up -q null
332 $ hg up -q null
333 $ echo a > a
333 $ echo a > a
334 $ hg add a
334 $ hg add a
335 $ hg commit -q -m 'a'
335 $ hg commit -q -m 'a'
336 $ echo b >> a
336 $ echo b >> a
337 $ hg commit -q -m 'ab'
337 $ hg commit -q -m 'ab'
338 $ hg bookmark ab
338 $ hg bookmark ab
339 $ hg up -q '.^'
339 $ hg up -q '.^'
340 $ echo b >> a
340 $ echo b >> a
341 $ echo c >> a
341 $ echo c >> a
342 $ hg commit -q -m 'abc'
342 $ hg commit -q -m 'abc'
343 $ hg rebase -s 7bc217434fc1 -d ab --keep
343 $ hg rebase -s 7bc217434fc1 -d ab --keep
344 rebasing 13:7bc217434fc1 tip "abc"
344 rebasing 13:7bc217434fc1 tip "abc"
345 merging a
345 merging a
346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
348 [240]
348 [240]
349 $ hg diff
349 $ hg diff
350 diff -r 328e4ab1f7cc a
350 diff -r 328e4ab1f7cc a
351 --- a/a Thu Jan 01 00:00:00 1970 +0000
351 --- a/a Thu Jan 01 00:00:00 1970 +0000
352 +++ b/a * (glob)
352 +++ b/a * (glob)
353 @@ -1,2 +1,6 @@
353 @@ -1,2 +1,6 @@
354 a
354 a
355 b
355 b
356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
357 +=======
357 +=======
358 +c
358 +c
359 +>>>>>>> source: 7bc217434fc1 - test: abc
359 +>>>>>>> source: 7bc217434fc1 - test: abc
360 $ hg rebase --abort
360 $ hg rebase --abort
361 rebase aborted
361 rebase aborted
362 $ hg up -q -C 7bc217434fc1
362 $ hg up -q -C 7bc217434fc1
363 $ hg rebase -s . -d ab --keep -t internal:merge3
363 $ hg rebase -s . -d ab --keep -t internal:merge3
364 rebasing 13:7bc217434fc1 tip "abc"
364 rebasing 13:7bc217434fc1 tip "abc"
365 merging a
365 merging a
366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
368 [240]
368 [240]
369 $ hg diff
369 $ hg diff
370 diff -r 328e4ab1f7cc a
370 diff -r 328e4ab1f7cc a
371 --- a/a Thu Jan 01 00:00:00 1970 +0000
371 --- a/a Thu Jan 01 00:00:00 1970 +0000
372 +++ b/a * (glob)
372 +++ b/a * (glob)
373 @@ -1,2 +1,8 @@
373 @@ -1,2 +1,8 @@
374 a
374 a
375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
376 b
376 b
377 +||||||| parent of source: cb9a9f314b8b - test: a
377 +||||||| parent of source: cb9a9f314b8b - test: a
378 +=======
378 +=======
379 +b
379 +b
380 +c
380 +c
381 +>>>>>>> source: 7bc217434fc1 - test: abc
381 +>>>>>>> source: 7bc217434fc1 - test: abc
382
382
383 Test rebase with obsstore turned on and off (issue5606)
383 Test rebase with obsstore turned on and off (issue5606)
384
384
385 $ cd $TESTTMP
385 $ cd $TESTTMP
386 $ hg init b
386 $ hg init b
387 $ cd b
387 $ cd b
388 $ hg debugdrawdag <<'EOS'
388 $ hg debugdrawdag <<'EOS'
389 > D
389 > D
390 > |
390 > |
391 > C
391 > C
392 > |
392 > |
393 > B E
393 > B E
394 > |/
394 > |/
395 > A
395 > A
396 > EOS
396 > EOS
397
397
398 $ hg update E -q
398 $ hg update E -q
399 $ echo 3 > B
399 $ echo 3 > B
400 $ hg commit --amend -m E -A B -q
400 $ hg commit --amend -m E -A B -q
401 $ hg rebase -r B+D -d . --config experimental.evolution=true
401 $ hg rebase -r B+D -d . --config experimental.evolution=true
402 rebasing 1:112478962961 B "B"
402 rebasing 1:112478962961 B "B"
403 merging B
403 merging B
404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
406 [240]
406 [240]
407
407
408 $ echo 4 > B
408 $ echo 4 > B
409 $ hg resolve -m
409 $ hg resolve -m
410 (no more unresolved files)
410 (no more unresolved files)
411 continue: hg rebase --continue
411 continue: hg rebase --continue
412 $ hg rebase --continue --config experimental.evolution=none
412 $ hg rebase --continue --config experimental.evolution=none
413 rebasing 1:112478962961 B "B"
413 rebasing 1:112478962961 B "B"
414 rebasing 3:f585351a92f8 D "D"
414 rebasing 3:f585351a92f8 D "D"
415 warning: orphaned descendants detected, not stripping 112478962961
415 warning: orphaned descendants detected, not stripping 112478962961
416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
417
417
418 $ rm .hg/localtags
418 $ rm .hg/localtags
419 $ hg tglog
419 $ hg tglog
420 o 5:draft 'D'
420 o 5:draft 'D'
421 |
421 |
422 o 4:draft 'B'
422 o 4:draft 'B'
423 |
423 |
424 @ 3:draft 'E'
424 @ 3:draft 'E'
425 |
425 |
426 | o 2:draft 'C'
426 | o 2:draft 'C'
427 | |
427 | |
428 | o 1:draft 'B'
428 | o 1:draft 'B'
429 |/
429 |/
430 o 0:draft 'A'
430 o 0:draft 'A'
431
431
432
432
433 Test where the conflict happens when rebasing a merge commit
433 Test where the conflict happens when rebasing a merge commit
434
434
435 $ cd $TESTTMP
435 $ cd $TESTTMP
436 $ hg init conflict-in-merge
436 $ hg init conflict-in-merge
437 $ cd conflict-in-merge
437 $ cd conflict-in-merge
438 $ hg debugdrawdag <<'EOS'
438 $ hg debugdrawdag <<'EOS'
439 > F # F/conflict = foo\n
439 > F # F/conflict = foo\n
440 > |\
440 > |\
441 > D E
441 > D E
442 > |/
442 > |/
443 > C B # B/conflict = bar\n
443 > C B # B/conflict = bar\n
444 > |/
444 > |/
445 > A
445 > A
446 > EOS
446 > EOS
447
447
448 $ hg co F
448 $ hg co F
449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 $ hg rebase -d B
450 $ hg rebase -d B
451 rebasing 2:dc0947a82db8 C "C"
451 rebasing 2:dc0947a82db8 C "C"
452 rebasing 3:e7b3f00ed42e D "D"
452 rebasing 3:e7b3f00ed42e D "D"
453 rebasing 4:03ca77807e91 E "E"
453 rebasing 4:03ca77807e91 E "E"
454 rebasing 5:9a6b91dc2044 F tip "F"
454 rebasing 5:9a6b91dc2044 F tip "F"
455 merging conflict
455 merging conflict
456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
458 [240]
458 [240]
459 $ hg tglog
459 $ hg tglog
460 @ 8:draft 'E'
460 @ 8:draft 'E'
461 |
461 |
462 | @ 7:draft 'D'
462 | @ 7:draft 'D'
463 |/
463 |/
464 o 6:draft 'C'
464 o 6:draft 'C'
465 |
465 |
466 | % 5:draft 'F'
466 | % 5:draft 'F'
467 | |\
467 | |\
468 | | o 4:draft 'E'
468 | | o 4:draft 'E'
469 | | |
469 | | |
470 | o | 3:draft 'D'
470 | o | 3:draft 'D'
471 | |/
471 | |/
472 | o 2:draft 'C'
472 | o 2:draft 'C'
473 | |
473 | |
474 o | 1:draft 'B'
474 o | 1:draft 'B'
475 |/
475 |/
476 o 0:draft 'A'
476 o 0:draft 'A'
477
477
478 $ echo baz > conflict
478 $ echo baz > conflict
479 $ hg resolve -m
479 $ hg resolve -m
480 (no more unresolved files)
480 (no more unresolved files)
481 continue: hg rebase --continue
481 continue: hg rebase --continue
482 $ hg rebase -c
482 $ hg rebase -c
483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
486 rebasing 5:9a6b91dc2044 F "F"
486 rebasing 5:9a6b91dc2044 F "F"
487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
488 $ hg tglog
488 $ hg tglog
489 @ 5:draft 'F'
489 @ 5:draft 'F'
490 |\
490 |\
491 | o 4:draft 'E'
491 | o 4:draft 'E'
492 | |
492 | |
493 o | 3:draft 'D'
493 o | 3:draft 'D'
494 |/
494 |/
495 o 2:draft 'C'
495 o 2:draft 'C'
496 |
496 |
497 o 1:draft 'B'
497 o 1:draft 'B'
498 |
498 |
499 o 0:draft 'A'
499 o 0:draft 'A'
500
500
@@ -1,1459 +1,1459
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "strip=" >> $HGRCPATH
2 $ echo "strip=" >> $HGRCPATH
3 $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH
3 $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH
4
4
5 $ restore() {
5 $ restore() {
6 > hg unbundle -q .hg/strip-backup/*
6 > hg unbundle -q .hg/strip-backup/*
7 > rm .hg/strip-backup/*
7 > rm .hg/strip-backup/*
8 > }
8 > }
9 $ teststrip() {
9 $ teststrip() {
10 > hg up -C $1
10 > hg up -C $1
11 > echo % before update $1, strip $2
11 > echo % before update $1, strip $2
12 > hg log -G -T '{rev}:{node}'
12 > hg log -G -T '{rev}:{node}'
13 > hg --traceback debugstrip $2
13 > hg --traceback debugstrip $2
14 > echo % after update $1, strip $2
14 > echo % after update $1, strip $2
15 > hg log -G -T '{rev}:{node}'
15 > hg log -G -T '{rev}:{node}'
16 > restore
16 > restore
17 > }
17 > }
18
18
19 $ hg init test
19 $ hg init test
20 $ cd test
20 $ cd test
21
21
22 $ echo foo > bar
22 $ echo foo > bar
23 $ hg ci -Ama
23 $ hg ci -Ama
24 adding bar
24 adding bar
25
25
26 $ echo more >> bar
26 $ echo more >> bar
27 $ hg ci -Amb
27 $ hg ci -Amb
28
28
29 $ echo blah >> bar
29 $ echo blah >> bar
30 $ hg ci -Amc
30 $ hg ci -Amc
31
31
32 $ hg up 1
32 $ hg up 1
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ echo blah >> bar
34 $ echo blah >> bar
35 $ hg ci -Amd
35 $ hg ci -Amd
36 created new head
36 created new head
37
37
38 $ echo final >> bar
38 $ echo final >> bar
39 $ hg ci -Ame
39 $ hg ci -Ame
40
40
41 $ hg log
41 $ hg log
42 changeset: 4:443431ffac4f
42 changeset: 4:443431ffac4f
43 tag: tip
43 tag: tip
44 user: test
44 user: test
45 date: Thu Jan 01 00:00:00 1970 +0000
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: e
46 summary: e
47
47
48 changeset: 3:65bd5f99a4a3
48 changeset: 3:65bd5f99a4a3
49 parent: 1:ef3a871183d7
49 parent: 1:ef3a871183d7
50 user: test
50 user: test
51 date: Thu Jan 01 00:00:00 1970 +0000
51 date: Thu Jan 01 00:00:00 1970 +0000
52 summary: d
52 summary: d
53
53
54 changeset: 2:264128213d29
54 changeset: 2:264128213d29
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:00 1970 +0000
56 date: Thu Jan 01 00:00:00 1970 +0000
57 summary: c
57 summary: c
58
58
59 changeset: 1:ef3a871183d7
59 changeset: 1:ef3a871183d7
60 user: test
60 user: test
61 date: Thu Jan 01 00:00:00 1970 +0000
61 date: Thu Jan 01 00:00:00 1970 +0000
62 summary: b
62 summary: b
63
63
64 changeset: 0:9ab35a2d17cb
64 changeset: 0:9ab35a2d17cb
65 user: test
65 user: test
66 date: Thu Jan 01 00:00:00 1970 +0000
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: a
67 summary: a
68
68
69
69
70 $ teststrip 4 4
70 $ teststrip 4 4
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 % before update 4, strip 4
72 % before update 4, strip 4
73 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
73 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
74 |
74 |
75 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
75 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
76 |
76 |
77 | o 2:264128213d290d868c54642d13aeaa3675551a78
77 | o 2:264128213d290d868c54642d13aeaa3675551a78
78 |/
78 |/
79 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
79 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
80 |
80 |
81 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
81 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
82
82
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
84 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
85 % after update 4, strip 4
85 % after update 4, strip 4
86 @ 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
86 @ 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
87 |
87 |
88 | o 2:264128213d290d868c54642d13aeaa3675551a78
88 | o 2:264128213d290d868c54642d13aeaa3675551a78
89 |/
89 |/
90 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
90 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
91 |
91 |
92 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
92 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
93
93
94 $ teststrip 4 3
94 $ teststrip 4 3
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 % before update 4, strip 3
96 % before update 4, strip 3
97 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
97 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
98 |
98 |
99 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
99 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
100 |
100 |
101 | o 2:264128213d290d868c54642d13aeaa3675551a78
101 | o 2:264128213d290d868c54642d13aeaa3675551a78
102 |/
102 |/
103 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
103 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
104 |
104 |
105 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
105 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
106
106
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
108 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
109 % after update 4, strip 3
109 % after update 4, strip 3
110 o 2:264128213d290d868c54642d13aeaa3675551a78
110 o 2:264128213d290d868c54642d13aeaa3675551a78
111 |
111 |
112 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
112 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
113 |
113 |
114 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
114 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
115
115
116 $ teststrip 1 4
116 $ teststrip 1 4
117 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 % before update 1, strip 4
118 % before update 1, strip 4
119 o 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
119 o 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
120 |
120 |
121 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
121 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
122 |
122 |
123 | o 2:264128213d290d868c54642d13aeaa3675551a78
123 | o 2:264128213d290d868c54642d13aeaa3675551a78
124 |/
124 |/
125 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
125 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
126 |
126 |
127 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
127 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
128
128
129 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
129 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
130 % after update 1, strip 4
130 % after update 1, strip 4
131 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
131 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
132 |
132 |
133 | o 2:264128213d290d868c54642d13aeaa3675551a78
133 | o 2:264128213d290d868c54642d13aeaa3675551a78
134 |/
134 |/
135 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
135 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
136 |
136 |
137 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
137 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
138
138
139 $ teststrip 4 2
139 $ teststrip 4 2
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 % before update 4, strip 2
141 % before update 4, strip 2
142 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
142 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
143 |
143 |
144 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
144 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
145 |
145 |
146 | o 2:264128213d290d868c54642d13aeaa3675551a78
146 | o 2:264128213d290d868c54642d13aeaa3675551a78
147 |/
147 |/
148 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
148 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
149 |
149 |
150 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
150 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
151
151
152 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
152 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
153 % after update 4, strip 2
153 % after update 4, strip 2
154 @ 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
154 @ 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
155 |
155 |
156 o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
156 o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
157 |
157 |
158 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
158 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
159 |
159 |
160 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
160 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
161
161
162 $ teststrip 4 1
162 $ teststrip 4 1
163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
164 % before update 4, strip 1
164 % before update 4, strip 1
165 @ 4:264128213d290d868c54642d13aeaa3675551a78
165 @ 4:264128213d290d868c54642d13aeaa3675551a78
166 |
166 |
167 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
167 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
168 | |
168 | |
169 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
169 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
170 |/
170 |/
171 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
171 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
172 |
172 |
173 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
173 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
174
174
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
176 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
177 % after update 4, strip 1
177 % after update 4, strip 1
178 @ 0:9ab35a2d17cb64271241ea881efcc19dd953215b
178 @ 0:9ab35a2d17cb64271241ea881efcc19dd953215b
179
179
180 $ teststrip null 4
180 $ teststrip null 4
181 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
182 % before update null, strip 4
182 % before update null, strip 4
183 o 4:264128213d290d868c54642d13aeaa3675551a78
183 o 4:264128213d290d868c54642d13aeaa3675551a78
184 |
184 |
185 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
185 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
186 | |
186 | |
187 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
187 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
188 |/
188 |/
189 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
189 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
190 |
190 |
191 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
191 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
192
192
193 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
193 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
194 % after update null, strip 4
194 % after update null, strip 4
195 o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
195 o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
196 |
196 |
197 o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
197 o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
198 |
198 |
199 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
199 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
200 |
200 |
201 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
201 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
202
202
203
203
204 $ hg log
204 $ hg log
205 changeset: 4:264128213d29
205 changeset: 4:264128213d29
206 tag: tip
206 tag: tip
207 parent: 1:ef3a871183d7
207 parent: 1:ef3a871183d7
208 user: test
208 user: test
209 date: Thu Jan 01 00:00:00 1970 +0000
209 date: Thu Jan 01 00:00:00 1970 +0000
210 summary: c
210 summary: c
211
211
212 changeset: 3:443431ffac4f
212 changeset: 3:443431ffac4f
213 user: test
213 user: test
214 date: Thu Jan 01 00:00:00 1970 +0000
214 date: Thu Jan 01 00:00:00 1970 +0000
215 summary: e
215 summary: e
216
216
217 changeset: 2:65bd5f99a4a3
217 changeset: 2:65bd5f99a4a3
218 user: test
218 user: test
219 date: Thu Jan 01 00:00:00 1970 +0000
219 date: Thu Jan 01 00:00:00 1970 +0000
220 summary: d
220 summary: d
221
221
222 changeset: 1:ef3a871183d7
222 changeset: 1:ef3a871183d7
223 user: test
223 user: test
224 date: Thu Jan 01 00:00:00 1970 +0000
224 date: Thu Jan 01 00:00:00 1970 +0000
225 summary: b
225 summary: b
226
226
227 changeset: 0:9ab35a2d17cb
227 changeset: 0:9ab35a2d17cb
228 user: test
228 user: test
229 date: Thu Jan 01 00:00:00 1970 +0000
229 date: Thu Jan 01 00:00:00 1970 +0000
230 summary: a
230 summary: a
231
231
232 $ hg up -C 4
232 $ hg up -C 4
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 $ hg parents
234 $ hg parents
235 changeset: 4:264128213d29
235 changeset: 4:264128213d29
236 tag: tip
236 tag: tip
237 parent: 1:ef3a871183d7
237 parent: 1:ef3a871183d7
238 user: test
238 user: test
239 date: Thu Jan 01 00:00:00 1970 +0000
239 date: Thu Jan 01 00:00:00 1970 +0000
240 summary: c
240 summary: c
241
241
242
242
243 $ hg --traceback strip 4
243 $ hg --traceback strip 4
244 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
244 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
245 saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
246 $ hg parents
246 $ hg parents
247 changeset: 1:ef3a871183d7
247 changeset: 1:ef3a871183d7
248 user: test
248 user: test
249 date: Thu Jan 01 00:00:00 1970 +0000
249 date: Thu Jan 01 00:00:00 1970 +0000
250 summary: b
250 summary: b
251
251
252 $ hg debugbundle .hg/strip-backup/*
252 $ hg debugbundle .hg/strip-backup/*
253 Stream params: {Compression: BZ}
253 Stream params: {Compression: BZ}
254 changegroup -- {nbchanges: 1, version: 03} (mandatory: True)
254 changegroup -- {nbchanges: 1, version: 03} (mandatory: True)
255 264128213d290d868c54642d13aeaa3675551a78
255 264128213d290d868c54642d13aeaa3675551a78
256 cache:rev-branch-cache -- {} (mandatory: False)
256 cache:rev-branch-cache -- {} (mandatory: False)
257 phase-heads -- {} (mandatory: True)
257 phase-heads -- {} (mandatory: True)
258 264128213d290d868c54642d13aeaa3675551a78 draft
258 264128213d290d868c54642d13aeaa3675551a78 draft
259 $ hg unbundle .hg/strip-backup/*
259 $ hg unbundle .hg/strip-backup/*
260 adding changesets
260 adding changesets
261 adding manifests
261 adding manifests
262 adding file changes
262 adding file changes
263 added 1 changesets with 0 changes to 1 files (+1 heads)
263 added 1 changesets with 0 changes to 1 files (+1 heads)
264 new changesets 264128213d29 (1 drafts)
264 new changesets 264128213d29 (1 drafts)
265 (run 'hg heads' to see heads, 'hg merge' to merge)
265 (run 'hg heads' to see heads, 'hg merge' to merge)
266 $ rm .hg/strip-backup/*
266 $ rm .hg/strip-backup/*
267 $ hg log --graph
267 $ hg log --graph
268 o changeset: 4:264128213d29
268 o changeset: 4:264128213d29
269 | tag: tip
269 | tag: tip
270 | parent: 1:ef3a871183d7
270 | parent: 1:ef3a871183d7
271 | user: test
271 | user: test
272 | date: Thu Jan 01 00:00:00 1970 +0000
272 | date: Thu Jan 01 00:00:00 1970 +0000
273 | summary: c
273 | summary: c
274 |
274 |
275 | o changeset: 3:443431ffac4f
275 | o changeset: 3:443431ffac4f
276 | | user: test
276 | | user: test
277 | | date: Thu Jan 01 00:00:00 1970 +0000
277 | | date: Thu Jan 01 00:00:00 1970 +0000
278 | | summary: e
278 | | summary: e
279 | |
279 | |
280 | o changeset: 2:65bd5f99a4a3
280 | o changeset: 2:65bd5f99a4a3
281 |/ user: test
281 |/ user: test
282 | date: Thu Jan 01 00:00:00 1970 +0000
282 | date: Thu Jan 01 00:00:00 1970 +0000
283 | summary: d
283 | summary: d
284 |
284 |
285 @ changeset: 1:ef3a871183d7
285 @ changeset: 1:ef3a871183d7
286 | user: test
286 | user: test
287 | date: Thu Jan 01 00:00:00 1970 +0000
287 | date: Thu Jan 01 00:00:00 1970 +0000
288 | summary: b
288 | summary: b
289 |
289 |
290 o changeset: 0:9ab35a2d17cb
290 o changeset: 0:9ab35a2d17cb
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: a
293 summary: a
294
294
295 $ hg up -C 2
295 $ hg up -C 2
296 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 $ hg merge 4
297 $ hg merge 4
298 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 (branch merge, don't forget to commit)
299 (branch merge, don't forget to commit)
300
300
301 before strip of merge parent
301 before strip of merge parent
302
302
303 $ hg parents
303 $ hg parents
304 changeset: 2:65bd5f99a4a3
304 changeset: 2:65bd5f99a4a3
305 user: test
305 user: test
306 date: Thu Jan 01 00:00:00 1970 +0000
306 date: Thu Jan 01 00:00:00 1970 +0000
307 summary: d
307 summary: d
308
308
309 changeset: 4:264128213d29
309 changeset: 4:264128213d29
310 tag: tip
310 tag: tip
311 parent: 1:ef3a871183d7
311 parent: 1:ef3a871183d7
312 user: test
312 user: test
313 date: Thu Jan 01 00:00:00 1970 +0000
313 date: Thu Jan 01 00:00:00 1970 +0000
314 summary: c
314 summary: c
315
315
316 ##strip not allowed with merge in progress
316 ##strip not allowed with merge in progress
317 $ hg strip 4
317 $ hg strip 4
318 abort: outstanding uncommitted merge
318 abort: outstanding uncommitted merge
319 (use 'hg commit' or 'hg merge --abort')
319 (use 'hg commit' or 'hg merge --abort')
320 [20]
320 [20]
321 ##strip allowed --force with merge in progress
321 ##strip allowed --force with merge in progress
322 $ hg strip 4 --force
322 $ hg strip 4 --force
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
324 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
325
325
326 after strip of merge parent
326 after strip of merge parent
327
327
328 $ hg parents
328 $ hg parents
329 changeset: 1:ef3a871183d7
329 changeset: 1:ef3a871183d7
330 user: test
330 user: test
331 date: Thu Jan 01 00:00:00 1970 +0000
331 date: Thu Jan 01 00:00:00 1970 +0000
332 summary: b
332 summary: b
333
333
334 $ restore
334 $ restore
335
335
336 $ hg up
336 $ hg up
337 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
337 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 updated to "264128213d29: c"
338 updated to "264128213d29: c"
339 1 other heads for branch "default"
339 1 other heads for branch "default"
340 $ hg log -G
340 $ hg log -G
341 @ changeset: 4:264128213d29
341 @ changeset: 4:264128213d29
342 | tag: tip
342 | tag: tip
343 | parent: 1:ef3a871183d7
343 | parent: 1:ef3a871183d7
344 | user: test
344 | user: test
345 | date: Thu Jan 01 00:00:00 1970 +0000
345 | date: Thu Jan 01 00:00:00 1970 +0000
346 | summary: c
346 | summary: c
347 |
347 |
348 | o changeset: 3:443431ffac4f
348 | o changeset: 3:443431ffac4f
349 | | user: test
349 | | user: test
350 | | date: Thu Jan 01 00:00:00 1970 +0000
350 | | date: Thu Jan 01 00:00:00 1970 +0000
351 | | summary: e
351 | | summary: e
352 | |
352 | |
353 | o changeset: 2:65bd5f99a4a3
353 | o changeset: 2:65bd5f99a4a3
354 |/ user: test
354 |/ user: test
355 | date: Thu Jan 01 00:00:00 1970 +0000
355 | date: Thu Jan 01 00:00:00 1970 +0000
356 | summary: d
356 | summary: d
357 |
357 |
358 o changeset: 1:ef3a871183d7
358 o changeset: 1:ef3a871183d7
359 | user: test
359 | user: test
360 | date: Thu Jan 01 00:00:00 1970 +0000
360 | date: Thu Jan 01 00:00:00 1970 +0000
361 | summary: b
361 | summary: b
362 |
362 |
363 o changeset: 0:9ab35a2d17cb
363 o changeset: 0:9ab35a2d17cb
364 user: test
364 user: test
365 date: Thu Jan 01 00:00:00 1970 +0000
365 date: Thu Jan 01 00:00:00 1970 +0000
366 summary: a
366 summary: a
367
367
368
368
369 2 is parent of 3, only one strip should happen
369 2 is parent of 3, only one strip should happen
370
370
371 $ hg strip "roots(2)" 3
371 $ hg strip "roots(2)" 3
372 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
372 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
373 $ hg log -G
373 $ hg log -G
374 @ changeset: 2:264128213d29
374 @ changeset: 2:264128213d29
375 | tag: tip
375 | tag: tip
376 | user: test
376 | user: test
377 | date: Thu Jan 01 00:00:00 1970 +0000
377 | date: Thu Jan 01 00:00:00 1970 +0000
378 | summary: c
378 | summary: c
379 |
379 |
380 o changeset: 1:ef3a871183d7
380 o changeset: 1:ef3a871183d7
381 | user: test
381 | user: test
382 | date: Thu Jan 01 00:00:00 1970 +0000
382 | date: Thu Jan 01 00:00:00 1970 +0000
383 | summary: b
383 | summary: b
384 |
384 |
385 o changeset: 0:9ab35a2d17cb
385 o changeset: 0:9ab35a2d17cb
386 user: test
386 user: test
387 date: Thu Jan 01 00:00:00 1970 +0000
387 date: Thu Jan 01 00:00:00 1970 +0000
388 summary: a
388 summary: a
389
389
390 $ restore
390 $ restore
391 $ hg log -G
391 $ hg log -G
392 o changeset: 4:443431ffac4f
392 o changeset: 4:443431ffac4f
393 | tag: tip
393 | tag: tip
394 | user: test
394 | user: test
395 | date: Thu Jan 01 00:00:00 1970 +0000
395 | date: Thu Jan 01 00:00:00 1970 +0000
396 | summary: e
396 | summary: e
397 |
397 |
398 o changeset: 3:65bd5f99a4a3
398 o changeset: 3:65bd5f99a4a3
399 | parent: 1:ef3a871183d7
399 | parent: 1:ef3a871183d7
400 | user: test
400 | user: test
401 | date: Thu Jan 01 00:00:00 1970 +0000
401 | date: Thu Jan 01 00:00:00 1970 +0000
402 | summary: d
402 | summary: d
403 |
403 |
404 | @ changeset: 2:264128213d29
404 | @ changeset: 2:264128213d29
405 |/ user: test
405 |/ user: test
406 | date: Thu Jan 01 00:00:00 1970 +0000
406 | date: Thu Jan 01 00:00:00 1970 +0000
407 | summary: c
407 | summary: c
408 |
408 |
409 o changeset: 1:ef3a871183d7
409 o changeset: 1:ef3a871183d7
410 | user: test
410 | user: test
411 | date: Thu Jan 01 00:00:00 1970 +0000
411 | date: Thu Jan 01 00:00:00 1970 +0000
412 | summary: b
412 | summary: b
413 |
413 |
414 o changeset: 0:9ab35a2d17cb
414 o changeset: 0:9ab35a2d17cb
415 user: test
415 user: test
416 date: Thu Jan 01 00:00:00 1970 +0000
416 date: Thu Jan 01 00:00:00 1970 +0000
417 summary: a
417 summary: a
418
418
419 Failed hook while applying "saveheads" bundle.
419 Failed hook while applying "saveheads" bundle.
420
420
421 $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
421 $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
422 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
423 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
423 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
424 transaction abort!
424 transaction abort!
425 rollback completed
425 rollback completed
426 strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
426 strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
427 strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
427 strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
428 (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
428 (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
429 abort: pretxnchangegroup.bad hook exited with status 1
429 abort: pretxnchangegroup.bad hook exited with status 1
430 [40]
430 [40]
431 $ restore
431 $ restore
432 $ hg log -G
432 $ hg log -G
433 o changeset: 4:443431ffac4f
433 o changeset: 4:443431ffac4f
434 | tag: tip
434 | tag: tip
435 | user: test
435 | user: test
436 | date: Thu Jan 01 00:00:00 1970 +0000
436 | date: Thu Jan 01 00:00:00 1970 +0000
437 | summary: e
437 | summary: e
438 |
438 |
439 o changeset: 3:65bd5f99a4a3
439 o changeset: 3:65bd5f99a4a3
440 | parent: 1:ef3a871183d7
440 | parent: 1:ef3a871183d7
441 | user: test
441 | user: test
442 | date: Thu Jan 01 00:00:00 1970 +0000
442 | date: Thu Jan 01 00:00:00 1970 +0000
443 | summary: d
443 | summary: d
444 |
444 |
445 | o changeset: 2:264128213d29
445 | o changeset: 2:264128213d29
446 |/ user: test
446 |/ user: test
447 | date: Thu Jan 01 00:00:00 1970 +0000
447 | date: Thu Jan 01 00:00:00 1970 +0000
448 | summary: c
448 | summary: c
449 |
449 |
450 @ changeset: 1:ef3a871183d7
450 @ changeset: 1:ef3a871183d7
451 | user: test
451 | user: test
452 | date: Thu Jan 01 00:00:00 1970 +0000
452 | date: Thu Jan 01 00:00:00 1970 +0000
453 | summary: b
453 | summary: b
454 |
454 |
455 o changeset: 0:9ab35a2d17cb
455 o changeset: 0:9ab35a2d17cb
456 user: test
456 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
457 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: a
458 summary: a
459
459
460
460
461 2 different branches: 2 strips
461 2 different branches: 2 strips
462
462
463 $ hg strip 2 4
463 $ hg strip 2 4
464 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
464 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
465 $ hg log -G
465 $ hg log -G
466 o changeset: 2:65bd5f99a4a3
466 o changeset: 2:65bd5f99a4a3
467 | tag: tip
467 | tag: tip
468 | user: test
468 | user: test
469 | date: Thu Jan 01 00:00:00 1970 +0000
469 | date: Thu Jan 01 00:00:00 1970 +0000
470 | summary: d
470 | summary: d
471 |
471 |
472 @ changeset: 1:ef3a871183d7
472 @ changeset: 1:ef3a871183d7
473 | user: test
473 | user: test
474 | date: Thu Jan 01 00:00:00 1970 +0000
474 | date: Thu Jan 01 00:00:00 1970 +0000
475 | summary: b
475 | summary: b
476 |
476 |
477 o changeset: 0:9ab35a2d17cb
477 o changeset: 0:9ab35a2d17cb
478 user: test
478 user: test
479 date: Thu Jan 01 00:00:00 1970 +0000
479 date: Thu Jan 01 00:00:00 1970 +0000
480 summary: a
480 summary: a
481
481
482 $ restore
482 $ restore
483
483
484 2 different branches and a common ancestor: 1 strip
484 2 different branches and a common ancestor: 1 strip
485
485
486 $ hg strip 1 "2|4"
486 $ hg strip 1 "2|4"
487 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
487 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
488 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
488 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
489 $ restore
489 $ restore
490
490
491 verify fncache is kept up-to-date
491 verify fncache is kept up-to-date
492
492
493 $ touch a
493 $ touch a
494 $ hg ci -qAm a
494 $ hg ci -qAm a
495 #if repofncache
495 #if repofncache
496 $ cat .hg/store/fncache | sort
496 $ cat .hg/store/fncache | sort
497 data/a.i
497 data/a.i
498 data/bar.i
498 data/bar.i
499 #endif
499 #endif
500
500
501 $ hg strip tip
501 $ hg strip tip
502 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
502 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
503 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
503 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
504 #if repofncache
504 #if repofncache
505 $ cat .hg/store/fncache
505 $ cat .hg/store/fncache
506 data/bar.i
506 data/bar.i
507 #endif
507 #endif
508
508
509 stripping an empty revset
509 stripping an empty revset
510
510
511 $ hg strip "1 and not 1"
511 $ hg strip "1 and not 1"
512 abort: empty revision set
512 abort: empty revision set
513 [255]
513 [255]
514
514
515 remove branchy history for qimport tests
515 remove branchy history for qimport tests
516
516
517 $ hg strip 3
517 $ hg strip 3
518 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
518 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
519
519
520
520
521 strip of applied mq should cleanup status file
521 strip of applied mq should cleanup status file
522
522
523 $ echo "mq=" >> $HGRCPATH
523 $ echo "mq=" >> $HGRCPATH
524 $ hg up -C 3
524 $ hg up -C 3
525 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
525 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
526 $ echo fooagain >> bar
526 $ echo fooagain >> bar
527 $ hg ci -mf
527 $ hg ci -mf
528 $ hg qimport -r tip:2
528 $ hg qimport -r tip:2
529
529
530 applied patches before strip
530 applied patches before strip
531
531
532 $ hg qapplied
532 $ hg qapplied
533 d
533 d
534 e
534 e
535 f
535 f
536
536
537 stripping revision in queue
537 stripping revision in queue
538
538
539 $ hg strip 3
539 $ hg strip 3
540 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
541 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
541 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
542
542
543 applied patches after stripping rev in queue
543 applied patches after stripping rev in queue
544
544
545 $ hg qapplied
545 $ hg qapplied
546 d
546 d
547
547
548 stripping ancestor of queue
548 stripping ancestor of queue
549
549
550 $ hg strip 1
550 $ hg strip 1
551 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
551 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
552 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
552 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
553
553
554 applied patches after stripping ancestor of queue
554 applied patches after stripping ancestor of queue
555
555
556 $ hg qapplied
556 $ hg qapplied
557
557
558 Verify strip protects against stripping wc parent when there are uncommitted mods
558 Verify strip protects against stripping wc parent when there are uncommitted mods
559
559
560 $ echo b > b
560 $ echo b > b
561 $ echo bb > bar
561 $ echo bb > bar
562 $ hg add b
562 $ hg add b
563 $ hg ci -m 'b'
563 $ hg ci -m 'b'
564 $ hg log --graph
564 $ hg log --graph
565 @ changeset: 1:76dcf9fab855
565 @ changeset: 1:76dcf9fab855
566 | tag: tip
566 | tag: tip
567 | user: test
567 | user: test
568 | date: Thu Jan 01 00:00:00 1970 +0000
568 | date: Thu Jan 01 00:00:00 1970 +0000
569 | summary: b
569 | summary: b
570 |
570 |
571 o changeset: 0:9ab35a2d17cb
571 o changeset: 0:9ab35a2d17cb
572 user: test
572 user: test
573 date: Thu Jan 01 00:00:00 1970 +0000
573 date: Thu Jan 01 00:00:00 1970 +0000
574 summary: a
574 summary: a
575
575
576 $ hg up 0
576 $ hg up 0
577 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
577 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
578 $ echo c > bar
578 $ echo c > bar
579 $ hg up -t false
579 $ hg up -t false
580 merging bar
580 merging bar
581 merging bar failed!
581 merging bar failed!
582 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
582 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
583 use 'hg resolve' to retry unresolved file merges
583 use 'hg resolve' to retry unresolved file merges
584 [1]
584 [1]
585 $ hg sum
585 $ hg sum
586 parent: 1:76dcf9fab855 tip
586 parent: 1:76dcf9fab855 tip
587 b
587 b
588 branch: default
588 branch: default
589 commit: 1 modified, 1 unknown, 1 unresolved
589 commit: 1 modified, 1 unknown, 1 unresolved
590 update: (current)
590 update: (current)
591 phases: 2 draft
591 phases: 2 draft
592 mq: 3 unapplied
592 mq: 3 unapplied
593
593
594 $ hg log --graph
594 $ hg log --graph
595 @ changeset: 1:76dcf9fab855
595 @ changeset: 1:76dcf9fab855
596 | tag: tip
596 | tag: tip
597 | user: test
597 | user: test
598 | date: Thu Jan 01 00:00:00 1970 +0000
598 | date: Thu Jan 01 00:00:00 1970 +0000
599 | summary: b
599 | summary: b
600 |
600 |
601 % changeset: 0:9ab35a2d17cb
601 % changeset: 0:9ab35a2d17cb
602 user: test
602 user: test
603 date: Thu Jan 01 00:00:00 1970 +0000
603 date: Thu Jan 01 00:00:00 1970 +0000
604 summary: a
604 summary: a
605
605
606 $ echo c > b
606 $ echo c > b
607 $ hg strip tip
607 $ hg strip tip
608 abort: uncommitted changes
608 abort: uncommitted changes
609 [20]
609 [20]
610 $ hg strip tip --keep
610 $ hg strip tip --keep
611 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
611 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
612 $ hg log --graph
612 $ hg log --graph
613 @ changeset: 0:9ab35a2d17cb
613 @ changeset: 0:9ab35a2d17cb
614 tag: tip
614 tag: tip
615 user: test
615 user: test
616 date: Thu Jan 01 00:00:00 1970 +0000
616 date: Thu Jan 01 00:00:00 1970 +0000
617 summary: a
617 summary: a
618
618
619 $ hg status
619 $ hg status
620 M bar
620 M bar
621 ? b
621 ? b
622 ? bar.orig
622 ? bar.orig
623
623
624 $ rm bar.orig
624 $ rm bar.orig
625 $ hg sum
625 $ hg sum
626 parent: 0:9ab35a2d17cb tip
626 parent: 0:9ab35a2d17cb tip
627 a
627 a
628 branch: default
628 branch: default
629 commit: 1 modified, 1 unknown
629 commit: 1 modified, 1 unknown
630 update: (current)
630 update: (current)
631 phases: 1 draft
631 phases: 1 draft
632 mq: 3 unapplied
632 mq: 3 unapplied
633
633
634 Strip adds, removes, modifies with --keep
634 Strip adds, removes, modifies with --keep
635
635
636 $ touch b
636 $ touch b
637 $ hg add b
637 $ hg add b
638 $ hg commit -mb
638 $ hg commit -mb
639 $ touch c
639 $ touch c
640
640
641 ... with a clean working dir
641 ... with a clean working dir
642
642
643 $ hg add c
643 $ hg add c
644 $ hg rm bar
644 $ hg rm bar
645 $ hg commit -mc
645 $ hg commit -mc
646 $ hg status
646 $ hg status
647 $ hg strip --keep tip
647 $ hg strip --keep tip
648 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
648 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
649 $ hg status
649 $ hg status
650 ! bar
650 ! bar
651 ? c
651 ? c
652
652
653 ... with a dirty working dir
653 ... with a dirty working dir
654
654
655 $ hg add c
655 $ hg add c
656 $ hg rm bar
656 $ hg rm bar
657 $ hg commit -mc
657 $ hg commit -mc
658 $ hg status
658 $ hg status
659 $ echo b > b
659 $ echo b > b
660 $ echo d > d
660 $ echo d > d
661 $ hg strip --keep tip
661 $ hg strip --keep tip
662 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
662 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
663 $ hg status
663 $ hg status
664 M b
664 M b
665 ! bar
665 ! bar
666 ? c
666 ? c
667 ? d
667 ? d
668
668
669 ... after updating the dirstate
669 ... after updating the dirstate
670 $ hg add c
670 $ hg add c
671 $ hg commit -mc
671 $ hg commit -mc
672 $ hg rm c
672 $ hg rm c
673 $ hg commit -mc
673 $ hg commit -mc
674 $ hg strip --keep '.^' -q
674 $ hg strip --keep '.^' -q
675 $ cd ..
675 $ cd ..
676
676
677 stripping many nodes on a complex graph (issue3299)
677 stripping many nodes on a complex graph (issue3299)
678
678
679 $ hg init issue3299
679 $ hg init issue3299
680 $ cd issue3299
680 $ cd issue3299
681 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
681 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
682 $ hg strip 'not ancestors(x)'
682 $ hg strip 'not ancestors(x)'
683 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
683 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
684
684
685 test hg strip -B bookmark
685 test hg strip -B bookmark
686
686
687 $ cd ..
687 $ cd ..
688 $ hg init bookmarks
688 $ hg init bookmarks
689 $ cd bookmarks
689 $ cd bookmarks
690 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
690 $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f'
691 $ hg bookmark -r 'a' 'todelete'
691 $ hg bookmark -r 'a' 'todelete'
692 $ hg bookmark -r 'b' 'B'
692 $ hg bookmark -r 'b' 'B'
693 $ hg bookmark -r 'b' 'nostrip'
693 $ hg bookmark -r 'b' 'nostrip'
694 $ hg bookmark -r 'c' 'delete'
694 $ hg bookmark -r 'c' 'delete'
695 $ hg bookmark -r 'd' 'multipledelete1'
695 $ hg bookmark -r 'd' 'multipledelete1'
696 $ hg bookmark -r 'e' 'multipledelete2'
696 $ hg bookmark -r 'e' 'multipledelete2'
697 $ hg bookmark -r 'f' 'singlenode1'
697 $ hg bookmark -r 'f' 'singlenode1'
698 $ hg bookmark -r 'f' 'singlenode2'
698 $ hg bookmark -r 'f' 'singlenode2'
699 $ hg up -C todelete
699 $ hg up -C todelete
700 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
700 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
701 (activating bookmark todelete)
701 (activating bookmark todelete)
702 $ hg strip -B nostrip
702 $ hg strip -B nostrip
703 bookmark 'nostrip' deleted
703 bookmark 'nostrip' deleted
704 abort: empty revision set
704 abort: empty revision set
705 [255]
705 [255]
706 $ hg strip -B todelete
706 $ hg strip -B todelete
707 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
707 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
708 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
708 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
709 bookmark 'todelete' deleted
709 bookmark 'todelete' deleted
710 $ hg id -ir dcbb326fdec2
710 $ hg id -ir dcbb326fdec2
711 abort: unknown revision 'dcbb326fdec2'
711 abort: unknown revision 'dcbb326fdec2'
712 [10]
712 [10]
713 $ hg id -ir d62d843c9a01
713 $ hg id -ir d62d843c9a01
714 d62d843c9a01
714 d62d843c9a01
715 $ hg bookmarks
715 $ hg bookmarks
716 B 9:ff43616e5d0f
716 B 9:ff43616e5d0f
717 delete 6:2702dd0c91e7
717 delete 6:2702dd0c91e7
718 multipledelete1 11:e46a4836065c
718 multipledelete1 11:e46a4836065c
719 multipledelete2 12:b4594d867745
719 multipledelete2 12:b4594d867745
720 singlenode1 13:43227190fef8
720 singlenode1 13:43227190fef8
721 singlenode2 13:43227190fef8
721 singlenode2 13:43227190fef8
722 $ hg strip -B multipledelete1 -B multipledelete2
722 $ hg strip -B multipledelete1 -B multipledelete2
723 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
723 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
724 bookmark 'multipledelete1' deleted
724 bookmark 'multipledelete1' deleted
725 bookmark 'multipledelete2' deleted
725 bookmark 'multipledelete2' deleted
726 $ hg id -ir e46a4836065c
726 $ hg id -ir e46a4836065c
727 abort: unknown revision 'e46a4836065c'
727 abort: unknown revision 'e46a4836065c'
728 [10]
728 [10]
729 $ hg id -ir b4594d867745
729 $ hg id -ir b4594d867745
730 abort: unknown revision 'b4594d867745'
730 abort: unknown revision 'b4594d867745'
731 [10]
731 [10]
732 $ hg strip -B singlenode1 -B singlenode2
732 $ hg strip -B singlenode1 -B singlenode2
733 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
733 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
734 bookmark 'singlenode1' deleted
734 bookmark 'singlenode1' deleted
735 bookmark 'singlenode2' deleted
735 bookmark 'singlenode2' deleted
736 $ hg id -ir 43227190fef8
736 $ hg id -ir 43227190fef8
737 abort: unknown revision '43227190fef8'
737 abort: unknown revision '43227190fef8'
738 [10]
738 [10]
739 $ hg strip -B unknownbookmark
739 $ hg strip -B unknownbookmark
740 abort: bookmark 'unknownbookmark' not found
740 abort: bookmark 'unknownbookmark' not found
741 [255]
741 [255]
742 $ hg strip -B unknownbookmark1 -B unknownbookmark2
742 $ hg strip -B unknownbookmark1 -B unknownbookmark2
743 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
743 abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
744 [255]
744 [255]
745 $ hg strip -B delete -B unknownbookmark
745 $ hg strip -B delete -B unknownbookmark
746 abort: bookmark 'unknownbookmark' not found
746 abort: bookmark 'unknownbookmark' not found
747 [255]
747 [255]
748 $ hg strip -B delete
748 $ hg strip -B delete
749 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
749 saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
750 bookmark 'delete' deleted
750 bookmark 'delete' deleted
751 $ hg id -ir 6:2702dd0c91e7
751 $ hg id -ir 6:2702dd0c91e7
752 abort: unknown revision '2702dd0c91e7'
752 abort: unknown revision '2702dd0c91e7'
753 [10]
753 [10]
754 $ hg update B
754 $ hg update B
755 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
755 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
756 (activating bookmark B)
756 (activating bookmark B)
757 $ echo a > a
757 $ echo a > a
758 $ hg add a
758 $ hg add a
759 $ hg strip -B B
759 $ hg strip -B B
760 abort: uncommitted changes
760 abort: uncommitted changes
761 [20]
761 [20]
762 $ hg bookmarks
762 $ hg bookmarks
763 * B 6:ff43616e5d0f
763 * B 6:ff43616e5d0f
764
764
765 Make sure no one adds back a -b option:
765 Make sure no one adds back a -b option:
766
766
767 $ hg strip -b tip
767 $ hg strip -b tip
768 hg debugstrip: option -b not recognized
768 hg debugstrip: option -b not recognized
769 hg debugstrip [-k] [-f] [-B bookmark] [-r] REV...
769 hg debugstrip [-k] [-f] [-B bookmark] [-r] REV...
770
770
771 strip changesets and all their descendants from the repository
771 strip changesets and all their descendants from the repository
772
772
773 options ([+] can be repeated):
773 options ([+] can be repeated):
774
774
775 -r --rev REV [+] strip specified revision (optional, can specify
775 -r --rev REV [+] strip specified revision (optional, can specify
776 revisions without this option)
776 revisions without this option)
777 -f --force force removal of changesets, discard uncommitted
777 -f --force force removal of changesets, discard uncommitted
778 changes (no backup)
778 changes (no backup)
779 --no-backup do not save backup bundle
779 --no-backup do not save backup bundle
780 -k --keep do not modify working directory during strip
780 -k --keep do not modify working directory during strip
781 -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
781 -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
782 --mq operate on patch repository
782 --mq operate on patch repository
783
783
784 (use 'hg debugstrip -h' to show more help)
784 (use 'hg debugstrip -h' to show more help)
785 [10]
785 [10]
786
786
787 $ cd ..
787 $ cd ..
788
788
789 Verify bundles don't get overwritten:
789 Verify bundles don't get overwritten:
790
790
791 $ hg init doublebundle
791 $ hg init doublebundle
792 $ cd doublebundle
792 $ cd doublebundle
793 $ touch a
793 $ touch a
794 $ hg commit -Aqm a
794 $ hg commit -Aqm a
795 $ touch b
795 $ touch b
796 $ hg commit -Aqm b
796 $ hg commit -Aqm b
797 $ hg strip -r 0
797 $ hg strip -r 0
798 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
798 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
799 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
799 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
800 $ ls .hg/strip-backup
800 $ ls .hg/strip-backup
801 3903775176ed-e68910bd-backup.hg
801 3903775176ed-e68910bd-backup.hg
802 #if repobundlerepo
802 #if repobundlerepo
803 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
803 $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
804 $ hg strip -r 0
804 $ hg strip -r 0
805 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
805 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
806 $ ls .hg/strip-backup
806 $ ls .hg/strip-backup
807 3903775176ed-54390173-backup.hg
807 3903775176ed-54390173-backup.hg
808 3903775176ed-e68910bd-backup.hg
808 3903775176ed-e68910bd-backup.hg
809 #endif
809 #endif
810 $ cd ..
810 $ cd ..
811
811
812 Test that we only bundle the stripped changesets (issue4736)
812 Test that we only bundle the stripped changesets (issue4736)
813 ------------------------------------------------------------
813 ------------------------------------------------------------
814
814
815 initialization (previous repo is empty anyway)
815 initialization (previous repo is empty anyway)
816
816
817 $ hg init issue4736
817 $ hg init issue4736
818 $ cd issue4736
818 $ cd issue4736
819 $ echo a > a
819 $ echo a > a
820 $ hg add a
820 $ hg add a
821 $ hg commit -m commitA
821 $ hg commit -m commitA
822 $ echo b > b
822 $ echo b > b
823 $ hg add b
823 $ hg add b
824 $ hg commit -m commitB
824 $ hg commit -m commitB
825 $ echo c > c
825 $ echo c > c
826 $ hg add c
826 $ hg add c
827 $ hg commit -m commitC
827 $ hg commit -m commitC
828 $ hg up 'desc(commitB)'
828 $ hg up 'desc(commitB)'
829 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
829 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
830 $ echo d > d
830 $ echo d > d
831 $ hg add d
831 $ hg add d
832 $ hg commit -m commitD
832 $ hg commit -m commitD
833 created new head
833 created new head
834 $ hg up 'desc(commitC)'
834 $ hg up 'desc(commitC)'
835 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
835 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
836 $ hg merge 'desc(commitD)'
836 $ hg merge 'desc(commitD)'
837 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
838 (branch merge, don't forget to commit)
838 (branch merge, don't forget to commit)
839 $ hg ci -m 'mergeCD'
839 $ hg ci -m 'mergeCD'
840 $ hg log -G
840 $ hg log -G
841 @ changeset: 4:d8db9d137221
841 @ changeset: 4:d8db9d137221
842 |\ tag: tip
842 |\ tag: tip
843 | | parent: 2:5c51d8d6557d
843 | | parent: 2:5c51d8d6557d
844 | | parent: 3:6625a5168474
844 | | parent: 3:6625a5168474
845 | | user: test
845 | | user: test
846 | | date: Thu Jan 01 00:00:00 1970 +0000
846 | | date: Thu Jan 01 00:00:00 1970 +0000
847 | | summary: mergeCD
847 | | summary: mergeCD
848 | |
848 | |
849 | o changeset: 3:6625a5168474
849 | o changeset: 3:6625a5168474
850 | | parent: 1:eca11cf91c71
850 | | parent: 1:eca11cf91c71
851 | | user: test
851 | | user: test
852 | | date: Thu Jan 01 00:00:00 1970 +0000
852 | | date: Thu Jan 01 00:00:00 1970 +0000
853 | | summary: commitD
853 | | summary: commitD
854 | |
854 | |
855 o | changeset: 2:5c51d8d6557d
855 o | changeset: 2:5c51d8d6557d
856 |/ user: test
856 |/ user: test
857 | date: Thu Jan 01 00:00:00 1970 +0000
857 | date: Thu Jan 01 00:00:00 1970 +0000
858 | summary: commitC
858 | summary: commitC
859 |
859 |
860 o changeset: 1:eca11cf91c71
860 o changeset: 1:eca11cf91c71
861 | user: test
861 | user: test
862 | date: Thu Jan 01 00:00:00 1970 +0000
862 | date: Thu Jan 01 00:00:00 1970 +0000
863 | summary: commitB
863 | summary: commitB
864 |
864 |
865 o changeset: 0:105141ef12d0
865 o changeset: 0:105141ef12d0
866 user: test
866 user: test
867 date: Thu Jan 01 00:00:00 1970 +0000
867 date: Thu Jan 01 00:00:00 1970 +0000
868 summary: commitA
868 summary: commitA
869
869
870
870
871 Check bundle behavior:
871 Check bundle behavior:
872
872
873 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
873 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
874 2 changesets found
874 2 changesets found
875 #if repobundlerepo
875 #if repobundlerepo
876 $ hg log -r 'bundle()' -R ../issue4736.hg
876 $ hg log -r 'bundle()' -R ../issue4736.hg
877 changeset: 3:6625a5168474
877 changeset: 3:6625a5168474
878 parent: 1:eca11cf91c71
878 parent: 1:eca11cf91c71
879 user: test
879 user: test
880 date: Thu Jan 01 00:00:00 1970 +0000
880 date: Thu Jan 01 00:00:00 1970 +0000
881 summary: commitD
881 summary: commitD
882
882
883 changeset: 4:d8db9d137221
883 changeset: 4:d8db9d137221
884 tag: tip
884 tag: tip
885 parent: 2:5c51d8d6557d
885 parent: 2:5c51d8d6557d
886 parent: 3:6625a5168474
886 parent: 3:6625a5168474
887 user: test
887 user: test
888 date: Thu Jan 01 00:00:00 1970 +0000
888 date: Thu Jan 01 00:00:00 1970 +0000
889 summary: mergeCD
889 summary: mergeCD
890
890
891 #endif
891 #endif
892
892
893 check strip behavior
893 check strip behavior
894
894
895 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
895 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
896 resolving manifests
896 resolving manifests
897 branchmerge: False, force: True, partial: False
897 branchmerge: False, force: True, partial: False
898 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
898 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
899 c: other deleted -> r
899 c: other deleted -> r
900 removing c
900 removing c
901 d: other deleted -> r
901 d: other deleted -> r
902 removing d
902 removing d
903 starting 4 threads for background file closing (?)
903 starting 4 threads for background file closing (?)
904 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
904 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
905 2 changesets found
905 2 changesets found
906 list of changesets:
906 list of changesets:
907 6625a516847449b6f0fa3737b9ba56e9f0f3032c
907 6625a516847449b6f0fa3737b9ba56e9f0f3032c
908 d8db9d1372214336d2b5570f20ee468d2c72fa8b
908 d8db9d1372214336d2b5570f20ee468d2c72fa8b
909 bundle2-output-bundle: "HG20", (1 params) 3 parts total
909 bundle2-output-bundle: "HG20", (1 params) 3 parts total
910 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
910 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
911 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
911 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
912 bundle2-output-part: "phase-heads" 24 bytes payload
912 bundle2-output-part: "phase-heads" 24 bytes payload
913 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
913 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
914 updating the branch cache
914 updating the branch cache
915 invalid branch cache (served): tip differs
915 invalid branch cache (served): tip differs
916 resetting content of cache/rbc-revs-v2
916 resetting content of rbc-names-v2
917 $ hg log -G
917 $ hg log -G
918 o changeset: 2:5c51d8d6557d
918 o changeset: 2:5c51d8d6557d
919 | tag: tip
919 | tag: tip
920 | user: test
920 | user: test
921 | date: Thu Jan 01 00:00:00 1970 +0000
921 | date: Thu Jan 01 00:00:00 1970 +0000
922 | summary: commitC
922 | summary: commitC
923 |
923 |
924 @ changeset: 1:eca11cf91c71
924 @ changeset: 1:eca11cf91c71
925 | user: test
925 | user: test
926 | date: Thu Jan 01 00:00:00 1970 +0000
926 | date: Thu Jan 01 00:00:00 1970 +0000
927 | summary: commitB
927 | summary: commitB
928 |
928 |
929 o changeset: 0:105141ef12d0
929 o changeset: 0:105141ef12d0
930 user: test
930 user: test
931 date: Thu Jan 01 00:00:00 1970 +0000
931 date: Thu Jan 01 00:00:00 1970 +0000
932 summary: commitA
932 summary: commitA
933
933
934
934
935 strip backup content
935 strip backup content
936
936
937 #if repobundlerepo
937 #if repobundlerepo
938 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
938 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
939 changeset: 3:6625a5168474
939 changeset: 3:6625a5168474
940 parent: 1:eca11cf91c71
940 parent: 1:eca11cf91c71
941 user: test
941 user: test
942 date: Thu Jan 01 00:00:00 1970 +0000
942 date: Thu Jan 01 00:00:00 1970 +0000
943 summary: commitD
943 summary: commitD
944
944
945 changeset: 4:d8db9d137221
945 changeset: 4:d8db9d137221
946 tag: tip
946 tag: tip
947 parent: 2:5c51d8d6557d
947 parent: 2:5c51d8d6557d
948 parent: 3:6625a5168474
948 parent: 3:6625a5168474
949 user: test
949 user: test
950 date: Thu Jan 01 00:00:00 1970 +0000
950 date: Thu Jan 01 00:00:00 1970 +0000
951 summary: mergeCD
951 summary: mergeCD
952
952
953
953
954 #endif
954 #endif
955
955
956 Check that the phase cache is properly invalidated after a strip with bookmark.
956 Check that the phase cache is properly invalidated after a strip with bookmark.
957
957
958 $ cat > ../stripstalephasecache.py << EOF
958 $ cat > ../stripstalephasecache.py << EOF
959 > from mercurial import extensions, localrepo
959 > from mercurial import extensions, localrepo
960 > def transactioncallback(orig, repo, desc, *args, **kwargs):
960 > def transactioncallback(orig, repo, desc, *args, **kwargs):
961 > def test(transaction):
961 > def test(transaction):
962 > # observe cache inconsistency
962 > # observe cache inconsistency
963 > try:
963 > try:
964 > [repo.changelog.node(r) for r in repo.revs(b"not public()")]
964 > [repo.changelog.node(r) for r in repo.revs(b"not public()")]
965 > except IndexError:
965 > except IndexError:
966 > repo.ui.status(b"Index error!\n")
966 > repo.ui.status(b"Index error!\n")
967 > transaction = orig(repo, desc, *args, **kwargs)
967 > transaction = orig(repo, desc, *args, **kwargs)
968 > # warm up the phase cache
968 > # warm up the phase cache
969 > list(repo.revs(b"not public()"))
969 > list(repo.revs(b"not public()"))
970 > if desc != b'strip':
970 > if desc != b'strip':
971 > transaction.addpostclose(b"phase invalidation test", test)
971 > transaction.addpostclose(b"phase invalidation test", test)
972 > return transaction
972 > return transaction
973 > def extsetup(ui):
973 > def extsetup(ui):
974 > extensions.wrapfunction(localrepo.localrepository, "transaction",
974 > extensions.wrapfunction(localrepo.localrepository, "transaction",
975 > transactioncallback)
975 > transactioncallback)
976 > EOF
976 > EOF
977 $ hg up -C 2
977 $ hg up -C 2
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
979 $ echo k > k
979 $ echo k > k
980 $ hg add k
980 $ hg add k
981 $ hg commit -m commitK
981 $ hg commit -m commitK
982 $ echo l > l
982 $ echo l > l
983 $ hg add l
983 $ hg add l
984 $ hg commit -m commitL
984 $ hg commit -m commitL
985 $ hg book -r tip blah
985 $ hg book -r tip blah
986 $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
986 $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
987 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
987 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
988 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
988 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
989 $ hg up -C 1
989 $ hg up -C 1
990 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
990 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
991
991
992 Error during post-close callback of the strip transaction
992 Error during post-close callback of the strip transaction
993 (They should be gracefully handled and reported)
993 (They should be gracefully handled and reported)
994
994
995 $ cat > ../crashstrip.py << EOF
995 $ cat > ../crashstrip.py << EOF
996 > from mercurial import error
996 > from mercurial import error
997 > def reposetup(ui, repo):
997 > def reposetup(ui, repo):
998 > class crashstriprepo(repo.__class__):
998 > class crashstriprepo(repo.__class__):
999 > def transaction(self, desc, *args, **kwargs):
999 > def transaction(self, desc, *args, **kwargs):
1000 > tr = super(crashstriprepo, self).transaction(desc, *args, **kwargs)
1000 > tr = super(crashstriprepo, self).transaction(desc, *args, **kwargs)
1001 > if desc == b'strip':
1001 > if desc == b'strip':
1002 > def crash(tra): raise error.Abort(b'boom')
1002 > def crash(tra): raise error.Abort(b'boom')
1003 > tr.addpostclose(b'crash', crash)
1003 > tr.addpostclose(b'crash', crash)
1004 > return tr
1004 > return tr
1005 > repo.__class__ = crashstriprepo
1005 > repo.__class__ = crashstriprepo
1006 > EOF
1006 > EOF
1007 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
1007 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
1008 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
1008 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
1009 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
1009 strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
1010 abort: boom
1010 abort: boom
1011 [255]
1011 [255]
1012
1012
1013 test stripping a working directory parent doesn't switch named branches
1013 test stripping a working directory parent doesn't switch named branches
1014
1014
1015 $ hg log -G
1015 $ hg log -G
1016 @ changeset: 1:eca11cf91c71
1016 @ changeset: 1:eca11cf91c71
1017 | tag: tip
1017 | tag: tip
1018 | user: test
1018 | user: test
1019 | date: Thu Jan 01 00:00:00 1970 +0000
1019 | date: Thu Jan 01 00:00:00 1970 +0000
1020 | summary: commitB
1020 | summary: commitB
1021 |
1021 |
1022 o changeset: 0:105141ef12d0
1022 o changeset: 0:105141ef12d0
1023 user: test
1023 user: test
1024 date: Thu Jan 01 00:00:00 1970 +0000
1024 date: Thu Jan 01 00:00:00 1970 +0000
1025 summary: commitA
1025 summary: commitA
1026
1026
1027
1027
1028 $ hg branch new-branch
1028 $ hg branch new-branch
1029 marked working directory as branch new-branch
1029 marked working directory as branch new-branch
1030 (branches are permanent and global, did you want a bookmark?)
1030 (branches are permanent and global, did you want a bookmark?)
1031 $ hg ci -m "start new branch"
1031 $ hg ci -m "start new branch"
1032 $ echo 'foo' > foo.txt
1032 $ echo 'foo' > foo.txt
1033 $ hg ci -Aqm foo
1033 $ hg ci -Aqm foo
1034 $ hg up default
1034 $ hg up default
1035 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1035 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1036 $ echo 'bar' > bar.txt
1036 $ echo 'bar' > bar.txt
1037 $ hg ci -Aqm bar
1037 $ hg ci -Aqm bar
1038 $ hg up new-branch
1038 $ hg up new-branch
1039 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1039 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1040 $ hg merge default
1040 $ hg merge default
1041 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1041 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1042 (branch merge, don't forget to commit)
1042 (branch merge, don't forget to commit)
1043 $ hg log -G
1043 $ hg log -G
1044 @ changeset: 4:35358f982181
1044 @ changeset: 4:35358f982181
1045 | tag: tip
1045 | tag: tip
1046 | parent: 1:eca11cf91c71
1046 | parent: 1:eca11cf91c71
1047 | user: test
1047 | user: test
1048 | date: Thu Jan 01 00:00:00 1970 +0000
1048 | date: Thu Jan 01 00:00:00 1970 +0000
1049 | summary: bar
1049 | summary: bar
1050 |
1050 |
1051 | @ changeset: 3:f62c6c09b707
1051 | @ changeset: 3:f62c6c09b707
1052 | | branch: new-branch
1052 | | branch: new-branch
1053 | | user: test
1053 | | user: test
1054 | | date: Thu Jan 01 00:00:00 1970 +0000
1054 | | date: Thu Jan 01 00:00:00 1970 +0000
1055 | | summary: foo
1055 | | summary: foo
1056 | |
1056 | |
1057 | o changeset: 2:b1d33a8cadd9
1057 | o changeset: 2:b1d33a8cadd9
1058 |/ branch: new-branch
1058 |/ branch: new-branch
1059 | user: test
1059 | user: test
1060 | date: Thu Jan 01 00:00:00 1970 +0000
1060 | date: Thu Jan 01 00:00:00 1970 +0000
1061 | summary: start new branch
1061 | summary: start new branch
1062 |
1062 |
1063 o changeset: 1:eca11cf91c71
1063 o changeset: 1:eca11cf91c71
1064 | user: test
1064 | user: test
1065 | date: Thu Jan 01 00:00:00 1970 +0000
1065 | date: Thu Jan 01 00:00:00 1970 +0000
1066 | summary: commitB
1066 | summary: commitB
1067 |
1067 |
1068 o changeset: 0:105141ef12d0
1068 o changeset: 0:105141ef12d0
1069 user: test
1069 user: test
1070 date: Thu Jan 01 00:00:00 1970 +0000
1070 date: Thu Jan 01 00:00:00 1970 +0000
1071 summary: commitA
1071 summary: commitA
1072
1072
1073
1073
1074 $ hg strip --force -r 35358f982181
1074 $ hg strip --force -r 35358f982181
1075 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1075 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1076 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
1076 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
1077 $ hg log -G
1077 $ hg log -G
1078 @ changeset: 3:f62c6c09b707
1078 @ changeset: 3:f62c6c09b707
1079 | branch: new-branch
1079 | branch: new-branch
1080 | tag: tip
1080 | tag: tip
1081 | user: test
1081 | user: test
1082 | date: Thu Jan 01 00:00:00 1970 +0000
1082 | date: Thu Jan 01 00:00:00 1970 +0000
1083 | summary: foo
1083 | summary: foo
1084 |
1084 |
1085 o changeset: 2:b1d33a8cadd9
1085 o changeset: 2:b1d33a8cadd9
1086 | branch: new-branch
1086 | branch: new-branch
1087 | user: test
1087 | user: test
1088 | date: Thu Jan 01 00:00:00 1970 +0000
1088 | date: Thu Jan 01 00:00:00 1970 +0000
1089 | summary: start new branch
1089 | summary: start new branch
1090 |
1090 |
1091 o changeset: 1:eca11cf91c71
1091 o changeset: 1:eca11cf91c71
1092 | user: test
1092 | user: test
1093 | date: Thu Jan 01 00:00:00 1970 +0000
1093 | date: Thu Jan 01 00:00:00 1970 +0000
1094 | summary: commitB
1094 | summary: commitB
1095 |
1095 |
1096 o changeset: 0:105141ef12d0
1096 o changeset: 0:105141ef12d0
1097 user: test
1097 user: test
1098 date: Thu Jan 01 00:00:00 1970 +0000
1098 date: Thu Jan 01 00:00:00 1970 +0000
1099 summary: commitA
1099 summary: commitA
1100
1100
1101
1101
1102 $ hg up default
1102 $ hg up default
1103 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1103 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1104 $ echo 'bar' > bar.txt
1104 $ echo 'bar' > bar.txt
1105 $ hg ci -Aqm bar
1105 $ hg ci -Aqm bar
1106 $ hg up new-branch
1106 $ hg up new-branch
1107 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1107 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1108 $ hg merge default
1108 $ hg merge default
1109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1110 (branch merge, don't forget to commit)
1110 (branch merge, don't forget to commit)
1111 $ hg ci -m merge
1111 $ hg ci -m merge
1112 $ hg log -G
1112 $ hg log -G
1113 @ changeset: 5:4cf5e92caec2
1113 @ changeset: 5:4cf5e92caec2
1114 |\ branch: new-branch
1114 |\ branch: new-branch
1115 | | tag: tip
1115 | | tag: tip
1116 | | parent: 3:f62c6c09b707
1116 | | parent: 3:f62c6c09b707
1117 | | parent: 4:35358f982181
1117 | | parent: 4:35358f982181
1118 | | user: test
1118 | | user: test
1119 | | date: Thu Jan 01 00:00:00 1970 +0000
1119 | | date: Thu Jan 01 00:00:00 1970 +0000
1120 | | summary: merge
1120 | | summary: merge
1121 | |
1121 | |
1122 | o changeset: 4:35358f982181
1122 | o changeset: 4:35358f982181
1123 | | parent: 1:eca11cf91c71
1123 | | parent: 1:eca11cf91c71
1124 | | user: test
1124 | | user: test
1125 | | date: Thu Jan 01 00:00:00 1970 +0000
1125 | | date: Thu Jan 01 00:00:00 1970 +0000
1126 | | summary: bar
1126 | | summary: bar
1127 | |
1127 | |
1128 o | changeset: 3:f62c6c09b707
1128 o | changeset: 3:f62c6c09b707
1129 | | branch: new-branch
1129 | | branch: new-branch
1130 | | user: test
1130 | | user: test
1131 | | date: Thu Jan 01 00:00:00 1970 +0000
1131 | | date: Thu Jan 01 00:00:00 1970 +0000
1132 | | summary: foo
1132 | | summary: foo
1133 | |
1133 | |
1134 o | changeset: 2:b1d33a8cadd9
1134 o | changeset: 2:b1d33a8cadd9
1135 |/ branch: new-branch
1135 |/ branch: new-branch
1136 | user: test
1136 | user: test
1137 | date: Thu Jan 01 00:00:00 1970 +0000
1137 | date: Thu Jan 01 00:00:00 1970 +0000
1138 | summary: start new branch
1138 | summary: start new branch
1139 |
1139 |
1140 o changeset: 1:eca11cf91c71
1140 o changeset: 1:eca11cf91c71
1141 | user: test
1141 | user: test
1142 | date: Thu Jan 01 00:00:00 1970 +0000
1142 | date: Thu Jan 01 00:00:00 1970 +0000
1143 | summary: commitB
1143 | summary: commitB
1144 |
1144 |
1145 o changeset: 0:105141ef12d0
1145 o changeset: 0:105141ef12d0
1146 user: test
1146 user: test
1147 date: Thu Jan 01 00:00:00 1970 +0000
1147 date: Thu Jan 01 00:00:00 1970 +0000
1148 summary: commitA
1148 summary: commitA
1149
1149
1150
1150
1151 $ hg strip -r 35358f982181
1151 $ hg strip -r 35358f982181
1152 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1152 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1153 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1153 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1154 $ hg log -G
1154 $ hg log -G
1155 @ changeset: 3:f62c6c09b707
1155 @ changeset: 3:f62c6c09b707
1156 | branch: new-branch
1156 | branch: new-branch
1157 | tag: tip
1157 | tag: tip
1158 | user: test
1158 | user: test
1159 | date: Thu Jan 01 00:00:00 1970 +0000
1159 | date: Thu Jan 01 00:00:00 1970 +0000
1160 | summary: foo
1160 | summary: foo
1161 |
1161 |
1162 o changeset: 2:b1d33a8cadd9
1162 o changeset: 2:b1d33a8cadd9
1163 | branch: new-branch
1163 | branch: new-branch
1164 | user: test
1164 | user: test
1165 | date: Thu Jan 01 00:00:00 1970 +0000
1165 | date: Thu Jan 01 00:00:00 1970 +0000
1166 | summary: start new branch
1166 | summary: start new branch
1167 |
1167 |
1168 o changeset: 1:eca11cf91c71
1168 o changeset: 1:eca11cf91c71
1169 | user: test
1169 | user: test
1170 | date: Thu Jan 01 00:00:00 1970 +0000
1170 | date: Thu Jan 01 00:00:00 1970 +0000
1171 | summary: commitB
1171 | summary: commitB
1172 |
1172 |
1173 o changeset: 0:105141ef12d0
1173 o changeset: 0:105141ef12d0
1174 user: test
1174 user: test
1175 date: Thu Jan 01 00:00:00 1970 +0000
1175 date: Thu Jan 01 00:00:00 1970 +0000
1176 summary: commitA
1176 summary: commitA
1177
1177
1178
1178
1179 stripping a set containing a merge properly reset file content, including items on other branches
1179 stripping a set containing a merge properly reset file content, including items on other branches
1180
1180
1181 The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
1181 The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
1182
1182
1183 stripping a set containing a merge properly reset file content, including items on other branches
1183 stripping a set containing a merge properly reset file content, including items on other branches
1184
1184
1185 The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
1185 The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call.
1186
1186
1187 $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1187 $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1188 adding changesets
1188 adding changesets
1189 adding manifests
1189 adding manifests
1190 adding file changes
1190 adding file changes
1191 added 2 changesets with 1 changes to 1 files
1191 added 2 changesets with 1 changes to 1 files
1192 new changesets 35358f982181:4cf5e92caec2 (2 drafts)
1192 new changesets 35358f982181:4cf5e92caec2 (2 drafts)
1193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1193 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1194
1194
1195 $ hg id
1195 $ hg id
1196 4cf5e92caec2 (new-branch) tip
1196 4cf5e92caec2 (new-branch) tip
1197 $ hg status --rev "f62c6c09b707"
1197 $ hg status --rev "f62c6c09b707"
1198 A bar.txt
1198 A bar.txt
1199 $ hg diff --rev "f62c6c09b707"
1199 $ hg diff --rev "f62c6c09b707"
1200 diff -r f62c6c09b707 bar.txt
1200 diff -r f62c6c09b707 bar.txt
1201 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1201 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1202 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1202 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1203 @@ -0,0 +1,1 @@
1203 @@ -0,0 +1,1 @@
1204 +bar
1204 +bar
1205 $ hg log -G -v --rev 35358f982181:: --patch
1205 $ hg log -G -v --rev 35358f982181:: --patch
1206 @ changeset: 5:4cf5e92caec2
1206 @ changeset: 5:4cf5e92caec2
1207 |\ branch: new-branch
1207 |\ branch: new-branch
1208 | ~ tag: tip
1208 | ~ tag: tip
1209 | parent: 3:f62c6c09b707
1209 | parent: 3:f62c6c09b707
1210 | parent: 4:35358f982181
1210 | parent: 4:35358f982181
1211 | user: test
1211 | user: test
1212 | date: Thu Jan 01 00:00:00 1970 +0000
1212 | date: Thu Jan 01 00:00:00 1970 +0000
1213 | description:
1213 | description:
1214 | merge
1214 | merge
1215 |
1215 |
1216 |
1216 |
1217 | diff -r f62c6c09b707 -r 4cf5e92caec2 bar.txt
1217 | diff -r f62c6c09b707 -r 4cf5e92caec2 bar.txt
1218 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1218 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1219 | +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1219 | +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1220 | @@ -0,0 +1,1 @@
1220 | @@ -0,0 +1,1 @@
1221 | +bar
1221 | +bar
1222 |
1222 |
1223 o changeset: 4:35358f982181
1223 o changeset: 4:35358f982181
1224 | parent: 1:eca11cf91c71
1224 | parent: 1:eca11cf91c71
1225 ~ user: test
1225 ~ user: test
1226 date: Thu Jan 01 00:00:00 1970 +0000
1226 date: Thu Jan 01 00:00:00 1970 +0000
1227 files: bar.txt
1227 files: bar.txt
1228 description:
1228 description:
1229 bar
1229 bar
1230
1230
1231
1231
1232 diff -r eca11cf91c71 -r 35358f982181 bar.txt
1232 diff -r eca11cf91c71 -r 35358f982181 bar.txt
1233 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1233 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1234 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1234 +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000
1235 @@ -0,0 +1,1 @@
1235 @@ -0,0 +1,1 @@
1236 +bar
1236 +bar
1237
1237
1238
1238
1239 $ hg strip -k -r 35358f982181
1239 $ hg strip -k -r 35358f982181
1240 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1240 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
1241 $ hg log -G
1241 $ hg log -G
1242 @ changeset: 3:f62c6c09b707
1242 @ changeset: 3:f62c6c09b707
1243 | branch: new-branch
1243 | branch: new-branch
1244 | tag: tip
1244 | tag: tip
1245 | user: test
1245 | user: test
1246 | date: Thu Jan 01 00:00:00 1970 +0000
1246 | date: Thu Jan 01 00:00:00 1970 +0000
1247 | summary: foo
1247 | summary: foo
1248 |
1248 |
1249 o changeset: 2:b1d33a8cadd9
1249 o changeset: 2:b1d33a8cadd9
1250 | branch: new-branch
1250 | branch: new-branch
1251 | user: test
1251 | user: test
1252 | date: Thu Jan 01 00:00:00 1970 +0000
1252 | date: Thu Jan 01 00:00:00 1970 +0000
1253 | summary: start new branch
1253 | summary: start new branch
1254 |
1254 |
1255 o changeset: 1:eca11cf91c71
1255 o changeset: 1:eca11cf91c71
1256 | user: test
1256 | user: test
1257 | date: Thu Jan 01 00:00:00 1970 +0000
1257 | date: Thu Jan 01 00:00:00 1970 +0000
1258 | summary: commitB
1258 | summary: commitB
1259 |
1259 |
1260 o changeset: 0:105141ef12d0
1260 o changeset: 0:105141ef12d0
1261 user: test
1261 user: test
1262 date: Thu Jan 01 00:00:00 1970 +0000
1262 date: Thu Jan 01 00:00:00 1970 +0000
1263 summary: commitA
1263 summary: commitA
1264
1264
1265
1265
1266 $ hg status -A
1266 $ hg status -A
1267 ? bar.txt
1267 ? bar.txt
1268 C a
1268 C a
1269 C b
1269 C b
1270 C foo.txt
1270 C foo.txt
1271 $ cat bar.txt
1271 $ cat bar.txt
1272 bar
1272 bar
1273
1273
1274 Use delayedstrip to strip inside a transaction
1274 Use delayedstrip to strip inside a transaction
1275
1275
1276 $ cd $TESTTMP
1276 $ cd $TESTTMP
1277 $ hg init delayedstrip
1277 $ hg init delayedstrip
1278 $ cd delayedstrip
1278 $ cd delayedstrip
1279 $ hg debugdrawdag <<'EOS'
1279 $ hg debugdrawdag <<'EOS'
1280 > D
1280 > D
1281 > |
1281 > |
1282 > C F H # Commit on top of "I",
1282 > C F H # Commit on top of "I",
1283 > | |/| # Strip B+D+I+E+G+H+Z
1283 > | |/| # Strip B+D+I+E+G+H+Z
1284 > I B E G
1284 > I B E G
1285 > \|/
1285 > \|/
1286 > A Z
1286 > A Z
1287 > EOS
1287 > EOS
1288 $ cp -R . ../scmutilcleanup
1288 $ cp -R . ../scmutilcleanup
1289
1289
1290 $ hg up -C I
1290 $ hg up -C I
1291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1292 $ echo 3 >> I
1292 $ echo 3 >> I
1293 $ cat > $TESTTMP/delayedstrip.py <<EOF
1293 $ cat > $TESTTMP/delayedstrip.py <<EOF
1294 > from mercurial import commands, registrar, repair
1294 > from mercurial import commands, registrar, repair
1295 > cmdtable = {}
1295 > cmdtable = {}
1296 > command = registrar.command(cmdtable)
1296 > command = registrar.command(cmdtable)
1297 > @command(b'testdelayedstrip')
1297 > @command(b'testdelayedstrip')
1298 > def testdelayedstrip(ui, repo):
1298 > def testdelayedstrip(ui, repo):
1299 > def getnodes(expr):
1299 > def getnodes(expr):
1300 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1300 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1301 > with repo.wlock():
1301 > with repo.wlock():
1302 > with repo.lock():
1302 > with repo.lock():
1303 > with repo.transaction(b'delayedstrip'):
1303 > with repo.transaction(b'delayedstrip'):
1304 > repair.delayedstrip(ui, repo, getnodes(b'B+I+Z+D+E'), b'J')
1304 > repair.delayedstrip(ui, repo, getnodes(b'B+I+Z+D+E'), b'J')
1305 > repair.delayedstrip(ui, repo, getnodes(b'G+H+Z'), b'I')
1305 > repair.delayedstrip(ui, repo, getnodes(b'G+H+Z'), b'I')
1306 > commands.commit(ui, repo, message=b'J', date=b'0 0')
1306 > commands.commit(ui, repo, message=b'J', date=b'0 0')
1307 > EOF
1307 > EOF
1308 $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py
1308 $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py
1309 warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22
1309 warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22
1310 saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg
1310 saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg
1311
1311
1312 $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)'
1312 $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)'
1313 @ 6:2f2d51af6205 J
1313 @ 6:2f2d51af6205 J
1314 |
1314 |
1315 o 3:08ebfeb61bac I
1315 o 3:08ebfeb61bac I
1316 |
1316 |
1317 | o 5:64a8289d2492 F
1317 | o 5:64a8289d2492 F
1318 | |
1318 | |
1319 | o 2:7fb047a69f22 E
1319 | o 2:7fb047a69f22 E
1320 |/
1320 |/
1321 | o 4:26805aba1e60 C
1321 | o 4:26805aba1e60 C
1322 | |
1322 | |
1323 | o 1:112478962961 B
1323 | o 1:112478962961 B
1324 |/
1324 |/
1325 o 0:426bada5c675 A
1325 o 0:426bada5c675 A
1326
1326
1327 Test high-level scmutil.cleanupnodes API
1327 Test high-level scmutil.cleanupnodes API
1328
1328
1329 $ cd $TESTTMP/scmutilcleanup
1329 $ cd $TESTTMP/scmutilcleanup
1330 $ hg debugdrawdag <<'EOS'
1330 $ hg debugdrawdag <<'EOS'
1331 > D2 F2 G2 # D2, F2, G2 are replacements for D, F, G
1331 > D2 F2 G2 # D2, F2, G2 are replacements for D, F, G
1332 > | | |
1332 > | | |
1333 > C H G
1333 > C H G
1334 > EOS
1334 > EOS
1335 $ for i in B C D F G I Z; do
1335 $ for i in B C D F G I Z; do
1336 > hg bookmark -i -r $i b-$i
1336 > hg bookmark -i -r $i b-$i
1337 > done
1337 > done
1338 $ hg bookmark -i -r E 'b-F@divergent1'
1338 $ hg bookmark -i -r E 'b-F@divergent1'
1339 $ hg bookmark -i -r H 'b-F@divergent2'
1339 $ hg bookmark -i -r H 'b-F@divergent2'
1340 $ hg bookmark -i -r G 'b-F@divergent3'
1340 $ hg bookmark -i -r G 'b-F@divergent3'
1341 $ cp -R . ../scmutilcleanup.obsstore
1341 $ cp -R . ../scmutilcleanup.obsstore
1342
1342
1343 $ cat > $TESTTMP/scmutilcleanup.py <<EOF
1343 $ cat > $TESTTMP/scmutilcleanup.py <<EOF
1344 > from mercurial import registrar, scmutil
1344 > from mercurial import registrar, scmutil
1345 > cmdtable = {}
1345 > cmdtable = {}
1346 > command = registrar.command(cmdtable)
1346 > command = registrar.command(cmdtable)
1347 > @command(b'testnodescleanup')
1347 > @command(b'testnodescleanup')
1348 > def testnodescleanup(ui, repo):
1348 > def testnodescleanup(ui, repo):
1349 > def nodes(expr):
1349 > def nodes(expr):
1350 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1350 > return [repo.changelog.node(r) for r in repo.revs(expr)]
1351 > def node(expr):
1351 > def node(expr):
1352 > return nodes(expr)[0]
1352 > return nodes(expr)[0]
1353 > with repo.wlock():
1353 > with repo.wlock():
1354 > with repo.lock():
1354 > with repo.lock():
1355 > with repo.transaction(b'delayedstrip'):
1355 > with repo.transaction(b'delayedstrip'):
1356 > mapping = {node(b'F'): [node(b'F2')],
1356 > mapping = {node(b'F'): [node(b'F2')],
1357 > node(b'D'): [node(b'D2')],
1357 > node(b'D'): [node(b'D2')],
1358 > node(b'G'): [node(b'G2')]}
1358 > node(b'G'): [node(b'G2')]}
1359 > scmutil.cleanupnodes(repo, mapping, b'replace')
1359 > scmutil.cleanupnodes(repo, mapping, b'replace')
1360 > scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'),
1360 > scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'),
1361 > b'replace')
1361 > b'replace')
1362 > EOF
1362 > EOF
1363 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1363 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1364 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
1364 warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60
1365 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg
1365 saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg
1366
1366
1367 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1367 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1368 o 8:1473d4b996d1 G2 b-F@divergent3 b-G
1368 o 8:1473d4b996d1 G2 b-F@divergent3 b-G
1369 |
1369 |
1370 | o 7:d11b3456a873 F2 b-F
1370 | o 7:d11b3456a873 F2 b-F
1371 | |
1371 | |
1372 | o 5:5cb05ba470a7 H
1372 | o 5:5cb05ba470a7 H
1373 |/|
1373 |/|
1374 | o 3:7fb047a69f22 E b-F@divergent1
1374 | o 3:7fb047a69f22 E b-F@divergent1
1375 | |
1375 | |
1376 | | o 6:7c78f703e465 D2 b-D
1376 | | o 6:7c78f703e465 D2 b-D
1377 | | |
1377 | | |
1378 | | o 4:26805aba1e60 C
1378 | | o 4:26805aba1e60 C
1379 | | |
1379 | | |
1380 | | o 2:112478962961 B
1380 | | o 2:112478962961 B
1381 | |/
1381 | |/
1382 o | 1:1fc8102cda62 G
1382 o | 1:1fc8102cda62 G
1383 /
1383 /
1384 o 0:426bada5c675 A b-B b-C b-I
1384 o 0:426bada5c675 A b-B b-C b-I
1385
1385
1386 $ hg bookmark
1386 $ hg bookmark
1387 b-B 0:426bada5c675
1387 b-B 0:426bada5c675
1388 b-C 0:426bada5c675
1388 b-C 0:426bada5c675
1389 b-D 6:7c78f703e465
1389 b-D 6:7c78f703e465
1390 b-F 7:d11b3456a873
1390 b-F 7:d11b3456a873
1391 b-F@divergent1 3:7fb047a69f22
1391 b-F@divergent1 3:7fb047a69f22
1392 b-F@divergent3 8:1473d4b996d1
1392 b-F@divergent3 8:1473d4b996d1
1393 b-G 8:1473d4b996d1
1393 b-G 8:1473d4b996d1
1394 b-I 0:426bada5c675
1394 b-I 0:426bada5c675
1395 b-Z -1:000000000000
1395 b-Z -1:000000000000
1396
1396
1397 Test the above using obsstore "by the way". Not directly related to strip, but
1397 Test the above using obsstore "by the way". Not directly related to strip, but
1398 we have reusable code here
1398 we have reusable code here
1399
1399
1400 $ cd $TESTTMP/scmutilcleanup.obsstore
1400 $ cd $TESTTMP/scmutilcleanup.obsstore
1401 $ cat >> .hg/hgrc <<EOF
1401 $ cat >> .hg/hgrc <<EOF
1402 > [experimental]
1402 > [experimental]
1403 > evolution=true
1403 > evolution=true
1404 > evolution.track-operation=1
1404 > evolution.track-operation=1
1405 > EOF
1405 > EOF
1406
1406
1407 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1407 $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
1408 4 new orphan changesets
1408 4 new orphan changesets
1409
1409
1410 $ rm .hg/localtags
1410 $ rm .hg/localtags
1411 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1411 $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)'
1412 * 12:1473d4b996d1 G2 b-F@divergent3 b-G
1412 * 12:1473d4b996d1 G2 b-F@divergent3 b-G
1413 |
1413 |
1414 | * 11:d11b3456a873 F2 b-F
1414 | * 11:d11b3456a873 F2 b-F
1415 | |
1415 | |
1416 | * 8:5cb05ba470a7 H
1416 | * 8:5cb05ba470a7 H
1417 |/|
1417 |/|
1418 | o 4:7fb047a69f22 E b-F@divergent1
1418 | o 4:7fb047a69f22 E b-F@divergent1
1419 | |
1419 | |
1420 | | * 10:7c78f703e465 D2 b-D
1420 | | * 10:7c78f703e465 D2 b-D
1421 | | |
1421 | | |
1422 | | x 6:26805aba1e60 C
1422 | | x 6:26805aba1e60 C
1423 | | |
1423 | | |
1424 | | x 3:112478962961 B
1424 | | x 3:112478962961 B
1425 | |/
1425 | |/
1426 x | 1:1fc8102cda62 G
1426 x | 1:1fc8102cda62 G
1427 /
1427 /
1428 o 0:426bada5c675 A b-B b-C b-I
1428 o 0:426bada5c675 A b-B b-C b-I
1429
1429
1430 $ hg debugobsolete
1430 $ hg debugobsolete
1431 1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1431 1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1432 64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1432 64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
1433 f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
1433 f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
1434 48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1434 48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1435 112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1435 112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1436 08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1436 08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1437 26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1437 26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'}
1438 $ cd ..
1438 $ cd ..
1439
1439
1440 Test that obsmarkers are restored even when not using generaldelta
1440 Test that obsmarkers are restored even when not using generaldelta
1441
1441
1442 $ hg --config format.usegeneraldelta=no init issue5678
1442 $ hg --config format.usegeneraldelta=no init issue5678
1443 $ cd issue5678
1443 $ cd issue5678
1444 $ cat >> .hg/hgrc <<EOF
1444 $ cat >> .hg/hgrc <<EOF
1445 > [experimental]
1445 > [experimental]
1446 > evolution=true
1446 > evolution=true
1447 > EOF
1447 > EOF
1448 $ echo a > a
1448 $ echo a > a
1449 $ hg ci -Aqm a
1449 $ hg ci -Aqm a
1450 $ hg ci --amend -m a2
1450 $ hg ci --amend -m a2
1451 $ hg debugobsolete
1451 $ hg debugobsolete
1452 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1452 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1453 $ hg strip .
1453 $ hg strip .
1454 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1454 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1455 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
1455 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
1456 $ hg unbundle -q .hg/strip-backup/*
1456 $ hg unbundle -q .hg/strip-backup/*
1457 $ hg debugobsolete
1457 $ hg debugobsolete
1458 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1458 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
1459 $ cd ..
1459 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now