##// END OF EJS Templates
repoview: do not crash when localtags refers to non existing revisions...
Angel Ezquerra -
r21823:925d1bb9 stable
parent child Browse files
Show More
@@ -1,312 +1,321 b''
1 # tags.py - read tag info from local repository
1 # tags.py - read tag info from local repository
2 #
2 #
3 # Copyright 2009 Matt Mackall <mpm@selenic.com>
3 # Copyright 2009 Matt Mackall <mpm@selenic.com>
4 # Copyright 2009 Greg Ward <greg@gerg.ca>
4 # Copyright 2009 Greg Ward <greg@gerg.ca>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 # Currently this module only deals with reading and caching tags.
9 # Currently this module only deals with reading and caching tags.
10 # Eventually, it could take care of updating (adding/removing/moving)
10 # Eventually, it could take care of updating (adding/removing/moving)
11 # tags too.
11 # tags too.
12
12
13 from node import nullid, bin, hex, short
13 from node import nullid, bin, hex, short
14 from i18n import _
14 from i18n import _
15 import encoding
15 import encoding
16 import error
16 import error
17 import errno
17 import errno
18 import time
18 import time
19
19
20 def findglobaltags(ui, repo, alltags, tagtypes):
20 def findglobaltags(ui, repo, alltags, tagtypes):
21 '''Find global tags in repo by reading .hgtags from every head that
21 '''Find global tags in repo by reading .hgtags from every head that
22 has a distinct version of it, using a cache to avoid excess work.
22 has a distinct version of it, using a cache to avoid excess work.
23 Updates the dicts alltags, tagtypes in place: alltags maps tag name
23 Updates the dicts alltags, tagtypes in place: alltags maps tag name
24 to (node, hist) pair (see _readtags() below), and tagtypes maps tag
24 to (node, hist) pair (see _readtags() below), and tagtypes maps tag
25 name to tag type ("global" in this case).'''
25 name to tag type ("global" in this case).'''
26 # This is so we can be lazy and assume alltags contains only global
26 # This is so we can be lazy and assume alltags contains only global
27 # tags when we pass it to _writetagcache().
27 # tags when we pass it to _writetagcache().
28 assert len(alltags) == len(tagtypes) == 0, \
28 assert len(alltags) == len(tagtypes) == 0, \
29 "findglobaltags() should be called first"
29 "findglobaltags() should be called first"
30
30
31 (heads, tagfnode, cachetags, shouldwrite) = _readtagcache(ui, repo)
31 (heads, tagfnode, cachetags, shouldwrite) = _readtagcache(ui, repo)
32 if cachetags is not None:
32 if cachetags is not None:
33 assert not shouldwrite
33 assert not shouldwrite
34 # XXX is this really 100% correct? are there oddball special
34 # XXX is this really 100% correct? are there oddball special
35 # cases where a global tag should outrank a local tag but won't,
35 # cases where a global tag should outrank a local tag but won't,
36 # because cachetags does not contain rank info?
36 # because cachetags does not contain rank info?
37 _updatetags(cachetags, 'global', alltags, tagtypes)
37 _updatetags(cachetags, 'global', alltags, tagtypes)
38 return
38 return
39
39
40 seen = set() # set of fnode
40 seen = set() # set of fnode
41 fctx = None
41 fctx = None
42 for head in reversed(heads): # oldest to newest
42 for head in reversed(heads): # oldest to newest
43 assert head in repo.changelog.nodemap, \
43 assert head in repo.changelog.nodemap, \
44 "tag cache returned bogus head %s" % short(head)
44 "tag cache returned bogus head %s" % short(head)
45
45
46 fnode = tagfnode.get(head)
46 fnode = tagfnode.get(head)
47 if fnode and fnode not in seen:
47 if fnode and fnode not in seen:
48 seen.add(fnode)
48 seen.add(fnode)
49 if not fctx:
49 if not fctx:
50 fctx = repo.filectx('.hgtags', fileid=fnode)
50 fctx = repo.filectx('.hgtags', fileid=fnode)
51 else:
51 else:
52 fctx = fctx.filectx(fnode)
52 fctx = fctx.filectx(fnode)
53
53
54 filetags = _readtags(ui, repo, fctx.data().splitlines(), fctx)
54 filetags = _readtags(ui, repo, fctx.data().splitlines(), fctx)
55 _updatetags(filetags, 'global', alltags, tagtypes)
55 _updatetags(filetags, 'global', alltags, tagtypes)
56
56
57 # and update the cache (if necessary)
57 # and update the cache (if necessary)
58 if shouldwrite:
58 if shouldwrite:
59 _writetagcache(ui, repo, heads, tagfnode, alltags)
59 _writetagcache(ui, repo, heads, tagfnode, alltags)
60
60
61 def readlocaltags(ui, repo, alltags, tagtypes):
61 def readlocaltags(ui, repo, alltags, tagtypes):
62 '''Read local tags in repo. Update alltags and tagtypes.'''
62 '''Read local tags in repo. Update alltags and tagtypes.'''
63 try:
63 try:
64 data = repo.opener.read("localtags")
64 data = repo.opener.read("localtags")
65 except IOError, inst:
65 except IOError, inst:
66 if inst.errno != errno.ENOENT:
66 if inst.errno != errno.ENOENT:
67 raise
67 raise
68 return
68 return
69
69
70 # localtags is in the local encoding; re-encode to UTF-8 on
70 # localtags is in the local encoding; re-encode to UTF-8 on
71 # input for consistency with the rest of this module.
71 # input for consistency with the rest of this module.
72 filetags = _readtags(
72 filetags = _readtags(
73 ui, repo, data.splitlines(), "localtags",
73 ui, repo, data.splitlines(), "localtags",
74 recode=encoding.fromlocal)
74 recode=encoding.fromlocal)
75
76 # remove tags pointing to invalid nodes
77 cl = repo.changelog
78 for t in filetags.keys():
79 try:
80 cl.rev(filetags[t][0])
81 except (LookupError, ValueError):
82 del filetags[t]
83
75 _updatetags(filetags, "local", alltags, tagtypes)
84 _updatetags(filetags, "local", alltags, tagtypes)
76
85
77 def _readtags(ui, repo, lines, fn, recode=None):
86 def _readtags(ui, repo, lines, fn, recode=None):
78 '''Read tag definitions from a file (or any source of lines).
87 '''Read tag definitions from a file (or any source of lines).
79 Return a mapping from tag name to (node, hist): node is the node id
88 Return a mapping from tag name to (node, hist): node is the node id
80 from the last line read for that name, and hist is the list of node
89 from the last line read for that name, and hist is the list of node
81 ids previously associated with it (in file order). All node ids are
90 ids previously associated with it (in file order). All node ids are
82 binary, not hex.'''
91 binary, not hex.'''
83
92
84 filetags = {} # map tag name to (node, hist)
93 filetags = {} # map tag name to (node, hist)
85 count = 0
94 count = 0
86
95
87 def warn(msg):
96 def warn(msg):
88 ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
97 ui.warn(_("%s, line %s: %s\n") % (fn, count, msg))
89
98
90 for line in lines:
99 for line in lines:
91 count += 1
100 count += 1
92 if not line:
101 if not line:
93 continue
102 continue
94 try:
103 try:
95 (nodehex, name) = line.split(" ", 1)
104 (nodehex, name) = line.split(" ", 1)
96 except ValueError:
105 except ValueError:
97 warn(_("cannot parse entry"))
106 warn(_("cannot parse entry"))
98 continue
107 continue
99 name = name.strip()
108 name = name.strip()
100 if recode:
109 if recode:
101 name = recode(name)
110 name = recode(name)
102 try:
111 try:
103 nodebin = bin(nodehex)
112 nodebin = bin(nodehex)
104 except TypeError:
113 except TypeError:
105 warn(_("node '%s' is not well formed") % nodehex)
114 warn(_("node '%s' is not well formed") % nodehex)
106 continue
115 continue
107
116
108 # update filetags
117 # update filetags
109 hist = []
118 hist = []
110 if name in filetags:
119 if name in filetags:
111 n, hist = filetags[name]
120 n, hist = filetags[name]
112 hist.append(n)
121 hist.append(n)
113 filetags[name] = (nodebin, hist)
122 filetags[name] = (nodebin, hist)
114 return filetags
123 return filetags
115
124
116 def _updatetags(filetags, tagtype, alltags, tagtypes):
125 def _updatetags(filetags, tagtype, alltags, tagtypes):
117 '''Incorporate the tag info read from one file into the two
126 '''Incorporate the tag info read from one file into the two
118 dictionaries, alltags and tagtypes, that contain all tag
127 dictionaries, alltags and tagtypes, that contain all tag
119 info (global across all heads plus local).'''
128 info (global across all heads plus local).'''
120
129
121 for name, nodehist in filetags.iteritems():
130 for name, nodehist in filetags.iteritems():
122 if name not in alltags:
131 if name not in alltags:
123 alltags[name] = nodehist
132 alltags[name] = nodehist
124 tagtypes[name] = tagtype
133 tagtypes[name] = tagtype
125 continue
134 continue
126
135
127 # we prefer alltags[name] if:
136 # we prefer alltags[name] if:
128 # it supersedes us OR
137 # it supersedes us OR
129 # mutual supersedes and it has a higher rank
138 # mutual supersedes and it has a higher rank
130 # otherwise we win because we're tip-most
139 # otherwise we win because we're tip-most
131 anode, ahist = nodehist
140 anode, ahist = nodehist
132 bnode, bhist = alltags[name]
141 bnode, bhist = alltags[name]
133 if (bnode != anode and anode in bhist and
142 if (bnode != anode and anode in bhist and
134 (bnode not in ahist or len(bhist) > len(ahist))):
143 (bnode not in ahist or len(bhist) > len(ahist))):
135 anode = bnode
144 anode = bnode
136 else:
145 else:
137 tagtypes[name] = tagtype
146 tagtypes[name] = tagtype
138 ahist.extend([n for n in bhist if n not in ahist])
147 ahist.extend([n for n in bhist if n not in ahist])
139 alltags[name] = anode, ahist
148 alltags[name] = anode, ahist
140
149
141
150
142 # The tag cache only stores info about heads, not the tag contents
151 # The tag cache only stores info about heads, not the tag contents
143 # from each head. I.e. it doesn't try to squeeze out the maximum
152 # from each head. I.e. it doesn't try to squeeze out the maximum
144 # performance, but is simpler has a better chance of actually
153 # performance, but is simpler has a better chance of actually
145 # working correctly. And this gives the biggest performance win: it
154 # working correctly. And this gives the biggest performance win: it
146 # avoids looking up .hgtags in the manifest for every head, and it
155 # avoids looking up .hgtags in the manifest for every head, and it
147 # can avoid calling heads() at all if there have been no changes to
156 # can avoid calling heads() at all if there have been no changes to
148 # the repo.
157 # the repo.
149
158
150 def _readtagcache(ui, repo):
159 def _readtagcache(ui, repo):
151 '''Read the tag cache and return a tuple (heads, fnodes, cachetags,
160 '''Read the tag cache and return a tuple (heads, fnodes, cachetags,
152 shouldwrite). If the cache is completely up-to-date, cachetags is a
161 shouldwrite). If the cache is completely up-to-date, cachetags is a
153 dict of the form returned by _readtags(); otherwise, it is None and
162 dict of the form returned by _readtags(); otherwise, it is None and
154 heads and fnodes are set. In that case, heads is the list of all
163 heads and fnodes are set. In that case, heads is the list of all
155 heads currently in the repository (ordered from tip to oldest) and
164 heads currently in the repository (ordered from tip to oldest) and
156 fnodes is a mapping from head to .hgtags filenode. If those two are
165 fnodes is a mapping from head to .hgtags filenode. If those two are
157 set, caller is responsible for reading tag info from each head.'''
166 set, caller is responsible for reading tag info from each head.'''
158
167
159 try:
168 try:
160 cachefile = repo.opener('cache/tags', 'r')
169 cachefile = repo.opener('cache/tags', 'r')
161 # force reading the file for static-http
170 # force reading the file for static-http
162 cachelines = iter(cachefile)
171 cachelines = iter(cachefile)
163 except IOError:
172 except IOError:
164 cachefile = None
173 cachefile = None
165
174
166 # The cache file consists of lines like
175 # The cache file consists of lines like
167 # <headrev> <headnode> [<tagnode>]
176 # <headrev> <headnode> [<tagnode>]
168 # where <headrev> and <headnode> redundantly identify a repository
177 # where <headrev> and <headnode> redundantly identify a repository
169 # head from the time the cache was written, and <tagnode> is the
178 # head from the time the cache was written, and <tagnode> is the
170 # filenode of .hgtags on that head. Heads with no .hgtags file will
179 # filenode of .hgtags on that head. Heads with no .hgtags file will
171 # have no <tagnode>. The cache is ordered from tip to oldest (which
180 # have no <tagnode>. The cache is ordered from tip to oldest (which
172 # is part of why <headrev> is there: a quick visual check is all
181 # is part of why <headrev> is there: a quick visual check is all
173 # that's required to ensure correct order).
182 # that's required to ensure correct order).
174 #
183 #
175 # This information is enough to let us avoid the most expensive part
184 # This information is enough to let us avoid the most expensive part
176 # of finding global tags, which is looking up <tagnode> in the
185 # of finding global tags, which is looking up <tagnode> in the
177 # manifest for each head.
186 # manifest for each head.
178 cacherevs = [] # list of headrev
187 cacherevs = [] # list of headrev
179 cacheheads = [] # list of headnode
188 cacheheads = [] # list of headnode
180 cachefnode = {} # map headnode to filenode
189 cachefnode = {} # map headnode to filenode
181 if cachefile:
190 if cachefile:
182 try:
191 try:
183 for line in cachelines:
192 for line in cachelines:
184 if line == "\n":
193 if line == "\n":
185 break
194 break
186 line = line.split()
195 line = line.split()
187 cacherevs.append(int(line[0]))
196 cacherevs.append(int(line[0]))
188 headnode = bin(line[1])
197 headnode = bin(line[1])
189 cacheheads.append(headnode)
198 cacheheads.append(headnode)
190 if len(line) == 3:
199 if len(line) == 3:
191 fnode = bin(line[2])
200 fnode = bin(line[2])
192 cachefnode[headnode] = fnode
201 cachefnode[headnode] = fnode
193 except Exception:
202 except Exception:
194 # corruption of the tags cache, just recompute it
203 # corruption of the tags cache, just recompute it
195 ui.warn(_('.hg/cache/tags is corrupt, rebuilding it\n'))
204 ui.warn(_('.hg/cache/tags is corrupt, rebuilding it\n'))
196 cacheheads = []
205 cacheheads = []
197 cacherevs = []
206 cacherevs = []
198 cachefnode = {}
207 cachefnode = {}
199
208
200 tipnode = repo.changelog.tip()
209 tipnode = repo.changelog.tip()
201 tiprev = len(repo.changelog) - 1
210 tiprev = len(repo.changelog) - 1
202
211
203 # Case 1 (common): tip is the same, so nothing has changed.
212 # Case 1 (common): tip is the same, so nothing has changed.
204 # (Unchanged tip trivially means no changesets have been added.
213 # (Unchanged tip trivially means no changesets have been added.
205 # But, thanks to localrepository.destroyed(), it also means none
214 # But, thanks to localrepository.destroyed(), it also means none
206 # have been destroyed by strip or rollback.)
215 # have been destroyed by strip or rollback.)
207 if cacheheads and cacheheads[0] == tipnode and cacherevs[0] == tiprev:
216 if cacheheads and cacheheads[0] == tipnode and cacherevs[0] == tiprev:
208 tags = _readtags(ui, repo, cachelines, cachefile.name)
217 tags = _readtags(ui, repo, cachelines, cachefile.name)
209 cachefile.close()
218 cachefile.close()
210 return (None, None, tags, False)
219 return (None, None, tags, False)
211 if cachefile:
220 if cachefile:
212 cachefile.close() # ignore rest of file
221 cachefile.close() # ignore rest of file
213
222
214 repoheads = repo.heads()
223 repoheads = repo.heads()
215 # Case 2 (uncommon): empty repo; get out quickly and don't bother
224 # Case 2 (uncommon): empty repo; get out quickly and don't bother
216 # writing an empty cache.
225 # writing an empty cache.
217 if repoheads == [nullid]:
226 if repoheads == [nullid]:
218 return ([], {}, {}, False)
227 return ([], {}, {}, False)
219
228
220 # Case 3 (uncommon): cache file missing or empty.
229 # Case 3 (uncommon): cache file missing or empty.
221
230
222 # Case 4 (uncommon): tip rev decreased. This should only happen
231 # Case 4 (uncommon): tip rev decreased. This should only happen
223 # when we're called from localrepository.destroyed(). Refresh the
232 # when we're called from localrepository.destroyed(). Refresh the
224 # cache so future invocations will not see disappeared heads in the
233 # cache so future invocations will not see disappeared heads in the
225 # cache.
234 # cache.
226
235
227 # Case 5 (common): tip has changed, so we've added/replaced heads.
236 # Case 5 (common): tip has changed, so we've added/replaced heads.
228
237
229 # As it happens, the code to handle cases 3, 4, 5 is the same.
238 # As it happens, the code to handle cases 3, 4, 5 is the same.
230
239
231 # N.B. in case 4 (nodes destroyed), "new head" really means "newly
240 # N.B. in case 4 (nodes destroyed), "new head" really means "newly
232 # exposed".
241 # exposed".
233 if not len(repo.file('.hgtags')):
242 if not len(repo.file('.hgtags')):
234 # No tags have ever been committed, so we can avoid a
243 # No tags have ever been committed, so we can avoid a
235 # potentially expensive search.
244 # potentially expensive search.
236 return (repoheads, cachefnode, None, True)
245 return (repoheads, cachefnode, None, True)
237
246
238 starttime = time.time()
247 starttime = time.time()
239
248
240 newheads = [head
249 newheads = [head
241 for head in repoheads
250 for head in repoheads
242 if head not in set(cacheheads)]
251 if head not in set(cacheheads)]
243
252
244 # Now we have to lookup the .hgtags filenode for every new head.
253 # Now we have to lookup the .hgtags filenode for every new head.
245 # This is the most expensive part of finding tags, so performance
254 # This is the most expensive part of finding tags, so performance
246 # depends primarily on the size of newheads. Worst case: no cache
255 # depends primarily on the size of newheads. Worst case: no cache
247 # file, so newheads == repoheads.
256 # file, so newheads == repoheads.
248 for head in reversed(newheads):
257 for head in reversed(newheads):
249 cctx = repo[head]
258 cctx = repo[head]
250 try:
259 try:
251 fnode = cctx.filenode('.hgtags')
260 fnode = cctx.filenode('.hgtags')
252 cachefnode[head] = fnode
261 cachefnode[head] = fnode
253 except error.LookupError:
262 except error.LookupError:
254 # no .hgtags file on this head
263 # no .hgtags file on this head
255 pass
264 pass
256
265
257 duration = time.time() - starttime
266 duration = time.time() - starttime
258 ui.log('tagscache',
267 ui.log('tagscache',
259 'resolved %d tags cache entries from %d manifests in %0.4f '
268 'resolved %d tags cache entries from %d manifests in %0.4f '
260 'seconds\n',
269 'seconds\n',
261 len(cachefnode), len(newheads), duration)
270 len(cachefnode), len(newheads), duration)
262
271
263 # Caller has to iterate over all heads, but can use the filenodes in
272 # Caller has to iterate over all heads, but can use the filenodes in
264 # cachefnode to get to each .hgtags revision quickly.
273 # cachefnode to get to each .hgtags revision quickly.
265 return (repoheads, cachefnode, None, True)
274 return (repoheads, cachefnode, None, True)
266
275
267 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
276 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
268
277
269 try:
278 try:
270 cachefile = repo.opener('cache/tags', 'w', atomictemp=True)
279 cachefile = repo.opener('cache/tags', 'w', atomictemp=True)
271 except (OSError, IOError):
280 except (OSError, IOError):
272 return
281 return
273
282
274 ui.log('tagscache', 'writing tags cache file with %d heads and %d tags\n',
283 ui.log('tagscache', 'writing tags cache file with %d heads and %d tags\n',
275 len(heads), len(cachetags))
284 len(heads), len(cachetags))
276
285
277 realheads = repo.heads() # for sanity checks below
286 realheads = repo.heads() # for sanity checks below
278 for head in heads:
287 for head in heads:
279 # temporary sanity checks; these can probably be removed
288 # temporary sanity checks; these can probably be removed
280 # once this code has been in crew for a few weeks
289 # once this code has been in crew for a few weeks
281 assert head in repo.changelog.nodemap, \
290 assert head in repo.changelog.nodemap, \
282 'trying to write non-existent node %s to tag cache' % short(head)
291 'trying to write non-existent node %s to tag cache' % short(head)
283 assert head in realheads, \
292 assert head in realheads, \
284 'trying to write non-head %s to tag cache' % short(head)
293 'trying to write non-head %s to tag cache' % short(head)
285 assert head != nullid, \
294 assert head != nullid, \
286 'trying to write nullid to tag cache'
295 'trying to write nullid to tag cache'
287
296
288 # This can't fail because of the first assert above. When/if we
297 # This can't fail because of the first assert above. When/if we
289 # remove that assert, we might want to catch LookupError here
298 # remove that assert, we might want to catch LookupError here
290 # and downgrade it to a warning.
299 # and downgrade it to a warning.
291 rev = repo.changelog.rev(head)
300 rev = repo.changelog.rev(head)
292
301
293 fnode = tagfnode.get(head)
302 fnode = tagfnode.get(head)
294 if fnode:
303 if fnode:
295 cachefile.write('%d %s %s\n' % (rev, hex(head), hex(fnode)))
304 cachefile.write('%d %s %s\n' % (rev, hex(head), hex(fnode)))
296 else:
305 else:
297 cachefile.write('%d %s\n' % (rev, hex(head)))
306 cachefile.write('%d %s\n' % (rev, hex(head)))
298
307
299 # Tag names in the cache are in UTF-8 -- which is the whole reason
308 # Tag names in the cache are in UTF-8 -- which is the whole reason
300 # we keep them in UTF-8 throughout this module. If we converted
309 # we keep them in UTF-8 throughout this module. If we converted
301 # them local encoding on input, we would lose info writing them to
310 # them local encoding on input, we would lose info writing them to
302 # the cache.
311 # the cache.
303 cachefile.write('\n')
312 cachefile.write('\n')
304 for (name, (node, hist)) in cachetags.iteritems():
313 for (name, (node, hist)) in cachetags.iteritems():
305 for n in hist:
314 for n in hist:
306 cachefile.write("%s %s\n" % (hex(n), name))
315 cachefile.write("%s %s\n" % (hex(n), name))
307 cachefile.write("%s %s\n" % (hex(node), name))
316 cachefile.write("%s %s\n" % (hex(node), name))
308
317
309 try:
318 try:
310 cachefile.close()
319 cachefile.close()
311 except (OSError, IOError):
320 except (OSError, IOError):
312 pass
321 pass
@@ -1,909 +1,921 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [phases]
2 > [phases]
3 > # public changeset are not obsolete
3 > # public changeset are not obsolete
4 > publish=false
4 > publish=false
5 > EOF
5 > EOF
6 $ mkcommit() {
6 $ mkcommit() {
7 > echo "$1" > "$1"
7 > echo "$1" > "$1"
8 > hg add "$1"
8 > hg add "$1"
9 > hg ci -m "add $1"
9 > hg ci -m "add $1"
10 > }
10 > }
11 $ getid() {
11 $ getid() {
12 > hg id --debug --hidden -ir "desc('$1')"
12 > hg id --debug --hidden -ir "desc('$1')"
13 > }
13 > }
14
14
15 $ cat > debugkeys.py <<EOF
15 $ cat > debugkeys.py <<EOF
16 > def reposetup(ui, repo):
16 > def reposetup(ui, repo):
17 > class debugkeysrepo(repo.__class__):
17 > class debugkeysrepo(repo.__class__):
18 > def listkeys(self, namespace):
18 > def listkeys(self, namespace):
19 > ui.write('listkeys %s\n' % (namespace,))
19 > ui.write('listkeys %s\n' % (namespace,))
20 > return super(debugkeysrepo, self).listkeys(namespace)
20 > return super(debugkeysrepo, self).listkeys(namespace)
21 >
21 >
22 > if repo.local():
22 > if repo.local():
23 > repo.__class__ = debugkeysrepo
23 > repo.__class__ = debugkeysrepo
24 > EOF
24 > EOF
25
25
26 $ hg init tmpa
26 $ hg init tmpa
27 $ cd tmpa
27 $ cd tmpa
28 $ mkcommit kill_me
28 $ mkcommit kill_me
29
29
30 Checking that the feature is properly disabled
30 Checking that the feature is properly disabled
31
31
32 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
32 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
33 abort: obsolete feature is not enabled on this repo
33 abort: obsolete feature is not enabled on this repo
34 [255]
34 [255]
35
35
36 Enabling it
36 Enabling it
37
37
38 $ cat > ../obs.py << EOF
38 $ cat > ../obs.py << EOF
39 > import mercurial.obsolete
39 > import mercurial.obsolete
40 > mercurial.obsolete._enabled = True
40 > mercurial.obsolete._enabled = True
41 > EOF
41 > EOF
42 $ echo '[extensions]' >> $HGRCPATH
42 $ echo '[extensions]' >> $HGRCPATH
43 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
43 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
44
44
45 Killing a single changeset without replacement
45 Killing a single changeset without replacement
46
46
47 $ hg debugobsolete 0
47 $ hg debugobsolete 0
48 abort: changeset references must be full hexadecimal node identifiers
48 abort: changeset references must be full hexadecimal node identifiers
49 [255]
49 [255]
50 $ hg debugobsolete '00'
50 $ hg debugobsolete '00'
51 abort: changeset references must be full hexadecimal node identifiers
51 abort: changeset references must be full hexadecimal node identifiers
52 [255]
52 [255]
53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
54 $ hg debugobsolete
54 $ hg debugobsolete
55 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 {'date': '0 0', 'user': 'babar'}
55 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 {'date': '0 0', 'user': 'babar'}
56
56
57 (test that mercurial is not confused)
57 (test that mercurial is not confused)
58
58
59 $ hg up null --quiet # having 0 as parent prevents it to be hidden
59 $ hg up null --quiet # having 0 as parent prevents it to be hidden
60 $ hg tip
60 $ hg tip
61 changeset: -1:000000000000
61 changeset: -1:000000000000
62 tag: tip
62 tag: tip
63 user:
63 user:
64 date: Thu Jan 01 00:00:00 1970 +0000
64 date: Thu Jan 01 00:00:00 1970 +0000
65
65
66 $ hg up --hidden tip --quiet
66 $ hg up --hidden tip --quiet
67 $ cd ..
67 $ cd ..
68
68
69 Killing a single changeset with replacement
69 Killing a single changeset with replacement
70
70
71 $ hg init tmpb
71 $ hg init tmpb
72 $ cd tmpb
72 $ cd tmpb
73 $ mkcommit a
73 $ mkcommit a
74 $ mkcommit b
74 $ mkcommit b
75 $ mkcommit original_c
75 $ mkcommit original_c
76 $ hg up "desc('b')"
76 $ hg up "desc('b')"
77 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
77 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 $ mkcommit new_c
78 $ mkcommit new_c
79 created new head
79 created new head
80 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
80 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
81 $ hg debugobsolete --flag 12 `getid original_c` `getid new_c` -d '56 12'
81 $ hg debugobsolete --flag 12 `getid original_c` `getid new_c` -d '56 12'
82 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
82 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
83 2:245bde4270cd add original_c
83 2:245bde4270cd add original_c
84 $ hg debugrevlog -cd
84 $ hg debugrevlog -cd
85 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads
85 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads
86 0 -1 -1 0 59 0 0 0 0 58 58 0 1
86 0 -1 -1 0 59 0 0 0 0 58 58 0 1
87 1 0 -1 59 118 59 59 0 0 58 116 0 1
87 1 0 -1 59 118 59 59 0 0 58 116 0 1
88 2 1 -1 118 204 59 59 59 0 76 192 0 1
88 2 1 -1 118 204 59 59 59 0 76 192 0 1
89 3 1 -1 204 271 204 204 59 0 66 258 0 2
89 3 1 -1 204 271 204 204 59 0 66 258 0 2
90 $ hg debugobsolete
90 $ hg debugobsolete
91 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
91 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
92
92
93 do it again (it read the obsstore before adding new changeset)
93 do it again (it read the obsstore before adding new changeset)
94
94
95 $ hg up '.^'
95 $ hg up '.^'
96 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
96 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
97 $ mkcommit new_2_c
97 $ mkcommit new_2_c
98 created new head
98 created new head
99 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
99 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
100 $ hg debugobsolete
100 $ hg debugobsolete
101 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
101 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
102 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
102 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
103
103
104 Register two markers with a missing node
104 Register two markers with a missing node
105
105
106 $ hg up '.^'
106 $ hg up '.^'
107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
108 $ mkcommit new_3_c
108 $ mkcommit new_3_c
109 created new head
109 created new head
110 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
110 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
111 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
111 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
112 $ hg debugobsolete
112 $ hg debugobsolete
113 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
113 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
114 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
114 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
115 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
115 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
116 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
116 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
117
117
118 Refuse pathological nullid successors
118 Refuse pathological nullid successors
119 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
119 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
120 transaction abort!
120 transaction abort!
121 rollback completed
121 rollback completed
122 abort: bad obsolescence marker detected: invalid successors nullid
122 abort: bad obsolescence marker detected: invalid successors nullid
123 [255]
123 [255]
124
124
125 Check that graphlog detect that a changeset is obsolete:
125 Check that graphlog detect that a changeset is obsolete:
126
126
127 $ hg log -G
127 $ hg log -G
128 @ changeset: 5:5601fb93a350
128 @ changeset: 5:5601fb93a350
129 | tag: tip
129 | tag: tip
130 | parent: 1:7c3bad9141dc
130 | parent: 1:7c3bad9141dc
131 | user: test
131 | user: test
132 | date: Thu Jan 01 00:00:00 1970 +0000
132 | date: Thu Jan 01 00:00:00 1970 +0000
133 | summary: add new_3_c
133 | summary: add new_3_c
134 |
134 |
135 o changeset: 1:7c3bad9141dc
135 o changeset: 1:7c3bad9141dc
136 | user: test
136 | user: test
137 | date: Thu Jan 01 00:00:00 1970 +0000
137 | date: Thu Jan 01 00:00:00 1970 +0000
138 | summary: add b
138 | summary: add b
139 |
139 |
140 o changeset: 0:1f0dee641bb7
140 o changeset: 0:1f0dee641bb7
141 user: test
141 user: test
142 date: Thu Jan 01 00:00:00 1970 +0000
142 date: Thu Jan 01 00:00:00 1970 +0000
143 summary: add a
143 summary: add a
144
144
145
145
146 check that heads does not report them
146 check that heads does not report them
147
147
148 $ hg heads
148 $ hg heads
149 changeset: 5:5601fb93a350
149 changeset: 5:5601fb93a350
150 tag: tip
150 tag: tip
151 parent: 1:7c3bad9141dc
151 parent: 1:7c3bad9141dc
152 user: test
152 user: test
153 date: Thu Jan 01 00:00:00 1970 +0000
153 date: Thu Jan 01 00:00:00 1970 +0000
154 summary: add new_3_c
154 summary: add new_3_c
155
155
156 $ hg heads --hidden
156 $ hg heads --hidden
157 changeset: 5:5601fb93a350
157 changeset: 5:5601fb93a350
158 tag: tip
158 tag: tip
159 parent: 1:7c3bad9141dc
159 parent: 1:7c3bad9141dc
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: add new_3_c
162 summary: add new_3_c
163
163
164 changeset: 4:ca819180edb9
164 changeset: 4:ca819180edb9
165 parent: 1:7c3bad9141dc
165 parent: 1:7c3bad9141dc
166 user: test
166 user: test
167 date: Thu Jan 01 00:00:00 1970 +0000
167 date: Thu Jan 01 00:00:00 1970 +0000
168 summary: add new_2_c
168 summary: add new_2_c
169
169
170 changeset: 3:cdbce2fbb163
170 changeset: 3:cdbce2fbb163
171 parent: 1:7c3bad9141dc
171 parent: 1:7c3bad9141dc
172 user: test
172 user: test
173 date: Thu Jan 01 00:00:00 1970 +0000
173 date: Thu Jan 01 00:00:00 1970 +0000
174 summary: add new_c
174 summary: add new_c
175
175
176 changeset: 2:245bde4270cd
176 changeset: 2:245bde4270cd
177 user: test
177 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
178 date: Thu Jan 01 00:00:00 1970 +0000
179 summary: add original_c
179 summary: add original_c
180
180
181
181
182
182
183 check that summary does not report them
183 check that summary does not report them
184
184
185 $ hg init ../sink
185 $ hg init ../sink
186 $ echo '[paths]' >> .hg/hgrc
186 $ echo '[paths]' >> .hg/hgrc
187 $ echo 'default=../sink' >> .hg/hgrc
187 $ echo 'default=../sink' >> .hg/hgrc
188 $ hg summary --remote
188 $ hg summary --remote
189 parent: 5:5601fb93a350 tip
189 parent: 5:5601fb93a350 tip
190 add new_3_c
190 add new_3_c
191 branch: default
191 branch: default
192 commit: (clean)
192 commit: (clean)
193 update: (current)
193 update: (current)
194 remote: 3 outgoing
194 remote: 3 outgoing
195
195
196 $ hg summary --remote --hidden
196 $ hg summary --remote --hidden
197 parent: 5:5601fb93a350 tip
197 parent: 5:5601fb93a350 tip
198 add new_3_c
198 add new_3_c
199 branch: default
199 branch: default
200 commit: (clean)
200 commit: (clean)
201 update: 3 new changesets, 4 branch heads (merge)
201 update: 3 new changesets, 4 branch heads (merge)
202 remote: 3 outgoing
202 remote: 3 outgoing
203
203
204 check that various commands work well with filtering
204 check that various commands work well with filtering
205
205
206 $ hg tip
206 $ hg tip
207 changeset: 5:5601fb93a350
207 changeset: 5:5601fb93a350
208 tag: tip
208 tag: tip
209 parent: 1:7c3bad9141dc
209 parent: 1:7c3bad9141dc
210 user: test
210 user: test
211 date: Thu Jan 01 00:00:00 1970 +0000
211 date: Thu Jan 01 00:00:00 1970 +0000
212 summary: add new_3_c
212 summary: add new_3_c
213
213
214 $ hg log -r 6
214 $ hg log -r 6
215 abort: unknown revision '6'!
215 abort: unknown revision '6'!
216 [255]
216 [255]
217 $ hg log -r 4
217 $ hg log -r 4
218 abort: unknown revision '4'!
218 abort: unknown revision '4'!
219 [255]
219 [255]
220
220
221 Check that public changeset are not accounted as obsolete:
221 Check that public changeset are not accounted as obsolete:
222
222
223 $ hg --hidden phase --public 2
223 $ hg --hidden phase --public 2
224 $ hg log -G
224 $ hg log -G
225 @ changeset: 5:5601fb93a350
225 @ changeset: 5:5601fb93a350
226 | tag: tip
226 | tag: tip
227 | parent: 1:7c3bad9141dc
227 | parent: 1:7c3bad9141dc
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: add new_3_c
230 | summary: add new_3_c
231 |
231 |
232 | o changeset: 2:245bde4270cd
232 | o changeset: 2:245bde4270cd
233 |/ user: test
233 |/ user: test
234 | date: Thu Jan 01 00:00:00 1970 +0000
234 | date: Thu Jan 01 00:00:00 1970 +0000
235 | summary: add original_c
235 | summary: add original_c
236 |
236 |
237 o changeset: 1:7c3bad9141dc
237 o changeset: 1:7c3bad9141dc
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: add b
240 | summary: add b
241 |
241 |
242 o changeset: 0:1f0dee641bb7
242 o changeset: 0:1f0dee641bb7
243 user: test
243 user: test
244 date: Thu Jan 01 00:00:00 1970 +0000
244 date: Thu Jan 01 00:00:00 1970 +0000
245 summary: add a
245 summary: add a
246
246
247
247
248 And that bumped changeset are detected
248 And that bumped changeset are detected
249 --------------------------------------
249 --------------------------------------
250
250
251 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
251 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
252 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
252 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
253 the public changeset
253 the public changeset
254
254
255 $ hg log --hidden -r 'bumped()'
255 $ hg log --hidden -r 'bumped()'
256 changeset: 5:5601fb93a350
256 changeset: 5:5601fb93a350
257 tag: tip
257 tag: tip
258 parent: 1:7c3bad9141dc
258 parent: 1:7c3bad9141dc
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: add new_3_c
261 summary: add new_3_c
262
262
263
263
264 And that we can't push bumped changeset
264 And that we can't push bumped changeset
265
265
266 $ hg push ../tmpa -r 0 --force #(make repo related)
266 $ hg push ../tmpa -r 0 --force #(make repo related)
267 pushing to ../tmpa
267 pushing to ../tmpa
268 searching for changes
268 searching for changes
269 warning: repository is unrelated
269 warning: repository is unrelated
270 adding changesets
270 adding changesets
271 adding manifests
271 adding manifests
272 adding file changes
272 adding file changes
273 added 1 changesets with 1 changes to 1 files (+1 heads)
273 added 1 changesets with 1 changes to 1 files (+1 heads)
274 $ hg push ../tmpa
274 $ hg push ../tmpa
275 pushing to ../tmpa
275 pushing to ../tmpa
276 searching for changes
276 searching for changes
277 abort: push includes bumped changeset: 5601fb93a350!
277 abort: push includes bumped changeset: 5601fb93a350!
278 [255]
278 [255]
279
279
280 Fixing "bumped" situation
280 Fixing "bumped" situation
281 We need to create a clone of 5 and add a special marker with a flag
281 We need to create a clone of 5 and add a special marker with a flag
282
282
283 $ hg up '5^'
283 $ hg up '5^'
284 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
284 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
285 $ hg revert -ar 5
285 $ hg revert -ar 5
286 adding new_3_c
286 adding new_3_c
287 $ hg ci -m 'add n3w_3_c'
287 $ hg ci -m 'add n3w_3_c'
288 created new head
288 created new head
289 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
289 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
290 $ hg log -r 'bumped()'
290 $ hg log -r 'bumped()'
291 $ hg log -G
291 $ hg log -G
292 @ changeset: 6:6f9641995072
292 @ changeset: 6:6f9641995072
293 | tag: tip
293 | tag: tip
294 | parent: 1:7c3bad9141dc
294 | parent: 1:7c3bad9141dc
295 | user: test
295 | user: test
296 | date: Thu Jan 01 00:00:00 1970 +0000
296 | date: Thu Jan 01 00:00:00 1970 +0000
297 | summary: add n3w_3_c
297 | summary: add n3w_3_c
298 |
298 |
299 | o changeset: 2:245bde4270cd
299 | o changeset: 2:245bde4270cd
300 |/ user: test
300 |/ user: test
301 | date: Thu Jan 01 00:00:00 1970 +0000
301 | date: Thu Jan 01 00:00:00 1970 +0000
302 | summary: add original_c
302 | summary: add original_c
303 |
303 |
304 o changeset: 1:7c3bad9141dc
304 o changeset: 1:7c3bad9141dc
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: add b
307 | summary: add b
308 |
308 |
309 o changeset: 0:1f0dee641bb7
309 o changeset: 0:1f0dee641bb7
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: add a
312 summary: add a
313
313
314
314
315
315
316
316
317 $ cd ..
317 $ cd ..
318
318
319 Exchange Test
319 Exchange Test
320 ============================
320 ============================
321
321
322 Destination repo does not have any data
322 Destination repo does not have any data
323 ---------------------------------------
323 ---------------------------------------
324
324
325 Simple incoming test
325 Simple incoming test
326
326
327 $ hg init tmpc
327 $ hg init tmpc
328 $ cd tmpc
328 $ cd tmpc
329 $ hg incoming ../tmpb
329 $ hg incoming ../tmpb
330 comparing with ../tmpb
330 comparing with ../tmpb
331 changeset: 0:1f0dee641bb7
331 changeset: 0:1f0dee641bb7
332 user: test
332 user: test
333 date: Thu Jan 01 00:00:00 1970 +0000
333 date: Thu Jan 01 00:00:00 1970 +0000
334 summary: add a
334 summary: add a
335
335
336 changeset: 1:7c3bad9141dc
336 changeset: 1:7c3bad9141dc
337 user: test
337 user: test
338 date: Thu Jan 01 00:00:00 1970 +0000
338 date: Thu Jan 01 00:00:00 1970 +0000
339 summary: add b
339 summary: add b
340
340
341 changeset: 2:245bde4270cd
341 changeset: 2:245bde4270cd
342 user: test
342 user: test
343 date: Thu Jan 01 00:00:00 1970 +0000
343 date: Thu Jan 01 00:00:00 1970 +0000
344 summary: add original_c
344 summary: add original_c
345
345
346 changeset: 6:6f9641995072
346 changeset: 6:6f9641995072
347 tag: tip
347 tag: tip
348 parent: 1:7c3bad9141dc
348 parent: 1:7c3bad9141dc
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: add n3w_3_c
351 summary: add n3w_3_c
352
352
353
353
354 Try to pull markers
354 Try to pull markers
355 (extinct changeset are excluded but marker are pushed)
355 (extinct changeset are excluded but marker are pushed)
356
356
357 $ hg pull ../tmpb
357 $ hg pull ../tmpb
358 pulling from ../tmpb
358 pulling from ../tmpb
359 requesting all changes
359 requesting all changes
360 adding changesets
360 adding changesets
361 adding manifests
361 adding manifests
362 adding file changes
362 adding file changes
363 added 4 changesets with 4 changes to 4 files (+1 heads)
363 added 4 changesets with 4 changes to 4 files (+1 heads)
364 (run 'hg heads' to see heads, 'hg merge' to merge)
364 (run 'hg heads' to see heads, 'hg merge' to merge)
365 $ hg debugobsolete
365 $ hg debugobsolete
366 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
366 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
367 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
367 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
368 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
368 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
369 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
369 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
370 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
370 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
371
371
372 Rollback//Transaction support
372 Rollback//Transaction support
373
373
374 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
374 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
375 $ hg debugobsolete
375 $ hg debugobsolete
376 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
376 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
377 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
377 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
378 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
378 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
379 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
379 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
380 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
380 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
381 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
381 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 {'date': '1340 0', 'user': 'test'}
382 $ hg rollback -n
382 $ hg rollback -n
383 repository tip rolled back to revision 3 (undo debugobsolete)
383 repository tip rolled back to revision 3 (undo debugobsolete)
384 $ hg rollback
384 $ hg rollback
385 repository tip rolled back to revision 3 (undo debugobsolete)
385 repository tip rolled back to revision 3 (undo debugobsolete)
386 $ hg debugobsolete
386 $ hg debugobsolete
387 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
387 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
388 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
388 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
389 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
389 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
390 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
390 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
391 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
391 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
392
392
393 $ cd ..
393 $ cd ..
394
394
395 Try to push markers
395 Try to push markers
396
396
397 $ hg init tmpd
397 $ hg init tmpd
398 $ hg -R tmpb push tmpd
398 $ hg -R tmpb push tmpd
399 pushing to tmpd
399 pushing to tmpd
400 searching for changes
400 searching for changes
401 adding changesets
401 adding changesets
402 adding manifests
402 adding manifests
403 adding file changes
403 adding file changes
404 added 4 changesets with 4 changes to 4 files (+1 heads)
404 added 4 changesets with 4 changes to 4 files (+1 heads)
405 $ hg -R tmpd debugobsolete
405 $ hg -R tmpd debugobsolete
406 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
406 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
407 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
407 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
408 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
408 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
409 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
409 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
410 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
410 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
411
411
412 Check obsolete keys are exchanged only if source has an obsolete store
412 Check obsolete keys are exchanged only if source has an obsolete store
413
413
414 $ hg init empty
414 $ hg init empty
415 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
415 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
416 pushing to tmpd
416 pushing to tmpd
417 no changes found
417 no changes found
418 listkeys phases
418 listkeys phases
419 listkeys bookmarks
419 listkeys bookmarks
420 [1]
420 [1]
421
421
422 clone support
422 clone support
423 (markers are copied and extinct changesets are included to allow hardlinks)
423 (markers are copied and extinct changesets are included to allow hardlinks)
424
424
425 $ hg clone tmpb clone-dest
425 $ hg clone tmpb clone-dest
426 updating to branch default
426 updating to branch default
427 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
428 $ hg -R clone-dest log -G --hidden
428 $ hg -R clone-dest log -G --hidden
429 @ changeset: 6:6f9641995072
429 @ changeset: 6:6f9641995072
430 | tag: tip
430 | tag: tip
431 | parent: 1:7c3bad9141dc
431 | parent: 1:7c3bad9141dc
432 | user: test
432 | user: test
433 | date: Thu Jan 01 00:00:00 1970 +0000
433 | date: Thu Jan 01 00:00:00 1970 +0000
434 | summary: add n3w_3_c
434 | summary: add n3w_3_c
435 |
435 |
436 | x changeset: 5:5601fb93a350
436 | x changeset: 5:5601fb93a350
437 |/ parent: 1:7c3bad9141dc
437 |/ parent: 1:7c3bad9141dc
438 | user: test
438 | user: test
439 | date: Thu Jan 01 00:00:00 1970 +0000
439 | date: Thu Jan 01 00:00:00 1970 +0000
440 | summary: add new_3_c
440 | summary: add new_3_c
441 |
441 |
442 | x changeset: 4:ca819180edb9
442 | x changeset: 4:ca819180edb9
443 |/ parent: 1:7c3bad9141dc
443 |/ parent: 1:7c3bad9141dc
444 | user: test
444 | user: test
445 | date: Thu Jan 01 00:00:00 1970 +0000
445 | date: Thu Jan 01 00:00:00 1970 +0000
446 | summary: add new_2_c
446 | summary: add new_2_c
447 |
447 |
448 | x changeset: 3:cdbce2fbb163
448 | x changeset: 3:cdbce2fbb163
449 |/ parent: 1:7c3bad9141dc
449 |/ parent: 1:7c3bad9141dc
450 | user: test
450 | user: test
451 | date: Thu Jan 01 00:00:00 1970 +0000
451 | date: Thu Jan 01 00:00:00 1970 +0000
452 | summary: add new_c
452 | summary: add new_c
453 |
453 |
454 | o changeset: 2:245bde4270cd
454 | o changeset: 2:245bde4270cd
455 |/ user: test
455 |/ user: test
456 | date: Thu Jan 01 00:00:00 1970 +0000
456 | date: Thu Jan 01 00:00:00 1970 +0000
457 | summary: add original_c
457 | summary: add original_c
458 |
458 |
459 o changeset: 1:7c3bad9141dc
459 o changeset: 1:7c3bad9141dc
460 | user: test
460 | user: test
461 | date: Thu Jan 01 00:00:00 1970 +0000
461 | date: Thu Jan 01 00:00:00 1970 +0000
462 | summary: add b
462 | summary: add b
463 |
463 |
464 o changeset: 0:1f0dee641bb7
464 o changeset: 0:1f0dee641bb7
465 user: test
465 user: test
466 date: Thu Jan 01 00:00:00 1970 +0000
466 date: Thu Jan 01 00:00:00 1970 +0000
467 summary: add a
467 summary: add a
468
468
469 $ hg -R clone-dest debugobsolete
469 $ hg -R clone-dest debugobsolete
470 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
470 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
471 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
471 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
472 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
472 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
473 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
473 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
474 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
474 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
475
475
476
476
477 Destination repo have existing data
477 Destination repo have existing data
478 ---------------------------------------
478 ---------------------------------------
479
479
480 On pull
480 On pull
481
481
482 $ hg init tmpe
482 $ hg init tmpe
483 $ cd tmpe
483 $ cd tmpe
484 $ hg debugobsolete -d '1339 0' 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339
484 $ hg debugobsolete -d '1339 0' 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339
485 $ hg pull ../tmpb
485 $ hg pull ../tmpb
486 pulling from ../tmpb
486 pulling from ../tmpb
487 requesting all changes
487 requesting all changes
488 adding changesets
488 adding changesets
489 adding manifests
489 adding manifests
490 adding file changes
490 adding file changes
491 added 4 changesets with 4 changes to 4 files (+1 heads)
491 added 4 changesets with 4 changes to 4 files (+1 heads)
492 (run 'hg heads' to see heads, 'hg merge' to merge)
492 (run 'hg heads' to see heads, 'hg merge' to merge)
493 $ hg debugobsolete
493 $ hg debugobsolete
494 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
494 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
495 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
495 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
496 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
496 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
497 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
497 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
498 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
498 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
499 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
499 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
500
500
501
501
502 On push
502 On push
503
503
504 $ hg push ../tmpc
504 $ hg push ../tmpc
505 pushing to ../tmpc
505 pushing to ../tmpc
506 searching for changes
506 searching for changes
507 no changes found
507 no changes found
508 [1]
508 [1]
509 $ hg -R ../tmpc debugobsolete
509 $ hg -R ../tmpc debugobsolete
510 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
510 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C {'date': '56 12', 'user': 'test'}
511 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
511 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
512 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
512 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
513 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
513 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'}
514 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
514 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 {'date': '1338 0', 'user': 'test'}
515 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
515 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'}
516
516
517 detect outgoing obsolete and unstable
517 detect outgoing obsolete and unstable
518 ---------------------------------------
518 ---------------------------------------
519
519
520
520
521 $ hg log -G
521 $ hg log -G
522 o changeset: 3:6f9641995072
522 o changeset: 3:6f9641995072
523 | tag: tip
523 | tag: tip
524 | parent: 1:7c3bad9141dc
524 | parent: 1:7c3bad9141dc
525 | user: test
525 | user: test
526 | date: Thu Jan 01 00:00:00 1970 +0000
526 | date: Thu Jan 01 00:00:00 1970 +0000
527 | summary: add n3w_3_c
527 | summary: add n3w_3_c
528 |
528 |
529 | o changeset: 2:245bde4270cd
529 | o changeset: 2:245bde4270cd
530 |/ user: test
530 |/ user: test
531 | date: Thu Jan 01 00:00:00 1970 +0000
531 | date: Thu Jan 01 00:00:00 1970 +0000
532 | summary: add original_c
532 | summary: add original_c
533 |
533 |
534 o changeset: 1:7c3bad9141dc
534 o changeset: 1:7c3bad9141dc
535 | user: test
535 | user: test
536 | date: Thu Jan 01 00:00:00 1970 +0000
536 | date: Thu Jan 01 00:00:00 1970 +0000
537 | summary: add b
537 | summary: add b
538 |
538 |
539 o changeset: 0:1f0dee641bb7
539 o changeset: 0:1f0dee641bb7
540 user: test
540 user: test
541 date: Thu Jan 01 00:00:00 1970 +0000
541 date: Thu Jan 01 00:00:00 1970 +0000
542 summary: add a
542 summary: add a
543
543
544 $ hg up 'desc("n3w_3_c")'
544 $ hg up 'desc("n3w_3_c")'
545 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
545 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
546 $ mkcommit original_d
546 $ mkcommit original_d
547 $ mkcommit original_e
547 $ mkcommit original_e
548 $ hg debugobsolete `getid original_d` -d '0 0'
548 $ hg debugobsolete `getid original_d` -d '0 0'
549 $ hg log -r 'obsolete()'
549 $ hg log -r 'obsolete()'
550 changeset: 4:94b33453f93b
550 changeset: 4:94b33453f93b
551 user: test
551 user: test
552 date: Thu Jan 01 00:00:00 1970 +0000
552 date: Thu Jan 01 00:00:00 1970 +0000
553 summary: add original_d
553 summary: add original_d
554
554
555 $ hg log -G -r '::unstable()'
555 $ hg log -G -r '::unstable()'
556 @ changeset: 5:cda648ca50f5
556 @ changeset: 5:cda648ca50f5
557 | tag: tip
557 | tag: tip
558 | user: test
558 | user: test
559 | date: Thu Jan 01 00:00:00 1970 +0000
559 | date: Thu Jan 01 00:00:00 1970 +0000
560 | summary: add original_e
560 | summary: add original_e
561 |
561 |
562 x changeset: 4:94b33453f93b
562 x changeset: 4:94b33453f93b
563 | user: test
563 | user: test
564 | date: Thu Jan 01 00:00:00 1970 +0000
564 | date: Thu Jan 01 00:00:00 1970 +0000
565 | summary: add original_d
565 | summary: add original_d
566 |
566 |
567 o changeset: 3:6f9641995072
567 o changeset: 3:6f9641995072
568 | parent: 1:7c3bad9141dc
568 | parent: 1:7c3bad9141dc
569 | user: test
569 | user: test
570 | date: Thu Jan 01 00:00:00 1970 +0000
570 | date: Thu Jan 01 00:00:00 1970 +0000
571 | summary: add n3w_3_c
571 | summary: add n3w_3_c
572 |
572 |
573 o changeset: 1:7c3bad9141dc
573 o changeset: 1:7c3bad9141dc
574 | user: test
574 | user: test
575 | date: Thu Jan 01 00:00:00 1970 +0000
575 | date: Thu Jan 01 00:00:00 1970 +0000
576 | summary: add b
576 | summary: add b
577 |
577 |
578 o changeset: 0:1f0dee641bb7
578 o changeset: 0:1f0dee641bb7
579 user: test
579 user: test
580 date: Thu Jan 01 00:00:00 1970 +0000
580 date: Thu Jan 01 00:00:00 1970 +0000
581 summary: add a
581 summary: add a
582
582
583
583
584 refuse to push obsolete changeset
584 refuse to push obsolete changeset
585
585
586 $ hg push ../tmpc/ -r 'desc("original_d")'
586 $ hg push ../tmpc/ -r 'desc("original_d")'
587 pushing to ../tmpc/
587 pushing to ../tmpc/
588 searching for changes
588 searching for changes
589 abort: push includes obsolete changeset: 94b33453f93b!
589 abort: push includes obsolete changeset: 94b33453f93b!
590 [255]
590 [255]
591
591
592 refuse to push unstable changeset
592 refuse to push unstable changeset
593
593
594 $ hg push ../tmpc/
594 $ hg push ../tmpc/
595 pushing to ../tmpc/
595 pushing to ../tmpc/
596 searching for changes
596 searching for changes
597 abort: push includes unstable changeset: cda648ca50f5!
597 abort: push includes unstable changeset: cda648ca50f5!
598 [255]
598 [255]
599
599
600 Test that extinct changeset are properly detected
600 Test that extinct changeset are properly detected
601
601
602 $ hg log -r 'extinct()'
602 $ hg log -r 'extinct()'
603
603
604 Don't try to push extinct changeset
604 Don't try to push extinct changeset
605
605
606 $ hg init ../tmpf
606 $ hg init ../tmpf
607 $ hg out ../tmpf
607 $ hg out ../tmpf
608 comparing with ../tmpf
608 comparing with ../tmpf
609 searching for changes
609 searching for changes
610 changeset: 0:1f0dee641bb7
610 changeset: 0:1f0dee641bb7
611 user: test
611 user: test
612 date: Thu Jan 01 00:00:00 1970 +0000
612 date: Thu Jan 01 00:00:00 1970 +0000
613 summary: add a
613 summary: add a
614
614
615 changeset: 1:7c3bad9141dc
615 changeset: 1:7c3bad9141dc
616 user: test
616 user: test
617 date: Thu Jan 01 00:00:00 1970 +0000
617 date: Thu Jan 01 00:00:00 1970 +0000
618 summary: add b
618 summary: add b
619
619
620 changeset: 2:245bde4270cd
620 changeset: 2:245bde4270cd
621 user: test
621 user: test
622 date: Thu Jan 01 00:00:00 1970 +0000
622 date: Thu Jan 01 00:00:00 1970 +0000
623 summary: add original_c
623 summary: add original_c
624
624
625 changeset: 3:6f9641995072
625 changeset: 3:6f9641995072
626 parent: 1:7c3bad9141dc
626 parent: 1:7c3bad9141dc
627 user: test
627 user: test
628 date: Thu Jan 01 00:00:00 1970 +0000
628 date: Thu Jan 01 00:00:00 1970 +0000
629 summary: add n3w_3_c
629 summary: add n3w_3_c
630
630
631 changeset: 4:94b33453f93b
631 changeset: 4:94b33453f93b
632 user: test
632 user: test
633 date: Thu Jan 01 00:00:00 1970 +0000
633 date: Thu Jan 01 00:00:00 1970 +0000
634 summary: add original_d
634 summary: add original_d
635
635
636 changeset: 5:cda648ca50f5
636 changeset: 5:cda648ca50f5
637 tag: tip
637 tag: tip
638 user: test
638 user: test
639 date: Thu Jan 01 00:00:00 1970 +0000
639 date: Thu Jan 01 00:00:00 1970 +0000
640 summary: add original_e
640 summary: add original_e
641
641
642 $ hg push ../tmpf -f # -f because be push unstable too
642 $ hg push ../tmpf -f # -f because be push unstable too
643 pushing to ../tmpf
643 pushing to ../tmpf
644 searching for changes
644 searching for changes
645 adding changesets
645 adding changesets
646 adding manifests
646 adding manifests
647 adding file changes
647 adding file changes
648 added 6 changesets with 6 changes to 6 files (+1 heads)
648 added 6 changesets with 6 changes to 6 files (+1 heads)
649
649
650 no warning displayed
650 no warning displayed
651
651
652 $ hg push ../tmpf
652 $ hg push ../tmpf
653 pushing to ../tmpf
653 pushing to ../tmpf
654 searching for changes
654 searching for changes
655 no changes found
655 no changes found
656 [1]
656 [1]
657
657
658 Do not warn about new head when the new head is a successors of a remote one
658 Do not warn about new head when the new head is a successors of a remote one
659
659
660 $ hg log -G
660 $ hg log -G
661 @ changeset: 5:cda648ca50f5
661 @ changeset: 5:cda648ca50f5
662 | tag: tip
662 | tag: tip
663 | user: test
663 | user: test
664 | date: Thu Jan 01 00:00:00 1970 +0000
664 | date: Thu Jan 01 00:00:00 1970 +0000
665 | summary: add original_e
665 | summary: add original_e
666 |
666 |
667 x changeset: 4:94b33453f93b
667 x changeset: 4:94b33453f93b
668 | user: test
668 | user: test
669 | date: Thu Jan 01 00:00:00 1970 +0000
669 | date: Thu Jan 01 00:00:00 1970 +0000
670 | summary: add original_d
670 | summary: add original_d
671 |
671 |
672 o changeset: 3:6f9641995072
672 o changeset: 3:6f9641995072
673 | parent: 1:7c3bad9141dc
673 | parent: 1:7c3bad9141dc
674 | user: test
674 | user: test
675 | date: Thu Jan 01 00:00:00 1970 +0000
675 | date: Thu Jan 01 00:00:00 1970 +0000
676 | summary: add n3w_3_c
676 | summary: add n3w_3_c
677 |
677 |
678 | o changeset: 2:245bde4270cd
678 | o changeset: 2:245bde4270cd
679 |/ user: test
679 |/ user: test
680 | date: Thu Jan 01 00:00:00 1970 +0000
680 | date: Thu Jan 01 00:00:00 1970 +0000
681 | summary: add original_c
681 | summary: add original_c
682 |
682 |
683 o changeset: 1:7c3bad9141dc
683 o changeset: 1:7c3bad9141dc
684 | user: test
684 | user: test
685 | date: Thu Jan 01 00:00:00 1970 +0000
685 | date: Thu Jan 01 00:00:00 1970 +0000
686 | summary: add b
686 | summary: add b
687 |
687 |
688 o changeset: 0:1f0dee641bb7
688 o changeset: 0:1f0dee641bb7
689 user: test
689 user: test
690 date: Thu Jan 01 00:00:00 1970 +0000
690 date: Thu Jan 01 00:00:00 1970 +0000
691 summary: add a
691 summary: add a
692
692
693 $ hg up -q 'desc(n3w_3_c)'
693 $ hg up -q 'desc(n3w_3_c)'
694 $ mkcommit obsolete_e
694 $ mkcommit obsolete_e
695 created new head
695 created new head
696 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
696 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
697 $ hg outgoing ../tmpf # parasite hg outgoing testin
697 $ hg outgoing ../tmpf # parasite hg outgoing testin
698 comparing with ../tmpf
698 comparing with ../tmpf
699 searching for changes
699 searching for changes
700 changeset: 6:3de5eca88c00
700 changeset: 6:3de5eca88c00
701 tag: tip
701 tag: tip
702 parent: 3:6f9641995072
702 parent: 3:6f9641995072
703 user: test
703 user: test
704 date: Thu Jan 01 00:00:00 1970 +0000
704 date: Thu Jan 01 00:00:00 1970 +0000
705 summary: add obsolete_e
705 summary: add obsolete_e
706
706
707 $ hg push ../tmpf
707 $ hg push ../tmpf
708 pushing to ../tmpf
708 pushing to ../tmpf
709 searching for changes
709 searching for changes
710 adding changesets
710 adding changesets
711 adding manifests
711 adding manifests
712 adding file changes
712 adding file changes
713 added 1 changesets with 1 changes to 1 files (+1 heads)
713 added 1 changesets with 1 changes to 1 files (+1 heads)
714
714
715 #if serve
715 #if serve
716
716
717 check hgweb does not explode
717 check hgweb does not explode
718 ====================================
718 ====================================
719
719
720 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
720 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
721 adding changesets
721 adding changesets
722 adding manifests
722 adding manifests
723 adding file changes
723 adding file changes
724 added 62 changesets with 63 changes to 9 files (+60 heads)
724 added 62 changesets with 63 changes to 9 files (+60 heads)
725 (run 'hg heads .' to see heads, 'hg merge' to merge)
725 (run 'hg heads .' to see heads, 'hg merge' to merge)
726 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
726 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
727 > do
727 > do
728 > hg debugobsolete $node
728 > hg debugobsolete $node
729 > done
729 > done
730 $ hg up tip
730 $ hg up tip
731 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
732
732
733 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
733 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
734 $ cat hg.pid >> $DAEMON_PIDS
734 $ cat hg.pid >> $DAEMON_PIDS
735
735
736 check changelog view
736 check changelog view
737
737
738 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
738 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
739 200 Script output follows
739 200 Script output follows
740
740
741 check graph view
741 check graph view
742
742
743 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
743 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
744 200 Script output follows
744 200 Script output follows
745
745
746 check filelog view
746 check filelog view
747
747
748 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
748 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
749 200 Script output follows
749 200 Script output follows
750
750
751 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'
751 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'
752 200 Script output follows
752 200 Script output follows
753 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
753 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
754 404 Not Found
754 404 Not Found
755 [1]
755 [1]
756
756
757 check that web.view config option:
757 check that web.view config option:
758
758
759 $ "$TESTDIR/killdaemons.py" hg.pid
759 $ "$TESTDIR/killdaemons.py" hg.pid
760 $ cat >> .hg/hgrc << EOF
760 $ cat >> .hg/hgrc << EOF
761 > [web]
761 > [web]
762 > view=all
762 > view=all
763 > EOF
763 > EOF
764 $ wait
764 $ wait
765 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
765 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
766 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
766 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
767 200 Script output follows
767 200 Script output follows
768 $ "$TESTDIR/killdaemons.py" hg.pid
768 $ "$TESTDIR/killdaemons.py" hg.pid
769
769
770 Checking _enable=False warning if obsolete marker exists
770 Checking _enable=False warning if obsolete marker exists
771
771
772 $ echo '[extensions]' >> $HGRCPATH
772 $ echo '[extensions]' >> $HGRCPATH
773 $ echo "obs=!" >> $HGRCPATH
773 $ echo "obs=!" >> $HGRCPATH
774 $ hg log -r tip
774 $ hg log -r tip
775 obsolete feature not enabled but 68 markers found!
775 obsolete feature not enabled but 68 markers found!
776 changeset: 68:c15e9edfca13
776 changeset: 68:c15e9edfca13
777 tag: tip
777 tag: tip
778 parent: 7:50c51b361e60
778 parent: 7:50c51b361e60
779 user: test
779 user: test
780 date: Thu Jan 01 00:00:00 1970 +0000
780 date: Thu Jan 01 00:00:00 1970 +0000
781 summary: add celestine
781 summary: add celestine
782
782
783
783
784 reenable for later test
784 reenable for later test
785
785
786 $ echo '[extensions]' >> $HGRCPATH
786 $ echo '[extensions]' >> $HGRCPATH
787 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
787 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
788
788
789 #endif
789 #endif
790
790
791 Test incoming/outcoming with changesets obsoleted remotely, known locally
791 Test incoming/outcoming with changesets obsoleted remotely, known locally
792 ===============================================================================
792 ===============================================================================
793
793
794 This test issue 3805
794 This test issue 3805
795
795
796 $ hg init repo-issue3805
796 $ hg init repo-issue3805
797 $ cd repo-issue3805
797 $ cd repo-issue3805
798 $ echo "foo" > foo
798 $ echo "foo" > foo
799 $ hg ci -Am "A"
799 $ hg ci -Am "A"
800 adding foo
800 adding foo
801 $ hg clone . ../other-issue3805
801 $ hg clone . ../other-issue3805
802 updating to branch default
802 updating to branch default
803 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
803 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
804 $ echo "bar" >> foo
804 $ echo "bar" >> foo
805 $ hg ci --amend
805 $ hg ci --amend
806 $ cd ../other-issue3805
806 $ cd ../other-issue3805
807 $ hg log -G
807 $ hg log -G
808 @ changeset: 0:193e9254ce7e
808 @ changeset: 0:193e9254ce7e
809 tag: tip
809 tag: tip
810 user: test
810 user: test
811 date: Thu Jan 01 00:00:00 1970 +0000
811 date: Thu Jan 01 00:00:00 1970 +0000
812 summary: A
812 summary: A
813
813
814 $ hg log -G -R ../repo-issue3805
814 $ hg log -G -R ../repo-issue3805
815 @ changeset: 2:3816541e5485
815 @ changeset: 2:3816541e5485
816 tag: tip
816 tag: tip
817 parent: -1:000000000000
817 parent: -1:000000000000
818 user: test
818 user: test
819 date: Thu Jan 01 00:00:00 1970 +0000
819 date: Thu Jan 01 00:00:00 1970 +0000
820 summary: A
820 summary: A
821
821
822 $ hg incoming
822 $ hg incoming
823 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
823 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
824 searching for changes
824 searching for changes
825 changeset: 2:3816541e5485
825 changeset: 2:3816541e5485
826 tag: tip
826 tag: tip
827 parent: -1:000000000000
827 parent: -1:000000000000
828 user: test
828 user: test
829 date: Thu Jan 01 00:00:00 1970 +0000
829 date: Thu Jan 01 00:00:00 1970 +0000
830 summary: A
830 summary: A
831
831
832 $ hg incoming --bundle ../issue3805.hg
832 $ hg incoming --bundle ../issue3805.hg
833 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
833 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
834 searching for changes
834 searching for changes
835 changeset: 2:3816541e5485
835 changeset: 2:3816541e5485
836 tag: tip
836 tag: tip
837 parent: -1:000000000000
837 parent: -1:000000000000
838 user: test
838 user: test
839 date: Thu Jan 01 00:00:00 1970 +0000
839 date: Thu Jan 01 00:00:00 1970 +0000
840 summary: A
840 summary: A
841
841
842 $ hg outgoing
842 $ hg outgoing
843 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
843 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
844 searching for changes
844 searching for changes
845 no changes found
845 no changes found
846 [1]
846 [1]
847
847
848 #if serve
848 #if serve
849
849
850 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
850 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
851 $ cat hg.pid >> $DAEMON_PIDS
851 $ cat hg.pid >> $DAEMON_PIDS
852
852
853 $ hg incoming http://localhost:$HGPORT
853 $ hg incoming http://localhost:$HGPORT
854 comparing with http://localhost:$HGPORT/
854 comparing with http://localhost:$HGPORT/
855 searching for changes
855 searching for changes
856 changeset: 1:3816541e5485
856 changeset: 1:3816541e5485
857 tag: tip
857 tag: tip
858 parent: -1:000000000000
858 parent: -1:000000000000
859 user: test
859 user: test
860 date: Thu Jan 01 00:00:00 1970 +0000
860 date: Thu Jan 01 00:00:00 1970 +0000
861 summary: A
861 summary: A
862
862
863 $ hg outgoing http://localhost:$HGPORT
863 $ hg outgoing http://localhost:$HGPORT
864 comparing with http://localhost:$HGPORT/
864 comparing with http://localhost:$HGPORT/
865 searching for changes
865 searching for changes
866 no changes found
866 no changes found
867 [1]
867 [1]
868
868
869 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
869 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
870
870
871 #endif
871 #endif
872
872
873 This test issue 3814
873 This test issue 3814
874
874
875 (nothing to push but locally hidden changeset)
875 (nothing to push but locally hidden changeset)
876
876
877 $ cd ..
877 $ cd ..
878 $ hg init repo-issue3814
878 $ hg init repo-issue3814
879 $ cd repo-issue3805
879 $ cd repo-issue3805
880 $ hg push -r 3816541e5485 ../repo-issue3814
880 $ hg push -r 3816541e5485 ../repo-issue3814
881 pushing to ../repo-issue3814
881 pushing to ../repo-issue3814
882 searching for changes
882 searching for changes
883 adding changesets
883 adding changesets
884 adding manifests
884 adding manifests
885 adding file changes
885 adding file changes
886 added 1 changesets with 1 changes to 1 files
886 added 1 changesets with 1 changes to 1 files
887 $ hg out ../repo-issue3814
887 $ hg out ../repo-issue3814
888 comparing with ../repo-issue3814
888 comparing with ../repo-issue3814
889 searching for changes
889 searching for changes
890 no changes found
890 no changes found
891 [1]
891 [1]
892
892
893 Test that a local tag blocks a changeset from being hidden
893 Test that a local tag blocks a changeset from being hidden
894
894
895 $ hg tag -l visible -r 0 --hidden
895 $ hg tag -l visible -r 0 --hidden
896 $ hg log -G
896 $ hg log -G
897 @ changeset: 2:3816541e5485
897 @ changeset: 2:3816541e5485
898 tag: tip
898 tag: tip
899 parent: -1:000000000000
899 parent: -1:000000000000
900 user: test
900 user: test
901 date: Thu Jan 01 00:00:00 1970 +0000
901 date: Thu Jan 01 00:00:00 1970 +0000
902 summary: A
902 summary: A
903
903
904 x changeset: 0:193e9254ce7e
904 x changeset: 0:193e9254ce7e
905 tag: visible
905 tag: visible
906 user: test
906 user: test
907 date: Thu Jan 01 00:00:00 1970 +0000
907 date: Thu Jan 01 00:00:00 1970 +0000
908 summary: A
908 summary: A
909
909
910 Test that removing a local tag does not cause some commands to fail
911
912 $ hg tag -l -r tip tiptag
913 $ hg tags
914 tiptag 2:3816541e5485
915 tip 2:3816541e5485
916 visible 0:193e9254ce7e
917 $ hg --config extensions.strip= strip -r tip --no-backup
918 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
919 $ hg tags
920 visible 0:193e9254ce7e
921 tip 0:193e9254ce7e
General Comments 0
You need to be logged in to leave comments. Login now