##// END OF EJS Templates
hidden: drop the hidden cache logic...
marmoute -
r32477:1cc7c96c default
parent child Browse files
Show More
@@ -1,399 +1,317 b''
1 1 # repoview.py - Filtered view of a localrepo object
2 2 #
3 3 # Copyright 2012 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
4 4 # Logilab SA <contact@logilab.fr>
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 from __future__ import absolute_import
10 10
11 11 import copy
12 import hashlib
13 import struct
14 12
15 13 from .node import nullrev
16 14 from . import (
17 error,
18 15 obsolete,
19 16 phases,
20 17 tags as tagsmod,
21 18 )
22 19
23 20 def hideablerevs(repo):
24 21 """Revision candidates to be hidden
25 22
26 23 This is a standalone function to allow extensions to wrap it.
27 24
28 25 Because we use the set of immutable changesets as a fallback subset in
29 26 branchmap (see mercurial.branchmap.subsettable), you cannot set "public"
30 27 changesets as "hideable". Doing so would break multiple code assertions and
31 28 lead to crashes."""
32 29 return obsolete.getrevs(repo, 'obsolete')
33 30
34 31 def revealedrevs(repo):
35 32 """Non-cacheable revisions blocking hidden changesets from being filtered.
36 33
37 34 Get revisions that will block hidden changesets and are likely to change,
38 35 but unlikely to create hidden blockers. They won't be cached, so be careful
39 36 with adding additional computation."""
40 37
41 38 cl = repo.changelog
42 39 blockers = set()
43 40 blockers.update([par.rev() for par in repo[None].parents()])
44 41 blockers.update([cl.rev(bm) for bm in repo._bookmarks.values()])
45 42
46 43 tags = {}
47 44 tagsmod.readlocaltags(repo.ui, repo, tags, {})
48 45 if tags:
49 46 rev, nodemap = cl.rev, cl.nodemap
50 47 blockers.update(rev(t[0]) for t in tags.values() if t[0] in nodemap)
51 48 return blockers
52 49
53 50 def _getstatichidden(repo):
54 51 """Revision to be hidden (disregarding dynamic blocker)
55 52
56 53 To keep a consistent graph, we cannot hide any revisions with
57 54 non-hidden descendants. This function computes the set of
58 55 revisions that could be hidden while keeping the graph consistent.
59 56
60 57 A second pass will be done to apply "dynamic blocker" like bookmarks or
61 58 working directory parents.
62 59
63 60 """
64 61 assert not repo.changelog.filteredrevs
65 62 hidden = hideablerevs(repo)
66 63 if hidden:
67 64 pfunc = repo.changelog.parentrevs
68 65
69 66 mutablephases = (phases.draft, phases.secret)
70 67 mutable = repo._phasecache.getrevset(repo, mutablephases)
71 68 blockers = _consistencyblocker(pfunc, hidden, mutable)
72 69
73 70 if blockers:
74 71 hidden = hidden - _domainancestors(pfunc, blockers, mutable)
75 72 return hidden
76 73
77 74 def _consistencyblocker(pfunc, hideable, domain):
78 75 """return non-hideable changeset blocking hideable one
79 76
80 77 For consistency, we cannot actually hide a changeset if one of it children
81 78 are visible, this function find such children.
82 79 """
83 80 others = domain - hideable
84 81 blockers = set()
85 82 for r in others:
86 83 for p in pfunc(r):
87 84 if p != nullrev and p in hideable:
88 85 blockers.add(r)
89 86 break
90 87 return blockers
91 88
92 89 def _domainancestors(pfunc, revs, domain):
93 90 """return ancestors of 'revs' within 'domain'
94 91
95 92 - pfunc(r): a funtion returning parent of 'r',
96 93 - revs: iterable of revnum,
97 94 - domain: consistent set of revnum.
98 95
99 96 The domain must be consistent: no connected subset are the ancestors of
100 97 another connected subset. In other words, if the parents of a revision are
101 98 not in the domains, no other ancestors of that revision. For example, with
102 99 the following graph:
103 100
104 101 F
105 102 |
106 103 E
107 104 | D
108 105 | |
109 106 | C
110 107 |/
111 108 B
112 109 |
113 110 A
114 111
115 112 If C, D, E and F are in the domain but B is not, A cannot be ((A) is an
116 113 ancestors disconnected subset disconnected of (C+D)).
117 114
118 115 (Ancestors are returned inclusively)
119 116 """
120 117 stack = list(revs)
121 118 ancestors = set(stack)
122 119 while stack:
123 120 for p in pfunc(stack.pop()):
124 121 if p != nullrev and p in domain and p not in ancestors:
125 122 ancestors.add(p)
126 123 stack.append(p)
127 124 return ancestors
128 125
129 cacheversion = 1
130 cachefile = 'cache/hidden'
131
132 def cachehash(repo, hideable):
133 """return sha1 hash of repository data to identify a valid cache.
134
135 We calculate a sha1 of repo heads and the content of the obsstore and write
136 it to the cache. Upon reading we can easily validate by checking the hash
137 against the stored one and discard the cache in case the hashes don't match.
138 """
139 h = hashlib.sha1()
140 h.update(''.join(repo.heads()))
141 h.update('%d' % hash(frozenset(hideable)))
142 return h.digest()
143
144 def _writehiddencache(cachefile, cachehash, hidden):
145 """write hidden data to a cache file"""
146 data = struct.pack('>%ii' % len(hidden), *sorted(hidden))
147 cachefile.write(struct.pack(">H", cacheversion))
148 cachefile.write(cachehash)
149 cachefile.write(data)
150
151 def trywritehiddencache(repo, hideable, hidden):
152 """write cache of hidden changesets to disk
153
154 Will not write the cache if a wlock cannot be obtained lazily.
155 The cache consists of a head of 22byte:
156 2 byte version number of the cache
157 20 byte sha1 to validate the cache
158 n*4 byte hidden revs
159 """
160 wlock = fh = None
161 try:
162 wlock = repo.wlock(wait=False)
163 # write cache to file
164 newhash = cachehash(repo, hideable)
165 fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
166 _writehiddencache(fh, newhash, hidden)
167 fh.close()
168 except (IOError, OSError):
169 repo.ui.debug('error writing hidden changesets cache\n')
170 except error.LockHeld:
171 repo.ui.debug('cannot obtain lock to write hidden changesets cache\n')
172 finally:
173 if wlock:
174 wlock.release()
175
176 def _readhiddencache(repo, cachefilename, newhash):
177 hidden = fh = None
178 try:
179 if repo.vfs.exists(cachefile):
180 fh = repo.vfs.open(cachefile, 'rb')
181 version, = struct.unpack(">H", fh.read(2))
182 oldhash = fh.read(20)
183 if (cacheversion, oldhash) == (version, newhash):
184 # cache is valid, so we can start reading the hidden revs
185 data = fh.read()
186 count = len(data) / 4
187 hidden = frozenset(struct.unpack('>%ii' % count, data))
188 return hidden
189 except struct.error:
190 repo.ui.debug('corrupted hidden cache\n')
191 # No need to fix the content as it will get rewritten
192 return None
193 except (IOError, OSError):
194 repo.ui.debug('cannot read hidden cache\n')
195 return None
196 finally:
197 if fh:
198 fh.close()
199
200 def tryreadcache(repo, hideable):
201 """read a cache if the cache exists and is valid, otherwise returns None."""
202 newhash = cachehash(repo, hideable)
203 return _readhiddencache(repo, cachefile, newhash)
204
205 126 def computehidden(repo):
206 127 """compute the set of hidden revision to filter
207 128
208 129 During most operation hidden should be filtered."""
209 130 assert not repo.changelog.filteredrevs
210 131
211 132 hidden = frozenset()
212 133 hideable = hideablerevs(repo)
213 134 if hideable:
214 135 cl = repo.changelog
215 hidden = tryreadcache(repo, hideable)
216 if hidden is None:
217 136 hidden = frozenset(_getstatichidden(repo))
218 trywritehiddencache(repo, hideable, hidden)
219 137
220 138 # check if we have wd parents, bookmarks or tags pointing to hidden
221 139 # changesets and remove those.
222 140 dynamic = hidden & revealedrevs(repo)
223 141 if dynamic:
224 142 pfunc = cl.parentrevs
225 143 mutablephases = (phases.draft, phases.secret)
226 144 mutable = repo._phasecache.getrevset(repo, mutablephases)
227 145 hidden = hidden - _domainancestors(pfunc, dynamic, mutable)
228 146 return hidden
229 147
230 148 def computeunserved(repo):
231 149 """compute the set of revision that should be filtered when used a server
232 150
233 151 Secret and hidden changeset should not pretend to be here."""
234 152 assert not repo.changelog.filteredrevs
235 153 # fast path in simple case to avoid impact of non optimised code
236 154 hiddens = filterrevs(repo, 'visible')
237 155 if phases.hassecret(repo):
238 156 cl = repo.changelog
239 157 secret = phases.secret
240 158 getphase = repo._phasecache.phase
241 159 first = min(cl.rev(n) for n in repo._phasecache.phaseroots[secret])
242 160 revs = cl.revs(start=first)
243 161 secrets = set(r for r in revs if getphase(repo, r) >= secret)
244 162 return frozenset(hiddens | secrets)
245 163 else:
246 164 return hiddens
247 165
248 166 def computemutable(repo):
249 167 """compute the set of revision that should be filtered when used a server
250 168
251 169 Secret and hidden changeset should not pretend to be here."""
252 170 assert not repo.changelog.filteredrevs
253 171 # fast check to avoid revset call on huge repo
254 172 if any(repo._phasecache.phaseroots[1:]):
255 173 getphase = repo._phasecache.phase
256 174 maymutable = filterrevs(repo, 'base')
257 175 return frozenset(r for r in maymutable if getphase(repo, r))
258 176 return frozenset()
259 177
260 178 def computeimpactable(repo):
261 179 """Everything impactable by mutable revision
262 180
263 181 The immutable filter still have some chance to get invalidated. This will
264 182 happen when:
265 183
266 184 - you garbage collect hidden changeset,
267 185 - public phase is moved backward,
268 186 - something is changed in the filtering (this could be fixed)
269 187
270 188 This filter out any mutable changeset and any public changeset that may be
271 189 impacted by something happening to a mutable revision.
272 190
273 191 This is achieved by filtered everything with a revision number egal or
274 192 higher than the first mutable changeset is filtered."""
275 193 assert not repo.changelog.filteredrevs
276 194 cl = repo.changelog
277 195 firstmutable = len(cl)
278 196 for roots in repo._phasecache.phaseroots[1:]:
279 197 if roots:
280 198 firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
281 199 # protect from nullrev root
282 200 firstmutable = max(0, firstmutable)
283 201 return frozenset(xrange(firstmutable, len(cl)))
284 202
285 203 # function to compute filtered set
286 204 #
287 205 # When adding a new filter you MUST update the table at:
288 206 # mercurial.branchmap.subsettable
289 207 # Otherwise your filter will have to recompute all its branches cache
290 208 # from scratch (very slow).
291 209 filtertable = {'visible': computehidden,
292 210 'served': computeunserved,
293 211 'immutable': computemutable,
294 212 'base': computeimpactable}
295 213
296 214 def filterrevs(repo, filtername):
297 215 """returns set of filtered revision for this filter name"""
298 216 if filtername not in repo.filteredrevcache:
299 217 func = filtertable[filtername]
300 218 repo.filteredrevcache[filtername] = func(repo.unfiltered())
301 219 return repo.filteredrevcache[filtername]
302 220
303 221 class repoview(object):
304 222 """Provide a read/write view of a repo through a filtered changelog
305 223
306 224 This object is used to access a filtered version of a repository without
307 225 altering the original repository object itself. We can not alter the
308 226 original object for two main reasons:
309 227 - It prevents the use of a repo with multiple filters at the same time. In
310 228 particular when multiple threads are involved.
311 229 - It makes scope of the filtering harder to control.
312 230
313 231 This object behaves very closely to the original repository. All attribute
314 232 operations are done on the original repository:
315 233 - An access to `repoview.someattr` actually returns `repo.someattr`,
316 234 - A write to `repoview.someattr` actually sets value of `repo.someattr`,
317 235 - A deletion of `repoview.someattr` actually drops `someattr`
318 236 from `repo.__dict__`.
319 237
320 238 The only exception is the `changelog` property. It is overridden to return
321 239 a (surface) copy of `repo.changelog` with some revisions filtered. The
322 240 `filtername` attribute of the view control the revisions that need to be
323 241 filtered. (the fact the changelog is copied is an implementation detail).
324 242
325 243 Unlike attributes, this object intercepts all method calls. This means that
326 244 all methods are run on the `repoview` object with the filtered `changelog`
327 245 property. For this purpose the simple `repoview` class must be mixed with
328 246 the actual class of the repository. This ensures that the resulting
329 247 `repoview` object have the very same methods than the repo object. This
330 248 leads to the property below.
331 249
332 250 repoview.method() --> repo.__class__.method(repoview)
333 251
334 252 The inheritance has to be done dynamically because `repo` can be of any
335 253 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
336 254 """
337 255
338 256 def __init__(self, repo, filtername):
339 257 object.__setattr__(self, r'_unfilteredrepo', repo)
340 258 object.__setattr__(self, r'filtername', filtername)
341 259 object.__setattr__(self, r'_clcachekey', None)
342 260 object.__setattr__(self, r'_clcache', None)
343 261
344 262 # not a propertycache on purpose we shall implement a proper cache later
345 263 @property
346 264 def changelog(self):
347 265 """return a filtered version of the changeset
348 266
349 267 this changelog must not be used for writing"""
350 268 # some cache may be implemented later
351 269 unfi = self._unfilteredrepo
352 270 unfichangelog = unfi.changelog
353 271 # bypass call to changelog.method
354 272 unfiindex = unfichangelog.index
355 273 unfilen = len(unfiindex) - 1
356 274 unfinode = unfiindex[unfilen - 1][7]
357 275
358 276 revs = filterrevs(unfi, self.filtername)
359 277 cl = self._clcache
360 278 newkey = (unfilen, unfinode, hash(revs), unfichangelog._delayed)
361 279 # if cl.index is not unfiindex, unfi.changelog would be
362 280 # recreated, and our clcache refers to garbage object
363 281 if (cl is not None and
364 282 (cl.index is not unfiindex or newkey != self._clcachekey)):
365 283 cl = None
366 284 # could have been made None by the previous if
367 285 if cl is None:
368 286 cl = copy.copy(unfichangelog)
369 287 cl.filteredrevs = revs
370 288 object.__setattr__(self, r'_clcache', cl)
371 289 object.__setattr__(self, r'_clcachekey', newkey)
372 290 return cl
373 291
374 292 def unfiltered(self):
375 293 """Return an unfiltered version of a repo"""
376 294 return self._unfilteredrepo
377 295
378 296 def filtered(self, name):
379 297 """Return a filtered version of a repository"""
380 298 if name == self.filtername:
381 299 return self
382 300 return self.unfiltered().filtered(name)
383 301
384 302 # everything access are forwarded to the proxied repo
385 303 def __getattr__(self, attr):
386 304 return getattr(self._unfilteredrepo, attr)
387 305
388 306 def __setattr__(self, attr, value):
389 307 return setattr(self._unfilteredrepo, attr, value)
390 308
391 309 def __delattr__(self, attr):
392 310 return delattr(self._unfilteredrepo, attr)
393 311
394 312 # The `requirements` attribute is initialized during __init__. But
395 313 # __getattr__ won't be called as it also exists on the class. We need
396 314 # explicit forwarding to main repo here
397 315 @property
398 316 def requirements(self):
399 317 return self._unfilteredrepo.requirements
@@ -1,100 +1,96 b''
1 1 Enable obsolete markers
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [experimental]
5 5 > evolution=createmarkers
6 6 > [phases]
7 7 > publish=False
8 8 > EOF
9 9
10 10 Build a repo with some cacheable bits:
11 11
12 12 $ hg init a
13 13 $ cd a
14 14
15 15 $ echo a > a
16 16 $ hg ci -qAm0
17 17 $ hg tag t1
18 18 $ hg book -i bk1
19 19
20 20 $ hg branch -q b2
21 21 $ hg ci -Am1
22 22 $ hg tag t2
23 23
24 24 $ echo dumb > dumb
25 25 $ hg ci -qAmdumb
26 26 $ hg debugobsolete b1174d11b69e63cb0c5726621a43c859f0858d7f
27 27
28 28 $ hg phase -pr t1
29 29 $ hg phase -fsr t2
30 30
31 31 Make a helper function to check cache damage invariants:
32 32
33 33 - command output shouldn't change
34 34 - cache should be present after first use
35 35 - corruption/repair should be silent (no exceptions or warnings)
36 36 - cache should survive deletion, overwrite, and append
37 37 - unreadable / unwriteable caches should be ignored
38 38 - cache should be rebuilt after corruption
39 39
40 40 $ damage() {
41 41 > CMD=$1
42 42 > CACHE=.hg/cache/$2
43 43 > CLEAN=$3
44 44 > hg $CMD > before
45 45 > test -f $CACHE || echo "not present"
46 46 > echo bad > $CACHE
47 47 > test -z "$CLEAN" || $CLEAN
48 48 > hg $CMD > after
49 49 > diff -u before after || echo "*** overwrite corruption"
50 50 > echo corruption >> $CACHE
51 51 > test -z "$CLEAN" || $CLEAN
52 52 > hg $CMD > after
53 53 > diff -u before after || echo "*** append corruption"
54 54 > rm $CACHE
55 55 > mkdir $CACHE
56 56 > test -z "$CLEAN" || $CLEAN
57 57 > hg $CMD > after
58 58 > diff -u before after || echo "*** read-only corruption"
59 59 > test -d $CACHE || echo "*** directory clobbered"
60 60 > rmdir $CACHE
61 61 > test -z "$CLEAN" || $CLEAN
62 62 > hg $CMD > after
63 63 > diff -u before after || echo "*** missing corruption"
64 64 > test -f $CACHE || echo "not rebuilt"
65 65 > }
66 66
67 67 Beat up tags caches:
68 68
69 69 $ damage "tags --hidden" tags2
70 70 $ damage tags tags2-visible
71 71 $ damage "tag -f t3" hgtagsfnodes1
72 72
73 Beat up hidden cache:
74
75 $ damage log hidden
76
77 73 Beat up branch caches:
78 74
79 75 $ damage branches branch2-base "rm .hg/cache/branch2-[vs]*"
80 76 $ damage branches branch2-served "rm .hg/cache/branch2-[bv]*"
81 77 $ damage branches branch2-visible
82 78 $ damage "log -r branch(.)" rbc-names-v1
83 79 $ damage "log -r branch(default)" rbc-names-v1
84 80 $ damage "log -r branch(b2)" rbc-revs-v1
85 81
86 82 We currently can't detect an rbc cache with unknown names:
87 83
88 84 $ damage "log -qr branch(b2)" rbc-names-v1
89 85 --- before * (glob)
90 86 +++ after * (glob)
91 87 @@ -1,8 +?,0 @@ (glob)
92 88 -2:5fb7d38b9dc4
93 89 -3:60b597ffdafa
94 90 -4:b1174d11b69e
95 91 -5:6354685872c0
96 92 -6:5ebc725f1bef
97 93 -7:7b76eec2f273
98 94 -8:ef3428d9d644
99 95 -9:ba7a936bc03c
100 96 *** append corruption
@@ -1,1315 +1,1296 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [phases]
3 3 > # public changeset are not obsolete
4 4 > publish=false
5 5 > [ui]
6 6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(troubles, ' {troubles}')}) [{tags} {bookmarks}] {desc|firstline}\n"
7 7 > EOF
8 8 $ mkcommit() {
9 9 > echo "$1" > "$1"
10 10 > hg add "$1"
11 11 > hg ci -m "add $1"
12 12 > }
13 13 $ getid() {
14 14 > hg log -T "{node}\n" --hidden -r "desc('$1')"
15 15 > }
16 16
17 17 $ cat > debugkeys.py <<EOF
18 18 > def reposetup(ui, repo):
19 19 > class debugkeysrepo(repo.__class__):
20 20 > def listkeys(self, namespace):
21 21 > ui.write('listkeys %s\n' % (namespace,))
22 22 > return super(debugkeysrepo, self).listkeys(namespace)
23 23 >
24 24 > if repo.local():
25 25 > repo.__class__ = debugkeysrepo
26 26 > EOF
27 27
28 28 $ hg init tmpa
29 29 $ cd tmpa
30 30 $ mkcommit kill_me
31 31
32 32 Checking that the feature is properly disabled
33 33
34 34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 35 abort: creating obsolete markers is not enabled on this repo
36 36 [255]
37 37
38 38 Enabling it
39 39
40 40 $ cat >> $HGRCPATH << EOF
41 41 > [experimental]
42 42 > evolution=createmarkers,exchange
43 43 > EOF
44 44
45 45 Killing a single changeset without replacement
46 46
47 47 $ hg debugobsolete 0
48 48 abort: changeset references must be full hexadecimal node identifiers
49 49 [255]
50 50 $ hg debugobsolete '00'
51 51 abort: changeset references must be full hexadecimal node identifiers
52 52 [255]
53 53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
54 54 $ hg debugobsolete
55 55 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'babar'}
56 56
57 57 (test that mercurial is not confused)
58 58
59 59 $ hg up null --quiet # having 0 as parent prevents it to be hidden
60 60 $ hg tip
61 61 -1:000000000000 (public) [tip ]
62 62 $ hg up --hidden tip --quiet
63 63
64 64 Killing a single changeset with itself should fail
65 65 (simple local safeguard)
66 66
67 67 $ hg debugobsolete `getid kill_me` `getid kill_me`
68 68 abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
69 69 [255]
70 70
71 71 $ cd ..
72 72
73 73 Killing a single changeset with replacement
74 74 (and testing the format option)
75 75
76 76 $ hg init tmpb
77 77 $ cd tmpb
78 78 $ mkcommit a
79 79 $ mkcommit b
80 80 $ mkcommit original_c
81 81 $ hg up "desc('b')"
82 82 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
83 83 $ mkcommit new_c
84 84 created new head
85 85 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
86 86 $ hg debugobsolete --config format.obsstore-version=0 --flag 12 `getid original_c` `getid new_c` -d '121 120'
87 87 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
88 88 2:245bde4270cd add original_c
89 89 $ hg debugrevlog -cd
90 90 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
91 91 0 -1 -1 0 59 0 0 0 0 58 58 0 1 0
92 92 1 0 -1 59 118 59 59 0 0 58 116 0 1 0
93 93 2 1 -1 118 193 118 118 59 0 76 192 0 1 0
94 94 3 1 -1 193 260 193 193 59 0 66 258 0 2 0
95 95 $ hg debugobsolete
96 96 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
97 97
98 98 (check for version number of the obsstore)
99 99
100 100 $ dd bs=1 count=1 if=.hg/store/obsstore 2>/dev/null
101 101 \x00 (no-eol) (esc)
102 102
103 103 do it again (it read the obsstore before adding new changeset)
104 104
105 105 $ hg up '.^'
106 106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 107 $ mkcommit new_2_c
108 108 created new head
109 109 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
110 110 $ hg debugobsolete
111 111 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
112 112 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
113 113
114 114 Register two markers with a missing node
115 115
116 116 $ hg up '.^'
117 117 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
118 118 $ mkcommit new_3_c
119 119 created new head
120 120 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
121 121 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
122 122 $ hg debugobsolete
123 123 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
124 124 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
125 125 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
126 126 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
127 127
128 128 Test the --index option of debugobsolete command
129 129 $ hg debugobsolete --index
130 130 0 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
131 131 1 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
132 132 2 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
133 133 3 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
134 134
135 135 Refuse pathological nullid successors
136 136 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
137 137 transaction abort!
138 138 rollback completed
139 139 abort: bad obsolescence marker detected: invalid successors nullid
140 140 [255]
141 141
142 142 Check that graphlog detect that a changeset is obsolete:
143 143
144 144 $ hg log -G
145 145 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
146 146 |
147 147 o 1:7c3bad9141dc (draft) [ ] add b
148 148 |
149 149 o 0:1f0dee641bb7 (draft) [ ] add a
150 150
151 151
152 152 check that heads does not report them
153 153
154 154 $ hg heads
155 155 5:5601fb93a350 (draft) [tip ] add new_3_c
156 156 $ hg heads --hidden
157 157 5:5601fb93a350 (draft) [tip ] add new_3_c
158 158 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
159 159 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
160 160 2:245bde4270cd (draft *obsolete*) [ ] add original_c
161 161
162 162
163 163 check that summary does not report them
164 164
165 165 $ hg init ../sink
166 166 $ echo '[paths]' >> .hg/hgrc
167 167 $ echo 'default=../sink' >> .hg/hgrc
168 168 $ hg summary --remote
169 169 parent: 5:5601fb93a350 tip
170 170 add new_3_c
171 171 branch: default
172 172 commit: (clean)
173 173 update: (current)
174 174 phases: 3 draft
175 175 remote: 3 outgoing
176 176
177 177 $ hg summary --remote --hidden
178 178 parent: 5:5601fb93a350 tip
179 179 add new_3_c
180 180 branch: default
181 181 commit: (clean)
182 182 update: 3 new changesets, 4 branch heads (merge)
183 183 phases: 6 draft
184 184 remote: 3 outgoing
185 185
186 186 check that various commands work well with filtering
187 187
188 188 $ hg tip
189 189 5:5601fb93a350 (draft) [tip ] add new_3_c
190 190 $ hg log -r 6
191 191 abort: unknown revision '6'!
192 192 [255]
193 193 $ hg log -r 4
194 194 abort: hidden revision '4'!
195 195 (use --hidden to access hidden revisions)
196 196 [255]
197 197 $ hg debugrevspec 'rev(6)'
198 198 $ hg debugrevspec 'rev(4)'
199 199 $ hg debugrevspec 'null'
200 200 -1
201 201
202 202 Check that public changeset are not accounted as obsolete:
203 203
204 204 $ hg --hidden phase --public 2
205 205 $ hg log -G
206 206 @ 5:5601fb93a350 (draft bumped) [tip ] add new_3_c
207 207 |
208 208 | o 2:245bde4270cd (public) [ ] add original_c
209 209 |/
210 210 o 1:7c3bad9141dc (public) [ ] add b
211 211 |
212 212 o 0:1f0dee641bb7 (public) [ ] add a
213 213
214 214
215 215 And that bumped changeset are detected
216 216 --------------------------------------
217 217
218 218 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
219 219 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
220 220 the public changeset
221 221
222 222 $ hg log --hidden -r 'bumped()'
223 223 5:5601fb93a350 (draft bumped) [tip ] add new_3_c
224 224
225 225 And that we can't push bumped changeset
226 226
227 227 $ hg push ../tmpa -r 0 --force #(make repo related)
228 228 pushing to ../tmpa
229 229 searching for changes
230 230 warning: repository is unrelated
231 231 adding changesets
232 232 adding manifests
233 233 adding file changes
234 234 added 1 changesets with 1 changes to 1 files (+1 heads)
235 235 $ hg push ../tmpa
236 236 pushing to ../tmpa
237 237 searching for changes
238 238 abort: push includes bumped changeset: 5601fb93a350!
239 239 [255]
240 240
241 241 Fixing "bumped" situation
242 242 We need to create a clone of 5 and add a special marker with a flag
243 243
244 244 $ hg summary
245 245 parent: 5:5601fb93a350 tip (bumped)
246 246 add new_3_c
247 247 branch: default
248 248 commit: (clean)
249 249 update: 1 new changesets, 2 branch heads (merge)
250 250 phases: 1 draft
251 251 bumped: 1 changesets
252 252 $ hg up '5^'
253 253 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
254 254 $ hg revert -ar 5
255 255 adding new_3_c
256 256 $ hg ci -m 'add n3w_3_c'
257 257 created new head
258 258 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
259 259 $ hg log -r 'bumped()'
260 260 $ hg log -G
261 261 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
262 262 |
263 263 | o 2:245bde4270cd (public) [ ] add original_c
264 264 |/
265 265 o 1:7c3bad9141dc (public) [ ] add b
266 266 |
267 267 o 0:1f0dee641bb7 (public) [ ] add a
268 268
269 269
270 270 $ cd ..
271 271
272 272 Revision 0 is hidden
273 273 --------------------
274 274
275 275 $ hg init rev0hidden
276 276 $ cd rev0hidden
277 277
278 278 $ mkcommit kill0
279 279 $ hg up -q null
280 280 $ hg debugobsolete `getid kill0`
281 281 $ mkcommit a
282 282 $ mkcommit b
283 283
284 284 Should pick the first visible revision as "repo" node
285 285
286 286 $ hg archive ../archive-null
287 287 $ cat ../archive-null/.hg_archival.txt
288 288 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
289 289 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
290 290 branch: default
291 291 latesttag: null
292 292 latesttagdistance: 2
293 293 changessincelatesttag: 2
294 294
295 295
296 296 $ cd ..
297 297
298 298 Exchange Test
299 299 ============================
300 300
301 301 Destination repo does not have any data
302 302 ---------------------------------------
303 303
304 304 Simple incoming test
305 305
306 306 $ hg init tmpc
307 307 $ cd tmpc
308 308 $ hg incoming ../tmpb
309 309 comparing with ../tmpb
310 310 0:1f0dee641bb7 (public) [ ] add a
311 311 1:7c3bad9141dc (public) [ ] add b
312 312 2:245bde4270cd (public) [ ] add original_c
313 313 6:6f9641995072 (draft) [tip ] add n3w_3_c
314 314
315 315 Try to pull markers
316 316 (extinct changeset are excluded but marker are pushed)
317 317
318 318 $ hg pull ../tmpb
319 319 pulling from ../tmpb
320 320 requesting all changes
321 321 adding changesets
322 322 adding manifests
323 323 adding file changes
324 324 added 4 changesets with 4 changes to 4 files (+1 heads)
325 325 5 new obsolescence markers
326 326 (run 'hg heads' to see heads, 'hg merge' to merge)
327 327 $ hg debugobsolete
328 328 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
329 329 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
330 330 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
331 331 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
332 332 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
333 333
334 334 Rollback//Transaction support
335 335
336 336 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
337 337 $ hg debugobsolete
338 338 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
339 339 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
340 340 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
341 341 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
342 342 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
343 343 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
344 344 $ hg rollback -n
345 345 repository tip rolled back to revision 3 (undo debugobsolete)
346 346 $ hg rollback
347 347 repository tip rolled back to revision 3 (undo debugobsolete)
348 348 $ hg debugobsolete
349 349 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
350 350 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
351 351 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
352 352 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
353 353 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
354 354
355 355 $ cd ..
356 356
357 357 Try to push markers
358 358
359 359 $ hg init tmpd
360 360 $ hg -R tmpb push tmpd
361 361 pushing to tmpd
362 362 searching for changes
363 363 adding changesets
364 364 adding manifests
365 365 adding file changes
366 366 added 4 changesets with 4 changes to 4 files (+1 heads)
367 367 5 new obsolescence markers
368 368 $ hg -R tmpd debugobsolete | sort
369 369 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
370 370 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
371 371 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
372 372 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
373 373 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
374 374
375 375 Check obsolete keys are exchanged only if source has an obsolete store
376 376
377 377 $ hg init empty
378 378 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
379 379 pushing to tmpd
380 380 listkeys phases
381 381 listkeys bookmarks
382 382 no changes found
383 383 listkeys phases
384 384 [1]
385 385
386 386 clone support
387 387 (markers are copied and extinct changesets are included to allow hardlinks)
388 388
389 389 $ hg clone tmpb clone-dest
390 390 updating to branch default
391 391 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
392 392 $ hg -R clone-dest log -G --hidden
393 393 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
394 394 |
395 395 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c
396 396 |/
397 397 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c
398 398 |/
399 399 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c
400 400 |/
401 401 | o 2:245bde4270cd (public) [ ] add original_c
402 402 |/
403 403 o 1:7c3bad9141dc (public) [ ] add b
404 404 |
405 405 o 0:1f0dee641bb7 (public) [ ] add a
406 406
407 407 $ hg -R clone-dest debugobsolete
408 408 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
409 409 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
410 410 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
411 411 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
412 412 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
413 413
414 414
415 415 Destination repo have existing data
416 416 ---------------------------------------
417 417
418 418 On pull
419 419
420 420 $ hg init tmpe
421 421 $ cd tmpe
422 422 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
423 423 $ hg pull ../tmpb
424 424 pulling from ../tmpb
425 425 requesting all changes
426 426 adding changesets
427 427 adding manifests
428 428 adding file changes
429 429 added 4 changesets with 4 changes to 4 files (+1 heads)
430 430 5 new obsolescence markers
431 431 (run 'hg heads' to see heads, 'hg merge' to merge)
432 432 $ hg debugobsolete
433 433 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
434 434 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
435 435 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
436 436 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
437 437 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
438 438 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
439 439
440 440
441 441 On push
442 442
443 443 $ hg push ../tmpc
444 444 pushing to ../tmpc
445 445 searching for changes
446 446 no changes found
447 447 1 new obsolescence markers
448 448 [1]
449 449 $ hg -R ../tmpc debugobsolete
450 450 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
451 451 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
452 452 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
453 453 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
454 454 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
455 455 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
456 456
457 457 detect outgoing obsolete and unstable
458 458 ---------------------------------------
459 459
460 460
461 461 $ hg log -G
462 462 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
463 463 |
464 464 | o 2:245bde4270cd (public) [ ] add original_c
465 465 |/
466 466 o 1:7c3bad9141dc (public) [ ] add b
467 467 |
468 468 o 0:1f0dee641bb7 (public) [ ] add a
469 469
470 470 $ hg up 'desc("n3w_3_c")'
471 471 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
472 472 $ mkcommit original_d
473 473 $ mkcommit original_e
474 474 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
475 475 $ hg debugobsolete | grep `getid original_d`
476 476 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
477 477 $ hg log -r 'obsolete()'
478 478 4:94b33453f93b (draft *obsolete*) [ ] add original_d
479 479 $ hg summary
480 480 parent: 5:cda648ca50f5 tip (unstable)
481 481 add original_e
482 482 branch: default
483 483 commit: (clean)
484 484 update: 1 new changesets, 2 branch heads (merge)
485 485 phases: 3 draft
486 486 unstable: 1 changesets
487 487 $ hg log -G -r '::unstable()'
488 488 @ 5:cda648ca50f5 (draft unstable) [tip ] add original_e
489 489 |
490 490 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
491 491 |
492 492 o 3:6f9641995072 (draft) [ ] add n3w_3_c
493 493 |
494 494 o 1:7c3bad9141dc (public) [ ] add b
495 495 |
496 496 o 0:1f0dee641bb7 (public) [ ] add a
497 497
498 498
499 499 refuse to push obsolete changeset
500 500
501 501 $ hg push ../tmpc/ -r 'desc("original_d")'
502 502 pushing to ../tmpc/
503 503 searching for changes
504 504 abort: push includes obsolete changeset: 94b33453f93b!
505 505 [255]
506 506
507 507 refuse to push unstable changeset
508 508
509 509 $ hg push ../tmpc/
510 510 pushing to ../tmpc/
511 511 searching for changes
512 512 abort: push includes unstable changeset: cda648ca50f5!
513 513 [255]
514 514
515 515 Test that extinct changeset are properly detected
516 516
517 517 $ hg log -r 'extinct()'
518 518
519 519 Don't try to push extinct changeset
520 520
521 521 $ hg init ../tmpf
522 522 $ hg out ../tmpf
523 523 comparing with ../tmpf
524 524 searching for changes
525 525 0:1f0dee641bb7 (public) [ ] add a
526 526 1:7c3bad9141dc (public) [ ] add b
527 527 2:245bde4270cd (public) [ ] add original_c
528 528 3:6f9641995072 (draft) [ ] add n3w_3_c
529 529 4:94b33453f93b (draft *obsolete*) [ ] add original_d
530 530 5:cda648ca50f5 (draft unstable) [tip ] add original_e
531 531 $ hg push ../tmpf -f # -f because be push unstable too
532 532 pushing to ../tmpf
533 533 searching for changes
534 534 adding changesets
535 535 adding manifests
536 536 adding file changes
537 537 added 6 changesets with 6 changes to 6 files (+1 heads)
538 538 7 new obsolescence markers
539 539
540 540 no warning displayed
541 541
542 542 $ hg push ../tmpf
543 543 pushing to ../tmpf
544 544 searching for changes
545 545 no changes found
546 546 [1]
547 547
548 548 Do not warn about new head when the new head is a successors of a remote one
549 549
550 550 $ hg log -G
551 551 @ 5:cda648ca50f5 (draft unstable) [tip ] add original_e
552 552 |
553 553 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
554 554 |
555 555 o 3:6f9641995072 (draft) [ ] add n3w_3_c
556 556 |
557 557 | o 2:245bde4270cd (public) [ ] add original_c
558 558 |/
559 559 o 1:7c3bad9141dc (public) [ ] add b
560 560 |
561 561 o 0:1f0dee641bb7 (public) [ ] add a
562 562
563 563 $ hg up -q 'desc(n3w_3_c)'
564 564 $ mkcommit obsolete_e
565 565 created new head
566 566 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
567 567 $ hg outgoing ../tmpf # parasite hg outgoing testin
568 568 comparing with ../tmpf
569 569 searching for changes
570 570 6:3de5eca88c00 (draft) [tip ] add obsolete_e
571 571 $ hg push ../tmpf
572 572 pushing to ../tmpf
573 573 searching for changes
574 574 adding changesets
575 575 adding manifests
576 576 adding file changes
577 577 added 1 changesets with 1 changes to 1 files (+1 heads)
578 578 1 new obsolescence markers
579 579
580 580 test relevance computation
581 581 ---------------------------------------
582 582
583 583 Checking simple case of "marker relevance".
584 584
585 585
586 586 Reminder of the repo situation
587 587
588 588 $ hg log --hidden --graph
589 589 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
590 590 |
591 591 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e
592 592 | |
593 593 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d
594 594 |/
595 595 o 3:6f9641995072 (draft) [ ] add n3w_3_c
596 596 |
597 597 | o 2:245bde4270cd (public) [ ] add original_c
598 598 |/
599 599 o 1:7c3bad9141dc (public) [ ] add b
600 600 |
601 601 o 0:1f0dee641bb7 (public) [ ] add a
602 602
603 603
604 604 List of all markers
605 605
606 606 $ hg debugobsolete
607 607 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
608 608 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
609 609 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
610 610 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
611 611 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
612 612 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
613 613 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
614 614 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
615 615
616 616 List of changesets with no chain
617 617
618 618 $ hg debugobsolete --hidden --rev ::2
619 619
620 620 List of changesets that are included on marker chain
621 621
622 622 $ hg debugobsolete --hidden --rev 6
623 623 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
624 624
625 625 List of changesets with a longer chain, (including a pruned children)
626 626
627 627 $ hg debugobsolete --hidden --rev 3
628 628 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
629 629 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
630 630 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
631 631 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
632 632 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
633 633 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
634 634 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
635 635
636 636 List of both
637 637
638 638 $ hg debugobsolete --hidden --rev 3::6
639 639 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
640 640 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
641 641 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
642 642 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
643 643 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
644 644 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
645 645 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
646 646 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
647 647
648 648 List of all markers in JSON
649 649
650 650 $ hg debugobsolete -Tjson
651 651 [
652 652 {
653 653 "date": [1339.0, 0],
654 654 "flag": 0,
655 655 "metadata": {"user": "test"},
656 656 "precnode": "1339133913391339133913391339133913391339",
657 657 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
658 658 },
659 659 {
660 660 "date": [1339.0, 0],
661 661 "flag": 0,
662 662 "metadata": {"user": "test"},
663 663 "precnode": "1337133713371337133713371337133713371337",
664 664 "succnodes": ["5601fb93a350734d935195fee37f4054c529ff39"]
665 665 },
666 666 {
667 667 "date": [121.0, 120],
668 668 "flag": 12,
669 669 "metadata": {"user": "test"},
670 670 "precnode": "245bde4270cd1072a27757984f9cda8ba26f08ca",
671 671 "succnodes": ["cdbce2fbb16313928851e97e0d85413f3f7eb77f"]
672 672 },
673 673 {
674 674 "date": [1338.0, 0],
675 675 "flag": 1,
676 676 "metadata": {"user": "test"},
677 677 "precnode": "5601fb93a350734d935195fee37f4054c529ff39",
678 678 "succnodes": ["6f96419950729f3671185b847352890f074f7557"]
679 679 },
680 680 {
681 681 "date": [1338.0, 0],
682 682 "flag": 0,
683 683 "metadata": {"user": "test"},
684 684 "precnode": "ca819180edb99ed25ceafb3e9584ac287e240b00",
685 685 "succnodes": ["1337133713371337133713371337133713371337"]
686 686 },
687 687 {
688 688 "date": [1337.0, 0],
689 689 "flag": 0,
690 690 "metadata": {"user": "test"},
691 691 "precnode": "cdbce2fbb16313928851e97e0d85413f3f7eb77f",
692 692 "succnodes": ["ca819180edb99ed25ceafb3e9584ac287e240b00"]
693 693 },
694 694 {
695 695 "date": [0.0, 0],
696 696 "flag": 0,
697 697 "metadata": {"user": "test"},
698 698 "parentnodes": ["6f96419950729f3671185b847352890f074f7557"],
699 699 "precnode": "94b33453f93bdb8d457ef9b770851a618bf413e1",
700 700 "succnodes": []
701 701 },
702 702 {
703 703 "date": *, (glob)
704 704 "flag": 0,
705 705 "metadata": {"user": "test"},
706 706 "precnode": "cda648ca50f50482b7055c0b0c4c117bba6733d9",
707 707 "succnodes": ["3de5eca88c00aa039da7399a220f4a5221faa585"]
708 708 }
709 709 ]
710 710
711 711 Template keywords
712 712
713 713 $ hg debugobsolete -r6 -T '{succnodes % "{node|short}"} {date|shortdate}\n'
714 714 3de5eca88c00 ????-??-?? (glob)
715 715 $ hg debugobsolete -r6 -T '{join(metadata % "{key}={value}", " ")}\n'
716 716 user=test
717 717 $ hg debugobsolete -r6 -T '{metadata}\n'
718 718 'user': 'test'
719 719 $ hg debugobsolete -r6 -T '{flag} {get(metadata, "user")}\n'
720 720 0 test
721 721
722 722 Test the debug output for exchange
723 723 ----------------------------------
724 724
725 725 $ hg pull ../tmpb --config 'experimental.obsmarkers-exchange-debug=True' # bundle2
726 726 pulling from ../tmpb
727 727 searching for changes
728 728 no changes found
729 729 obsmarker-exchange: 346 bytes received
730 730
731 731 check hgweb does not explode
732 732 ====================================
733 733
734 734 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
735 735 adding changesets
736 736 adding manifests
737 737 adding file changes
738 738 added 62 changesets with 63 changes to 9 files (+60 heads)
739 739 (run 'hg heads .' to see heads, 'hg merge' to merge)
740 740 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
741 741 > do
742 742 > hg debugobsolete $node
743 743 > done
744 744 $ hg up tip
745 745 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
746 746
747 747 #if serve
748 748
749 749 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
750 750 $ cat hg.pid >> $DAEMON_PIDS
751 751
752 752 check changelog view
753 753
754 754 $ get-with-headers.py --headeronly localhost:$HGPORT 'shortlog/'
755 755 200 Script output follows
756 756
757 757 check graph view
758 758
759 759 $ get-with-headers.py --headeronly localhost:$HGPORT 'graph'
760 760 200 Script output follows
761 761
762 762 check filelog view
763 763
764 764 $ get-with-headers.py --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
765 765 200 Script output follows
766 766
767 767 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/68'
768 768 200 Script output follows
769 769 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
770 770 404 Not Found
771 771 [1]
772 772
773 773 check that web.view config option:
774 774
775 775 $ killdaemons.py hg.pid
776 776 $ cat >> .hg/hgrc << EOF
777 777 > [web]
778 778 > view=all
779 779 > EOF
780 780 $ wait
781 781 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
782 782 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/67'
783 783 200 Script output follows
784 784 $ killdaemons.py hg.pid
785 785
786 786 Checking _enable=False warning if obsolete marker exists
787 787
788 788 $ echo '[experimental]' >> $HGRCPATH
789 789 $ echo "evolution=" >> $HGRCPATH
790 790 $ hg log -r tip
791 791 obsolete feature not enabled but 68 markers found!
792 792 68:c15e9edfca13 (draft) [tip ] add celestine
793 793
794 794 reenable for later test
795 795
796 796 $ echo '[experimental]' >> $HGRCPATH
797 797 $ echo "evolution=createmarkers,exchange" >> $HGRCPATH
798 798
799 799 $ rm hg.pid access.log errors.log
800 800 #endif
801 801
802 802 Several troubles on the same changeset (create an unstable and bumped changeset)
803 803
804 804 $ hg debugobsolete `getid obsolete_e`
805 805 $ hg debugobsolete `getid original_c` `getid babar`
806 806 $ hg log --config ui.logtemplate= -r 'bumped() and unstable()'
807 807 changeset: 7:50c51b361e60
808 808 user: test
809 809 date: Thu Jan 01 00:00:00 1970 +0000
810 810 trouble: unstable, bumped
811 811 summary: add babar
812 812
813 813
814 814 test the "obsolete" templatekw
815 815
816 816 $ hg log -r 'obsolete()'
817 817 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e
818 818
819 819 test the "troubles" templatekw
820 820
821 821 $ hg log -r 'bumped() and unstable()'
822 822 7:50c51b361e60 (draft unstable bumped) [ ] add babar
823 823
824 824 test the default cmdline template
825 825
826 826 $ hg log -T default -r 'bumped()'
827 827 changeset: 7:50c51b361e60
828 828 user: test
829 829 date: Thu Jan 01 00:00:00 1970 +0000
830 830 trouble: unstable, bumped
831 831 summary: add babar
832 832
833 833 $ hg log -T default -r 'obsolete()'
834 834 changeset: 6:3de5eca88c00
835 835 parent: 3:6f9641995072
836 836 user: test
837 837 date: Thu Jan 01 00:00:00 1970 +0000
838 838 summary: add obsolete_e
839 839
840 840
841 841 test summary output
842 842
843 843 $ hg up -r 'bumped() and unstable()'
844 844 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
845 845 $ hg summary
846 846 parent: 7:50c51b361e60 (unstable, bumped)
847 847 add babar
848 848 branch: default
849 849 commit: (clean)
850 850 update: 2 new changesets (update)
851 851 phases: 4 draft
852 852 unstable: 2 changesets
853 853 bumped: 1 changesets
854 854 $ hg up -r 'obsolete()'
855 855 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
856 856 $ hg summary
857 857 parent: 6:3de5eca88c00 (obsolete)
858 858 add obsolete_e
859 859 branch: default
860 860 commit: (clean)
861 861 update: 3 new changesets (update)
862 862 phases: 4 draft
863 863 unstable: 2 changesets
864 864 bumped: 1 changesets
865 865
866 866 Test incoming/outcoming with changesets obsoleted remotely, known locally
867 867 ===============================================================================
868 868
869 869 This test issue 3805
870 870
871 871 $ hg init repo-issue3805
872 872 $ cd repo-issue3805
873 873 $ echo "base" > base
874 874 $ hg ci -Am "base"
875 875 adding base
876 876 $ echo "foo" > foo
877 877 $ hg ci -Am "A"
878 878 adding foo
879 879 $ hg clone . ../other-issue3805
880 880 updating to branch default
881 881 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
882 882 $ echo "bar" >> foo
883 883 $ hg ci --amend
884 884 $ cd ../other-issue3805
885 885 $ hg log -G
886 886 @ 1:29f0c6921ddd (draft) [tip ] A
887 887 |
888 888 o 0:d20a80d4def3 (draft) [ ] base
889 889
890 890 $ hg log -G -R ../repo-issue3805
891 891 @ 3:323a9c3ddd91 (draft) [tip ] A
892 892 |
893 893 o 0:d20a80d4def3 (draft) [ ] base
894 894
895 895 $ hg incoming
896 896 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
897 897 searching for changes
898 898 3:323a9c3ddd91 (draft) [tip ] A
899 899 $ hg incoming --bundle ../issue3805.hg
900 900 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
901 901 searching for changes
902 902 3:323a9c3ddd91 (draft) [tip ] A
903 903 $ hg outgoing
904 904 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
905 905 searching for changes
906 906 1:29f0c6921ddd (draft) [tip ] A
907 907
908 908 #if serve
909 909
910 910 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
911 911 $ cat hg.pid >> $DAEMON_PIDS
912 912
913 913 $ hg incoming http://localhost:$HGPORT
914 914 comparing with http://localhost:$HGPORT/
915 915 searching for changes
916 916 2:323a9c3ddd91 (draft) [tip ] A
917 917 $ hg outgoing http://localhost:$HGPORT
918 918 comparing with http://localhost:$HGPORT/
919 919 searching for changes
920 920 1:29f0c6921ddd (draft) [tip ] A
921 921
922 922 $ killdaemons.py
923 923
924 924 #endif
925 925
926 926 This test issue 3814
927 927
928 928 (nothing to push but locally hidden changeset)
929 929
930 930 $ cd ..
931 931 $ hg init repo-issue3814
932 932 $ cd repo-issue3805
933 933 $ hg push -r 323a9c3ddd91 ../repo-issue3814
934 934 pushing to ../repo-issue3814
935 935 searching for changes
936 936 adding changesets
937 937 adding manifests
938 938 adding file changes
939 939 added 2 changesets with 2 changes to 2 files
940 940 2 new obsolescence markers
941 941 $ hg out ../repo-issue3814
942 942 comparing with ../repo-issue3814
943 943 searching for changes
944 944 no changes found
945 945 [1]
946 946
947 947 Test that a local tag blocks a changeset from being hidden
948 948
949 949 $ hg tag -l visible -r 1 --hidden
950 950 $ hg log -G
951 951 @ 3:323a9c3ddd91 (draft) [tip ] A
952 952 |
953 953 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A
954 954 |/
955 955 o 0:d20a80d4def3 (draft) [ ] base
956 956
957 957 Test that removing a local tag does not cause some commands to fail
958 958
959 959 $ hg tag -l -r tip tiptag
960 960 $ hg tags
961 961 tiptag 3:323a9c3ddd91
962 962 tip 3:323a9c3ddd91
963 963 visible 1:29f0c6921ddd
964 964 $ hg --config extensions.strip= strip -r tip --no-backup
965 965 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
966 966 $ hg tags
967 967 visible 1:29f0c6921ddd
968 968 tip 1:29f0c6921ddd
969 969
970 970 Test bundle overlay onto hidden revision
971 971
972 972 $ cd ..
973 973 $ hg init repo-bundleoverlay
974 974 $ cd repo-bundleoverlay
975 975 $ echo "A" > foo
976 976 $ hg ci -Am "A"
977 977 adding foo
978 978 $ echo "B" >> foo
979 979 $ hg ci -m "B"
980 980 $ hg up 0
981 981 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
982 982 $ echo "C" >> foo
983 983 $ hg ci -m "C"
984 984 created new head
985 985 $ hg log -G
986 986 @ 2:c186d7714947 (draft) [tip ] C
987 987 |
988 988 | o 1:44526ebb0f98 (draft) [ ] B
989 989 |/
990 990 o 0:4b34ecfb0d56 (draft) [ ] A
991 991
992 992
993 993 $ hg clone -r1 . ../other-bundleoverlay
994 994 adding changesets
995 995 adding manifests
996 996 adding file changes
997 997 added 2 changesets with 2 changes to 1 files
998 998 updating to branch default
999 999 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1000 1000 $ cd ../other-bundleoverlay
1001 1001 $ echo "B+" >> foo
1002 1002 $ hg ci --amend -m "B+"
1003 1003 $ hg log -G --hidden
1004 1004 @ 3:b7d587542d40 (draft) [tip ] B+
1005 1005 |
1006 1006 | x 2:eb95e9297e18 (draft *obsolete*) [ ] temporary amend commit for 44526ebb0f98
1007 1007 | |
1008 1008 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B
1009 1009 |/
1010 1010 o 0:4b34ecfb0d56 (draft) [ ] A
1011 1011
1012 1012
1013 1013 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
1014 1014 comparing with ../repo-bundleoverlay
1015 1015 searching for changes
1016 1016 1:44526ebb0f98 (draft) [ ] B
1017 1017 2:c186d7714947 (draft) [tip ] C
1018 1018 $ hg log -G -R ../bundleoverlay.hg
1019 1019 o 4:c186d7714947 (draft) [tip ] C
1020 1020 |
1021 1021 | @ 3:b7d587542d40 (draft) [ ] B+
1022 1022 |/
1023 1023 o 0:4b34ecfb0d56 (draft) [ ] A
1024 1024
1025 1025
1026 1026 #if serve
1027 1027
1028 1028 Test issue 4506
1029 1029
1030 1030 $ cd ..
1031 1031 $ hg init repo-issue4506
1032 1032 $ cd repo-issue4506
1033 1033 $ echo "0" > foo
1034 1034 $ hg add foo
1035 1035 $ hg ci -m "content-0"
1036 1036
1037 1037 $ hg up null
1038 1038 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1039 1039 $ echo "1" > bar
1040 1040 $ hg add bar
1041 1041 $ hg ci -m "content-1"
1042 1042 created new head
1043 1043 $ hg up 0
1044 1044 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1045 1045 $ hg graft 1
1046 1046 grafting 1:1c9eddb02162 "content-1" (tip)
1047 1047
1048 1048 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
1049 1049
1050 1050 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1051 1051 $ cat hg.pid >> $DAEMON_PIDS
1052 1052
1053 1053 $ get-with-headers.py --headeronly localhost:$HGPORT 'rev/1'
1054 1054 404 Not Found
1055 1055 [1]
1056 1056 $ get-with-headers.py --headeronly localhost:$HGPORT 'file/tip/bar'
1057 1057 200 Script output follows
1058 1058 $ get-with-headers.py --headeronly localhost:$HGPORT 'annotate/tip/bar'
1059 1059 200 Script output follows
1060 1060
1061 1061 $ killdaemons.py
1062 1062
1063 1063 #endif
1064 1064
1065 1065 Test heads computation on pending index changes with obsolescence markers
1066 1066 $ cd ..
1067 1067 $ cat >$TESTTMP/test_extension.py << EOF
1068 1068 > from mercurial import cmdutil, registrar
1069 1069 > from mercurial.i18n import _
1070 1070 >
1071 1071 > cmdtable = {}
1072 1072 > command = registrar.command(cmdtable)
1073 1073 > @command("amendtransient",[], _('hg amendtransient [rev]'))
1074 1074 > def amend(ui, repo, *pats, **opts):
1075 1075 > def commitfunc(ui, repo, message, match, opts):
1076 1076 > return repo.commit(message, repo['.'].user(), repo['.'].date(), match)
1077 1077 > opts['message'] = 'Test'
1078 1078 > opts['logfile'] = None
1079 1079 > cmdutil.amend(ui, repo, commitfunc, repo['.'], {}, pats, opts)
1080 1080 > ui.write('%s\n' % repo.changelog.headrevs())
1081 1081 > EOF
1082 1082 $ cat >> $HGRCPATH << EOF
1083 1083 > [extensions]
1084 1084 > testextension=$TESTTMP/test_extension.py
1085 1085 > EOF
1086 1086 $ hg init repo-issue-nativerevs-pending-changes
1087 1087 $ cd repo-issue-nativerevs-pending-changes
1088 1088 $ mkcommit a
1089 1089 $ mkcommit b
1090 1090 $ hg up ".^"
1091 1091 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1092 1092 $ echo aa > a
1093 1093 $ hg amendtransient
1094 1094 [1, 3]
1095 1095
1096 Check that corrupted hidden cache does not crash
1097
1098 $ printf "" > .hg/cache/hidden
1099 $ hg log -r . -T '{node}' --debug
1100 corrupted hidden cache
1101 8fd96dfc63e51ed5a8af1bec18eb4b19dbf83812 (no-eol)
1102 $ hg log -r . -T '{node}' --debug
1103 8fd96dfc63e51ed5a8af1bec18eb4b19dbf83812 (no-eol)
1104
1105 #if unix-permissions
1106 Check that wrong hidden cache permission does not crash
1107
1108 $ chmod 000 .hg/cache/hidden
1109 $ hg log -r . -T '{node}' --debug
1110 cannot read hidden cache
1111 error writing hidden changesets cache
1112 8fd96dfc63e51ed5a8af1bec18eb4b19dbf83812 (no-eol)
1113 #endif
1114
1115 1096 Test cache consistency for the visible filter
1116 1097 1) We want to make sure that the cached filtered revs are invalidated when
1117 1098 bookmarks change
1118 1099 $ cd ..
1119 1100 $ cat >$TESTTMP/test_extension.py << EOF
1120 1101 > import weakref
1121 1102 > from mercurial import cmdutil, extensions, bookmarks, repoview
1122 1103 > def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs):
1123 1104 > reporef = weakref.ref(bkmstoreinst._repo)
1124 1105 > def trhook(tr):
1125 1106 > repo = reporef()
1126 1107 > hidden1 = repoview.computehidden(repo)
1127 1108 > hidden = repoview.filterrevs(repo, 'visible')
1128 1109 > if sorted(hidden1) != sorted(hidden):
1129 1110 > print "cache inconsistency"
1130 1111 > bkmstoreinst._repo.currenttransaction().addpostclose('test_extension', trhook)
1131 1112 > orig(bkmstoreinst, *args, **kwargs)
1132 1113 > def extsetup(ui):
1133 1114 > extensions.wrapfunction(bookmarks.bmstore, 'recordchange',
1134 1115 > _bookmarkchanged)
1135 1116 > EOF
1136 1117
1137 1118 $ hg init repo-cache-inconsistency
1138 1119 $ cd repo-issue-nativerevs-pending-changes
1139 1120 $ mkcommit a
1140 1121 a already tracked!
1141 1122 $ mkcommit b
1142 1123 $ hg id
1143 1124 13bedc178fce tip
1144 1125 $ echo "hello" > b
1145 1126 $ hg commit --amend -m "message"
1146 1127 $ hg book bookb -r 13bedc178fce --hidden
1147 1128 $ hg log -r 13bedc178fce
1148 1129 5:13bedc178fce (draft *obsolete*) [ bookb] add b
1149 1130 $ hg book -d bookb
1150 1131 $ hg log -r 13bedc178fce
1151 1132 abort: hidden revision '13bedc178fce'!
1152 1133 (use --hidden to access hidden revisions)
1153 1134 [255]
1154 1135
1155 1136 Empty out the test extension, as it isn't compatible with later parts
1156 1137 of the test.
1157 1138 $ echo > $TESTTMP/test_extension.py
1158 1139
1159 1140 Test ability to pull changeset with locally applying obsolescence markers
1160 1141 (issue4945)
1161 1142
1162 1143 $ cd ..
1163 1144 $ hg init issue4845
1164 1145 $ cd issue4845
1165 1146
1166 1147 $ echo foo > f0
1167 1148 $ hg add f0
1168 1149 $ hg ci -m '0'
1169 1150 $ echo foo > f1
1170 1151 $ hg add f1
1171 1152 $ hg ci -m '1'
1172 1153 $ echo foo > f2
1173 1154 $ hg add f2
1174 1155 $ hg ci -m '2'
1175 1156
1176 1157 $ echo bar > f2
1177 1158 $ hg commit --amend --config experimetnal.evolution=createmarkers
1178 1159 $ hg log -G
1179 1160 @ 4:b0551702f918 (draft) [tip ] 2
1180 1161 |
1181 1162 o 1:e016b03fd86f (draft) [ ] 1
1182 1163 |
1183 1164 o 0:a78f55e5508c (draft) [ ] 0
1184 1165
1185 1166 $ hg log -G --hidden
1186 1167 @ 4:b0551702f918 (draft) [tip ] 2
1187 1168 |
1188 1169 | x 3:f27abbcc1f77 (draft *obsolete*) [ ] temporary amend commit for e008cf283490
1189 1170 | |
1190 1171 | x 2:e008cf283490 (draft *obsolete*) [ ] 2
1191 1172 |/
1192 1173 o 1:e016b03fd86f (draft) [ ] 1
1193 1174 |
1194 1175 o 0:a78f55e5508c (draft) [ ] 0
1195 1176
1196 1177
1197 1178 $ hg strip -r 1 --config extensions.strip=
1198 1179 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1199 1180 saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg (glob)
1200 1181 $ hg log -G
1201 1182 @ 0:a78f55e5508c (draft) [tip ] 0
1202 1183
1203 1184 $ hg log -G --hidden
1204 1185 @ 0:a78f55e5508c (draft) [tip ] 0
1205 1186
1206 1187
1207 1188 $ hg pull .hg/strip-backup/*
1208 1189 pulling from .hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg
1209 1190 searching for changes
1210 1191 adding changesets
1211 1192 adding manifests
1212 1193 adding file changes
1213 1194 added 2 changesets with 2 changes to 2 files
1214 1195 (run 'hg update' to get a working copy)
1215 1196 $ hg log -G
1216 1197 o 2:b0551702f918 (draft) [tip ] 2
1217 1198 |
1218 1199 o 1:e016b03fd86f (draft) [ ] 1
1219 1200 |
1220 1201 @ 0:a78f55e5508c (draft) [ ] 0
1221 1202
1222 1203 $ hg log -G --hidden
1223 1204 o 2:b0551702f918 (draft) [tip ] 2
1224 1205 |
1225 1206 o 1:e016b03fd86f (draft) [ ] 1
1226 1207 |
1227 1208 @ 0:a78f55e5508c (draft) [ ] 0
1228 1209
1229 1210 Test that 'hg debugobsolete --index --rev' can show indices of obsmarkers when
1230 1211 only a subset of those are displayed (because of --rev option)
1231 1212 $ hg init doindexrev
1232 1213 $ cd doindexrev
1233 1214 $ echo a > a
1234 1215 $ hg ci -Am a
1235 1216 adding a
1236 1217 $ hg ci --amend -m aa
1237 1218 $ echo b > b
1238 1219 $ hg ci -Am b
1239 1220 adding b
1240 1221 $ hg ci --amend -m bb
1241 1222 $ echo c > c
1242 1223 $ hg ci -Am c
1243 1224 adding c
1244 1225 $ hg ci --amend -m cc
1245 1226 $ echo d > d
1246 1227 $ hg ci -Am d
1247 1228 adding d
1248 1229 $ hg ci --amend -m dd --config experimental.evolution.track-operation=1
1249 1230 $ hg debugobsolete --index --rev "3+7"
1250 1231 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re)
1251 1232 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'operation': 'amend', 'user': 'test'} (re)
1252 1233 $ hg debugobsolete --index --rev "3+7" -Tjson
1253 1234 [
1254 1235 {
1255 1236 "date": [0.0, 0],
1256 1237 "flag": 0,
1257 1238 "index": 1,
1258 1239 "metadata": {"user": "test"},
1259 1240 "precnode": "6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1",
1260 1241 "succnodes": ["d27fb9b066076fd921277a4b9e8b9cb48c95bc6a"]
1261 1242 },
1262 1243 {
1263 1244 "date": [0.0, 0],
1264 1245 "flag": 0,
1265 1246 "index": 3,
1266 1247 "metadata": {"operation": "amend", "user": "test"},
1267 1248 "precnode": "4715cf767440ed891755448016c2b8cf70760c30",
1268 1249 "succnodes": ["7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d"]
1269 1250 }
1270 1251 ]
1271 1252
1272 1253 Test the --delete option of debugobsolete command
1273 1254 $ hg debugobsolete --index
1274 1255 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1275 1256 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1276 1257 2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1277 1258 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'}
1278 1259 $ hg debugobsolete --delete 1 --delete 3
1279 1260 deleted 2 obsolescence markers
1280 1261 $ hg debugobsolete
1281 1262 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1282 1263 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
1283 1264
1284 1265 Test adding changeset after obsmarkers affecting it
1285 1266 (eg: during pull, or unbundle)
1286 1267
1287 1268 $ mkcommit e
1288 1269 $ hg bundle -r . --base .~1 ../bundle-2.hg
1289 1270 1 changesets found
1290 1271 $ getid .
1291 1272 $ hg --config extensions.strip= strip -r .
1292 1273 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1293 1274 saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg (glob)
1294 1275 $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
1295 1276 $ hg unbundle ../bundle-2.hg
1296 1277 adding changesets
1297 1278 adding manifests
1298 1279 adding file changes
1299 1280 added 1 changesets with 1 changes to 1 files
1300 1281 (run 'hg update' to get a working copy)
1301 1282 $ hg log -G
1302 1283 @ 7:7ae79c5d60f0 (draft) [tip ] dd
1303 1284 |
1304 1285 | o 6:4715cf767440 (draft) [ ] d
1305 1286 |/
1306 1287 o 5:29346082e4a9 (draft) [ ] cc
1307 1288 |
1308 1289 o 3:d27fb9b06607 (draft) [ ] bb
1309 1290 |
1310 1291 | o 2:6fdef60fcbab (draft) [ ] b
1311 1292 |/
1312 1293 o 1:f9bd49731b0b (draft) [ ] aa
1313 1294
1314 1295
1315 1296 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now