##// END OF EJS Templates
hgweb: use introrev() for finding parents (issue4506)...
Anton Shestakov -
r24136:46d6cdfc default
parent child Browse files
Show More
@@ -1,440 +1,441 b''
1 1 # hgweb/webutil.py - utility library for the web interface.
2 2 #
3 3 # Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
4 4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
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 import os, copy
10 10 from mercurial import match, patch, error, ui, util, pathutil, context
11 11 from mercurial.i18n import _
12 12 from mercurial.node import hex, nullid
13 13 from common import ErrorResponse
14 14 from common import HTTP_NOT_FOUND
15 15 import difflib
16 16
17 17 def up(p):
18 18 if p[0] != "/":
19 19 p = "/" + p
20 20 if p[-1] == "/":
21 21 p = p[:-1]
22 22 up = os.path.dirname(p)
23 23 if up == "/":
24 24 return "/"
25 25 return up + "/"
26 26
27 27 def _navseq(step, firststep=None):
28 28 if firststep:
29 29 yield firststep
30 30 if firststep >= 20 and firststep <= 40:
31 31 firststep = 50
32 32 yield firststep
33 33 assert step > 0
34 34 assert firststep > 0
35 35 while step <= firststep:
36 36 step *= 10
37 37 while True:
38 38 yield 1 * step
39 39 yield 3 * step
40 40 step *= 10
41 41
42 42 class revnav(object):
43 43
44 44 def __init__(self, repo):
45 45 """Navigation generation object
46 46
47 47 :repo: repo object we generate nav for
48 48 """
49 49 # used for hex generation
50 50 self._revlog = repo.changelog
51 51
52 52 def __nonzero__(self):
53 53 """return True if any revision to navigate over"""
54 54 return self._first() is not None
55 55
56 56 def _first(self):
57 57 """return the minimum non-filtered changeset or None"""
58 58 try:
59 59 return iter(self._revlog).next()
60 60 except StopIteration:
61 61 return None
62 62
63 63 def hex(self, rev):
64 64 return hex(self._revlog.node(rev))
65 65
66 66 def gen(self, pos, pagelen, limit):
67 67 """computes label and revision id for navigation link
68 68
69 69 :pos: is the revision relative to which we generate navigation.
70 70 :pagelen: the size of each navigation page
71 71 :limit: how far shall we link
72 72
73 73 The return is:
74 74 - a single element tuple
75 75 - containing a dictionary with a `before` and `after` key
76 76 - values are generator functions taking arbitrary number of kwargs
77 77 - yield items are dictionaries with `label` and `node` keys
78 78 """
79 79 if not self:
80 80 # empty repo
81 81 return ({'before': (), 'after': ()},)
82 82
83 83 targets = []
84 84 for f in _navseq(1, pagelen):
85 85 if f > limit:
86 86 break
87 87 targets.append(pos + f)
88 88 targets.append(pos - f)
89 89 targets.sort()
90 90
91 91 first = self._first()
92 92 navbefore = [("(%i)" % first, self.hex(first))]
93 93 navafter = []
94 94 for rev in targets:
95 95 if rev not in self._revlog:
96 96 continue
97 97 if pos < rev < limit:
98 98 navafter.append(("+%d" % abs(rev - pos), self.hex(rev)))
99 99 if 0 < rev < pos:
100 100 navbefore.append(("-%d" % abs(rev - pos), self.hex(rev)))
101 101
102 102
103 103 navafter.append(("tip", "tip"))
104 104
105 105 data = lambda i: {"label": i[0], "node": i[1]}
106 106 return ({'before': lambda **map: (data(i) for i in navbefore),
107 107 'after': lambda **map: (data(i) for i in navafter)},)
108 108
109 109 class filerevnav(revnav):
110 110
111 111 def __init__(self, repo, path):
112 112 """Navigation generation object
113 113
114 114 :repo: repo object we generate nav for
115 115 :path: path of the file we generate nav for
116 116 """
117 117 # used for iteration
118 118 self._changelog = repo.unfiltered().changelog
119 119 # used for hex generation
120 120 self._revlog = repo.file(path)
121 121
122 122 def hex(self, rev):
123 123 return hex(self._changelog.node(self._revlog.linkrev(rev)))
124 124
125 125
126 126 def _siblings(siblings=[], hiderev=None):
127 127 siblings = [s for s in siblings if s.node() != nullid]
128 128 if len(siblings) == 1 and siblings[0].rev() == hiderev:
129 129 return
130 130 for s in siblings:
131 131 d = {'node': s.hex(), 'rev': s.rev()}
132 132 d['user'] = s.user()
133 133 d['date'] = s.date()
134 134 d['description'] = s.description()
135 135 d['branch'] = s.branch()
136 136 if util.safehasattr(s, 'path'):
137 137 d['file'] = s.path()
138 138 yield d
139 139
140 140 def parents(ctx, hide=None):
141 if (isinstance(ctx, context.basefilectx) and
142 ctx.changectx().rev() != ctx.linkrev()):
143 return _siblings([ctx._repo[ctx.linkrev()]], hide)
141 if isinstance(ctx, context.basefilectx):
142 introrev = ctx.introrev()
143 if ctx.changectx().rev() != introrev:
144 return _siblings([ctx._repo[introrev]], hide)
144 145 return _siblings(ctx.parents(), hide)
145 146
146 147 def children(ctx, hide=None):
147 148 return _siblings(ctx.children(), hide)
148 149
149 150 def renamelink(fctx):
150 151 r = fctx.renamed()
151 152 if r:
152 153 return [{'file': r[0], 'node': hex(r[1])}]
153 154 return []
154 155
155 156 def nodetagsdict(repo, node):
156 157 return [{"name": i} for i in repo.nodetags(node)]
157 158
158 159 def nodebookmarksdict(repo, node):
159 160 return [{"name": i} for i in repo.nodebookmarks(node)]
160 161
161 162 def nodebranchdict(repo, ctx):
162 163 branches = []
163 164 branch = ctx.branch()
164 165 # If this is an empty repo, ctx.node() == nullid,
165 166 # ctx.branch() == 'default'.
166 167 try:
167 168 branchnode = repo.branchtip(branch)
168 169 except error.RepoLookupError:
169 170 branchnode = None
170 171 if branchnode == ctx.node():
171 172 branches.append({"name": branch})
172 173 return branches
173 174
174 175 def nodeinbranch(repo, ctx):
175 176 branches = []
176 177 branch = ctx.branch()
177 178 try:
178 179 branchnode = repo.branchtip(branch)
179 180 except error.RepoLookupError:
180 181 branchnode = None
181 182 if branch != 'default' and branchnode != ctx.node():
182 183 branches.append({"name": branch})
183 184 return branches
184 185
185 186 def nodebranchnodefault(ctx):
186 187 branches = []
187 188 branch = ctx.branch()
188 189 if branch != 'default':
189 190 branches.append({"name": branch})
190 191 return branches
191 192
192 193 def showtag(repo, tmpl, t1, node=nullid, **args):
193 194 for t in repo.nodetags(node):
194 195 yield tmpl(t1, tag=t, **args)
195 196
196 197 def showbookmark(repo, tmpl, t1, node=nullid, **args):
197 198 for t in repo.nodebookmarks(node):
198 199 yield tmpl(t1, bookmark=t, **args)
199 200
200 201 def cleanpath(repo, path):
201 202 path = path.lstrip('/')
202 203 return pathutil.canonpath(repo.root, '', path)
203 204
204 205 def changeidctx (repo, changeid):
205 206 try:
206 207 ctx = repo[changeid]
207 208 except error.RepoError:
208 209 man = repo.manifest
209 210 ctx = repo[man.linkrev(man.rev(man.lookup(changeid)))]
210 211
211 212 return ctx
212 213
213 214 def changectx (repo, req):
214 215 changeid = "tip"
215 216 if 'node' in req.form:
216 217 changeid = req.form['node'][0]
217 218 ipos=changeid.find(':')
218 219 if ipos != -1:
219 220 changeid = changeid[(ipos + 1):]
220 221 elif 'manifest' in req.form:
221 222 changeid = req.form['manifest'][0]
222 223
223 224 return changeidctx(repo, changeid)
224 225
225 226 def basechangectx(repo, req):
226 227 if 'node' in req.form:
227 228 changeid = req.form['node'][0]
228 229 ipos=changeid.find(':')
229 230 if ipos != -1:
230 231 changeid = changeid[:ipos]
231 232 return changeidctx(repo, changeid)
232 233
233 234 return None
234 235
235 236 def filectx(repo, req):
236 237 if 'file' not in req.form:
237 238 raise ErrorResponse(HTTP_NOT_FOUND, 'file not given')
238 239 path = cleanpath(repo, req.form['file'][0])
239 240 if 'node' in req.form:
240 241 changeid = req.form['node'][0]
241 242 elif 'filenode' in req.form:
242 243 changeid = req.form['filenode'][0]
243 244 else:
244 245 raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given')
245 246 try:
246 247 fctx = repo[changeid][path]
247 248 except error.RepoError:
248 249 fctx = repo.filectx(path, fileid=changeid)
249 250
250 251 return fctx
251 252
252 253 def changelistentry(web, ctx, tmpl):
253 254 '''Obtain a dictionary to be used for entries in a changelist.
254 255
255 256 This function is called when producing items for the "entries" list passed
256 257 to the "shortlog" and "changelog" templates.
257 258 '''
258 259 repo = web.repo
259 260 rev = ctx.rev()
260 261 n = ctx.node()
261 262 showtags = showtag(repo, tmpl, 'changelogtag', n)
262 263 files = listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
263 264
264 265 return {
265 266 "author": ctx.user(),
266 267 "parent": parents(ctx, rev - 1),
267 268 "child": children(ctx, rev + 1),
268 269 "changelogtag": showtags,
269 270 "desc": ctx.description(),
270 271 "extra": ctx.extra(),
271 272 "date": ctx.date(),
272 273 "files": files,
273 274 "rev": rev,
274 275 "node": hex(n),
275 276 "tags": nodetagsdict(repo, n),
276 277 "bookmarks": nodebookmarksdict(repo, n),
277 278 "inbranch": nodeinbranch(repo, ctx),
278 279 "branches": nodebranchdict(repo, ctx)
279 280 }
280 281
281 282 def listfilediffs(tmpl, files, node, max):
282 283 for f in files[:max]:
283 284 yield tmpl('filedifflink', node=hex(node), file=f)
284 285 if len(files) > max:
285 286 yield tmpl('fileellipses')
286 287
287 288 def diffs(repo, tmpl, ctx, basectx, files, parity, style):
288 289
289 290 def countgen():
290 291 start = 1
291 292 while True:
292 293 yield start
293 294 start += 1
294 295
295 296 blockcount = countgen()
296 297 def prettyprintlines(diff, blockno):
297 298 for lineno, l in enumerate(diff.splitlines(True)):
298 299 lineno = "%d.%d" % (blockno, lineno + 1)
299 300 if l.startswith('+'):
300 301 ltype = "difflineplus"
301 302 elif l.startswith('-'):
302 303 ltype = "difflineminus"
303 304 elif l.startswith('@'):
304 305 ltype = "difflineat"
305 306 else:
306 307 ltype = "diffline"
307 308 yield tmpl(ltype,
308 309 line=l,
309 310 lineid="l%s" % lineno,
310 311 linenumber="% 8s" % lineno)
311 312
312 313 if files:
313 314 m = match.exact(repo.root, repo.getcwd(), files)
314 315 else:
315 316 m = match.always(repo.root, repo.getcwd())
316 317
317 318 diffopts = patch.diffopts(repo.ui, untrusted=True)
318 319 if basectx is None:
319 320 parents = ctx.parents()
320 321 node1 = parents and parents[0].node() or nullid
321 322 else:
322 323 node1 = basectx.node()
323 324 node2 = ctx.node()
324 325
325 326 block = []
326 327 for chunk in patch.diff(repo, node1, node2, m, opts=diffopts):
327 328 if chunk.startswith('diff') and block:
328 329 blockno = blockcount.next()
329 330 yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
330 331 lines=prettyprintlines(''.join(block), blockno))
331 332 block = []
332 333 if chunk.startswith('diff') and style != 'raw':
333 334 chunk = ''.join(chunk.splitlines(True)[1:])
334 335 block.append(chunk)
335 336 blockno = blockcount.next()
336 337 yield tmpl('diffblock', parity=parity.next(), blockno=blockno,
337 338 lines=prettyprintlines(''.join(block), blockno))
338 339
339 340 def compare(tmpl, context, leftlines, rightlines):
340 341 '''Generator function that provides side-by-side comparison data.'''
341 342
342 343 def compline(type, leftlineno, leftline, rightlineno, rightline):
343 344 lineid = leftlineno and ("l%s" % leftlineno) or ''
344 345 lineid += rightlineno and ("r%s" % rightlineno) or ''
345 346 return tmpl('comparisonline',
346 347 type=type,
347 348 lineid=lineid,
348 349 leftlinenumber="% 6s" % (leftlineno or ''),
349 350 leftline=leftline or '',
350 351 rightlinenumber="% 6s" % (rightlineno or ''),
351 352 rightline=rightline or '')
352 353
353 354 def getblock(opcodes):
354 355 for type, llo, lhi, rlo, rhi in opcodes:
355 356 len1 = lhi - llo
356 357 len2 = rhi - rlo
357 358 count = min(len1, len2)
358 359 for i in xrange(count):
359 360 yield compline(type=type,
360 361 leftlineno=llo + i + 1,
361 362 leftline=leftlines[llo + i],
362 363 rightlineno=rlo + i + 1,
363 364 rightline=rightlines[rlo + i])
364 365 if len1 > len2:
365 366 for i in xrange(llo + count, lhi):
366 367 yield compline(type=type,
367 368 leftlineno=i + 1,
368 369 leftline=leftlines[i],
369 370 rightlineno=None,
370 371 rightline=None)
371 372 elif len2 > len1:
372 373 for i in xrange(rlo + count, rhi):
373 374 yield compline(type=type,
374 375 leftlineno=None,
375 376 leftline=None,
376 377 rightlineno=i + 1,
377 378 rightline=rightlines[i])
378 379
379 380 s = difflib.SequenceMatcher(None, leftlines, rightlines)
380 381 if context < 0:
381 382 yield tmpl('comparisonblock', lines=getblock(s.get_opcodes()))
382 383 else:
383 384 for oc in s.get_grouped_opcodes(n=context):
384 385 yield tmpl('comparisonblock', lines=getblock(oc))
385 386
386 387 def diffstatgen(ctx, basectx):
387 388 '''Generator function that provides the diffstat data.'''
388 389
389 390 stats = patch.diffstatdata(util.iterlines(ctx.diff(basectx)))
390 391 maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats)
391 392 while True:
392 393 yield stats, maxname, maxtotal, addtotal, removetotal, binary
393 394
394 395 def diffsummary(statgen):
395 396 '''Return a short summary of the diff.'''
396 397
397 398 stats, maxname, maxtotal, addtotal, removetotal, binary = statgen.next()
398 399 return _(' %d files changed, %d insertions(+), %d deletions(-)\n') % (
399 400 len(stats), addtotal, removetotal)
400 401
401 402 def diffstat(tmpl, ctx, statgen, parity):
402 403 '''Return a diffstat template for each file in the diff.'''
403 404
404 405 stats, maxname, maxtotal, addtotal, removetotal, binary = statgen.next()
405 406 files = ctx.files()
406 407
407 408 def pct(i):
408 409 if maxtotal == 0:
409 410 return 0
410 411 return (float(i) / maxtotal) * 100
411 412
412 413 fileno = 0
413 414 for filename, adds, removes, isbinary in stats:
414 415 template = filename in files and 'diffstatlink' or 'diffstatnolink'
415 416 total = adds + removes
416 417 fileno += 1
417 418 yield tmpl(template, node=ctx.hex(), file=filename, fileno=fileno,
418 419 total=total, addpct=pct(adds), removepct=pct(removes),
419 420 parity=parity.next())
420 421
421 422 class sessionvars(object):
422 423 def __init__(self, vars, start='?'):
423 424 self.start = start
424 425 self.vars = vars
425 426 def __getitem__(self, key):
426 427 return self.vars[key]
427 428 def __setitem__(self, key, value):
428 429 self.vars[key] = value
429 430 def __copy__(self):
430 431 return sessionvars(copy.copy(self.vars), self.start)
431 432 def __iter__(self):
432 433 separator = self.start
433 434 for key, value in sorted(self.vars.iteritems()):
434 435 yield {'name': key, 'value': str(value), 'separator': separator}
435 436 separator = '&'
436 437
437 438 class wsgiui(ui.ui):
438 439 # default termwidth breaks under mod_wsgi
439 440 def termwidth(self):
440 441 return 80
@@ -1,797 +1,836 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}) [{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 id --debug --hidden -ir "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 Refuse pathological nullid successors
129 129 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
130 130 transaction abort!
131 131 rollback completed
132 132 abort: bad obsolescence marker detected: invalid successors nullid
133 133 [255]
134 134
135 135 Check that graphlog detect that a changeset is obsolete:
136 136
137 137 $ hg log -G
138 138 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
139 139 |
140 140 o 1:7c3bad9141dc (draft) [ ] add b
141 141 |
142 142 o 0:1f0dee641bb7 (draft) [ ] add a
143 143
144 144
145 145 check that heads does not report them
146 146
147 147 $ hg heads
148 148 5:5601fb93a350 (draft) [tip ] add new_3_c
149 149 $ hg heads --hidden
150 150 5:5601fb93a350 (draft) [tip ] add new_3_c
151 151 4:ca819180edb9 (draft) [ ] add new_2_c
152 152 3:cdbce2fbb163 (draft) [ ] add new_c
153 153 2:245bde4270cd (draft) [ ] add original_c
154 154
155 155
156 156 check that summary does not report them
157 157
158 158 $ hg init ../sink
159 159 $ echo '[paths]' >> .hg/hgrc
160 160 $ echo 'default=../sink' >> .hg/hgrc
161 161 $ hg summary --remote
162 162 parent: 5:5601fb93a350 tip
163 163 add new_3_c
164 164 branch: default
165 165 commit: (clean)
166 166 update: (current)
167 167 remote: 3 outgoing
168 168
169 169 $ hg summary --remote --hidden
170 170 parent: 5:5601fb93a350 tip
171 171 add new_3_c
172 172 branch: default
173 173 commit: (clean)
174 174 update: 3 new changesets, 4 branch heads (merge)
175 175 remote: 3 outgoing
176 176
177 177 check that various commands work well with filtering
178 178
179 179 $ hg tip
180 180 5:5601fb93a350 (draft) [tip ] add new_3_c
181 181 $ hg log -r 6
182 182 abort: unknown revision '6'!
183 183 [255]
184 184 $ hg log -r 4
185 185 abort: hidden revision '4'!
186 186 (use --hidden to access hidden revisions)
187 187 [255]
188 188 $ hg debugrevspec 'rev(6)'
189 189 $ hg debugrevspec 'rev(4)'
190 190
191 191 Check that public changeset are not accounted as obsolete:
192 192
193 193 $ hg --hidden phase --public 2
194 194 $ hg log -G
195 195 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
196 196 |
197 197 | o 2:245bde4270cd (public) [ ] add original_c
198 198 |/
199 199 o 1:7c3bad9141dc (public) [ ] add b
200 200 |
201 201 o 0:1f0dee641bb7 (public) [ ] add a
202 202
203 203
204 204 And that bumped changeset are detected
205 205 --------------------------------------
206 206
207 207 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
208 208 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
209 209 the public changeset
210 210
211 211 $ hg log --hidden -r 'bumped()'
212 212 5:5601fb93a350 (draft) [tip ] add new_3_c
213 213
214 214 And that we can't push bumped changeset
215 215
216 216 $ hg push ../tmpa -r 0 --force #(make repo related)
217 217 pushing to ../tmpa
218 218 searching for changes
219 219 warning: repository is unrelated
220 220 adding changesets
221 221 adding manifests
222 222 adding file changes
223 223 added 1 changesets with 1 changes to 1 files (+1 heads)
224 224 $ hg push ../tmpa
225 225 pushing to ../tmpa
226 226 searching for changes
227 227 abort: push includes bumped changeset: 5601fb93a350!
228 228 [255]
229 229
230 230 Fixing "bumped" situation
231 231 We need to create a clone of 5 and add a special marker with a flag
232 232
233 233 $ hg up '5^'
234 234 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
235 235 $ hg revert -ar 5
236 236 adding new_3_c
237 237 $ hg ci -m 'add n3w_3_c'
238 238 created new head
239 239 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
240 240 $ hg log -r 'bumped()'
241 241 $ hg log -G
242 242 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
243 243 |
244 244 | o 2:245bde4270cd (public) [ ] add original_c
245 245 |/
246 246 o 1:7c3bad9141dc (public) [ ] add b
247 247 |
248 248 o 0:1f0dee641bb7 (public) [ ] add a
249 249
250 250
251 251
252 252
253 253 $ cd ..
254 254
255 255 Exchange Test
256 256 ============================
257 257
258 258 Destination repo does not have any data
259 259 ---------------------------------------
260 260
261 261 Simple incoming test
262 262
263 263 $ hg init tmpc
264 264 $ cd tmpc
265 265 $ hg incoming ../tmpb
266 266 comparing with ../tmpb
267 267 0:1f0dee641bb7 (public) [ ] add a
268 268 1:7c3bad9141dc (public) [ ] add b
269 269 2:245bde4270cd (public) [ ] add original_c
270 270 6:6f9641995072 (draft) [tip ] add n3w_3_c
271 271
272 272 Try to pull markers
273 273 (extinct changeset are excluded but marker are pushed)
274 274
275 275 $ hg pull ../tmpb
276 276 pulling from ../tmpb
277 277 requesting all changes
278 278 adding changesets
279 279 adding manifests
280 280 adding file changes
281 281 added 4 changesets with 4 changes to 4 files (+1 heads)
282 282 (run 'hg heads' to see heads, 'hg merge' to merge)
283 283 $ hg debugobsolete
284 284 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
285 285 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
286 286 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
287 287 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
288 288 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
289 289
290 290 Rollback//Transaction support
291 291
292 292 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
293 293 $ hg debugobsolete
294 294 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
295 295 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
296 296 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
297 297 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
298 298 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
299 299 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
300 300 $ hg rollback -n
301 301 repository tip rolled back to revision 3 (undo debugobsolete)
302 302 $ hg rollback
303 303 repository tip rolled back to revision 3 (undo debugobsolete)
304 304 $ hg debugobsolete
305 305 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
306 306 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
307 307 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
308 308 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
309 309 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
310 310
311 311 $ cd ..
312 312
313 313 Try to push markers
314 314
315 315 $ hg init tmpd
316 316 $ hg -R tmpb push tmpd
317 317 pushing to tmpd
318 318 searching for changes
319 319 adding changesets
320 320 adding manifests
321 321 adding file changes
322 322 added 4 changesets with 4 changes to 4 files (+1 heads)
323 323 $ hg -R tmpd debugobsolete | sort
324 324 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
325 325 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
326 326 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
327 327 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
328 328 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
329 329
330 330 Check obsolete keys are exchanged only if source has an obsolete store
331 331
332 332 $ hg init empty
333 333 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
334 334 pushing to tmpd
335 335 listkeys phases
336 336 listkeys bookmarks
337 337 no changes found
338 338 listkeys phases
339 339 [1]
340 340
341 341 clone support
342 342 (markers are copied and extinct changesets are included to allow hardlinks)
343 343
344 344 $ hg clone tmpb clone-dest
345 345 updating to branch default
346 346 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 347 $ hg -R clone-dest log -G --hidden
348 348 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
349 349 |
350 350 | x 5:5601fb93a350 (draft) [ ] add new_3_c
351 351 |/
352 352 | x 4:ca819180edb9 (draft) [ ] add new_2_c
353 353 |/
354 354 | x 3:cdbce2fbb163 (draft) [ ] add new_c
355 355 |/
356 356 | o 2:245bde4270cd (public) [ ] add original_c
357 357 |/
358 358 o 1:7c3bad9141dc (public) [ ] add b
359 359 |
360 360 o 0:1f0dee641bb7 (public) [ ] add a
361 361
362 362 $ hg -R clone-dest debugobsolete
363 363 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
364 364 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
365 365 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
366 366 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
367 367 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
368 368
369 369
370 370 Destination repo have existing data
371 371 ---------------------------------------
372 372
373 373 On pull
374 374
375 375 $ hg init tmpe
376 376 $ cd tmpe
377 377 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
378 378 $ hg pull ../tmpb
379 379 pulling from ../tmpb
380 380 requesting all changes
381 381 adding changesets
382 382 adding manifests
383 383 adding file changes
384 384 added 4 changesets with 4 changes to 4 files (+1 heads)
385 385 (run 'hg heads' to see heads, 'hg merge' to merge)
386 386 $ hg debugobsolete
387 387 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
388 388 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
389 389 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
390 390 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
391 391 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
392 392 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
393 393
394 394
395 395 On push
396 396
397 397 $ hg push ../tmpc
398 398 pushing to ../tmpc
399 399 searching for changes
400 400 no changes found
401 401 [1]
402 402 $ hg -R ../tmpc debugobsolete
403 403 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
404 404 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
405 405 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
406 406 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
407 407 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
408 408 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
409 409
410 410 detect outgoing obsolete and unstable
411 411 ---------------------------------------
412 412
413 413
414 414 $ hg log -G
415 415 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
416 416 |
417 417 | o 2:245bde4270cd (public) [ ] add original_c
418 418 |/
419 419 o 1:7c3bad9141dc (public) [ ] add b
420 420 |
421 421 o 0:1f0dee641bb7 (public) [ ] add a
422 422
423 423 $ hg up 'desc("n3w_3_c")'
424 424 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 425 $ mkcommit original_d
426 426 $ mkcommit original_e
427 427 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
428 428 $ hg debugobsolete | grep `getid original_d`
429 429 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
430 430 $ hg log -r 'obsolete()'
431 431 4:94b33453f93b (draft) [ ] add original_d
432 432 $ hg log -G -r '::unstable()'
433 433 @ 5:cda648ca50f5 (draft) [tip ] add original_e
434 434 |
435 435 x 4:94b33453f93b (draft) [ ] add original_d
436 436 |
437 437 o 3:6f9641995072 (draft) [ ] add n3w_3_c
438 438 |
439 439 o 1:7c3bad9141dc (public) [ ] add b
440 440 |
441 441 o 0:1f0dee641bb7 (public) [ ] add a
442 442
443 443
444 444 refuse to push obsolete changeset
445 445
446 446 $ hg push ../tmpc/ -r 'desc("original_d")'
447 447 pushing to ../tmpc/
448 448 searching for changes
449 449 abort: push includes obsolete changeset: 94b33453f93b!
450 450 [255]
451 451
452 452 refuse to push unstable changeset
453 453
454 454 $ hg push ../tmpc/
455 455 pushing to ../tmpc/
456 456 searching for changes
457 457 abort: push includes unstable changeset: cda648ca50f5!
458 458 [255]
459 459
460 460 Test that extinct changeset are properly detected
461 461
462 462 $ hg log -r 'extinct()'
463 463
464 464 Don't try to push extinct changeset
465 465
466 466 $ hg init ../tmpf
467 467 $ hg out ../tmpf
468 468 comparing with ../tmpf
469 469 searching for changes
470 470 0:1f0dee641bb7 (public) [ ] add a
471 471 1:7c3bad9141dc (public) [ ] add b
472 472 2:245bde4270cd (public) [ ] add original_c
473 473 3:6f9641995072 (draft) [ ] add n3w_3_c
474 474 4:94b33453f93b (draft) [ ] add original_d
475 475 5:cda648ca50f5 (draft) [tip ] add original_e
476 476 $ hg push ../tmpf -f # -f because be push unstable too
477 477 pushing to ../tmpf
478 478 searching for changes
479 479 adding changesets
480 480 adding manifests
481 481 adding file changes
482 482 added 6 changesets with 6 changes to 6 files (+1 heads)
483 483
484 484 no warning displayed
485 485
486 486 $ hg push ../tmpf
487 487 pushing to ../tmpf
488 488 searching for changes
489 489 no changes found
490 490 [1]
491 491
492 492 Do not warn about new head when the new head is a successors of a remote one
493 493
494 494 $ hg log -G
495 495 @ 5:cda648ca50f5 (draft) [tip ] add original_e
496 496 |
497 497 x 4:94b33453f93b (draft) [ ] add original_d
498 498 |
499 499 o 3:6f9641995072 (draft) [ ] add n3w_3_c
500 500 |
501 501 | o 2:245bde4270cd (public) [ ] add original_c
502 502 |/
503 503 o 1:7c3bad9141dc (public) [ ] add b
504 504 |
505 505 o 0:1f0dee641bb7 (public) [ ] add a
506 506
507 507 $ hg up -q 'desc(n3w_3_c)'
508 508 $ mkcommit obsolete_e
509 509 created new head
510 510 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
511 511 $ hg outgoing ../tmpf # parasite hg outgoing testin
512 512 comparing with ../tmpf
513 513 searching for changes
514 514 6:3de5eca88c00 (draft) [tip ] add obsolete_e
515 515 $ hg push ../tmpf
516 516 pushing to ../tmpf
517 517 searching for changes
518 518 adding changesets
519 519 adding manifests
520 520 adding file changes
521 521 added 1 changesets with 1 changes to 1 files (+1 heads)
522 522
523 523 test relevance computation
524 524 ---------------------------------------
525 525
526 526 Checking simple case of "marker relevance".
527 527
528 528
529 529 Reminder of the repo situation
530 530
531 531 $ hg log --hidden --graph
532 532 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
533 533 |
534 534 | x 5:cda648ca50f5 (draft) [ ] add original_e
535 535 | |
536 536 | x 4:94b33453f93b (draft) [ ] add original_d
537 537 |/
538 538 o 3:6f9641995072 (draft) [ ] add n3w_3_c
539 539 |
540 540 | o 2:245bde4270cd (public) [ ] add original_c
541 541 |/
542 542 o 1:7c3bad9141dc (public) [ ] add b
543 543 |
544 544 o 0:1f0dee641bb7 (public) [ ] add a
545 545
546 546
547 547 List of all markers
548 548
549 549 $ hg debugobsolete
550 550 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
551 551 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
552 552 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
553 553 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
554 554 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
555 555 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
556 556 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
557 557 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
558 558
559 559 List of changesets with no chain
560 560
561 561 $ hg debugobsolete --hidden --rev ::2
562 562
563 563 List of changesets that are included on marker chain
564 564
565 565 $ hg debugobsolete --hidden --rev 6
566 566 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
567 567
568 568 List of changesets with a longer chain, (including a pruned children)
569 569
570 570 $ hg debugobsolete --hidden --rev 3
571 571 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
572 572 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
573 573 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
574 574 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
575 575 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
576 576 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
577 577 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
578 578
579 579 List of both
580 580
581 581 $ hg debugobsolete --hidden --rev 3::6
582 582 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
583 583 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
584 584 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
585 585 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
586 586 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
587 587 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
588 588 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
589 589 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
590 590
591 591 #if serve
592 592
593 593 check hgweb does not explode
594 594 ====================================
595 595
596 596 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
597 597 adding changesets
598 598 adding manifests
599 599 adding file changes
600 600 added 62 changesets with 63 changes to 9 files (+60 heads)
601 601 (run 'hg heads .' to see heads, 'hg merge' to merge)
602 602 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
603 603 > do
604 604 > hg debugobsolete $node
605 605 > done
606 606 $ hg up tip
607 607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 608
609 609 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
610 610 $ cat hg.pid >> $DAEMON_PIDS
611 611
612 612 check changelog view
613 613
614 614 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
615 615 200 Script output follows
616 616
617 617 check graph view
618 618
619 619 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
620 620 200 Script output follows
621 621
622 622 check filelog view
623 623
624 624 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
625 625 200 Script output follows
626 626
627 627 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'
628 628 200 Script output follows
629 629 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
630 630 404 Not Found
631 631 [1]
632 632
633 633 check that web.view config option:
634 634
635 635 $ "$TESTDIR/killdaemons.py" hg.pid
636 636 $ cat >> .hg/hgrc << EOF
637 637 > [web]
638 638 > view=all
639 639 > EOF
640 640 $ wait
641 641 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
642 642 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
643 643 200 Script output follows
644 644 $ "$TESTDIR/killdaemons.py" hg.pid
645 645
646 646 Checking _enable=False warning if obsolete marker exists
647 647
648 648 $ echo '[experimental]' >> $HGRCPATH
649 649 $ echo "evolution=" >> $HGRCPATH
650 650 $ hg log -r tip
651 651 obsolete feature not enabled but 68 markers found!
652 652 68:c15e9edfca13 (draft) [tip ] add celestine
653 653
654 654 reenable for later test
655 655
656 656 $ echo '[experimental]' >> $HGRCPATH
657 657 $ echo "evolution=createmarkers,exchange" >> $HGRCPATH
658 658
659 659 #endif
660 660
661 661 Test incoming/outcoming with changesets obsoleted remotely, known locally
662 662 ===============================================================================
663 663
664 664 This test issue 3805
665 665
666 666 $ hg init repo-issue3805
667 667 $ cd repo-issue3805
668 668 $ echo "foo" > foo
669 669 $ hg ci -Am "A"
670 670 adding foo
671 671 $ hg clone . ../other-issue3805
672 672 updating to branch default
673 673 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
674 674 $ echo "bar" >> foo
675 675 $ hg ci --amend
676 676 $ cd ../other-issue3805
677 677 $ hg log -G
678 678 @ 0:193e9254ce7e (draft) [tip ] A
679 679
680 680 $ hg log -G -R ../repo-issue3805
681 681 @ 2:3816541e5485 (draft) [tip ] A
682 682
683 683 $ hg incoming
684 684 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
685 685 searching for changes
686 686 2:3816541e5485 (draft) [tip ] A
687 687 $ hg incoming --bundle ../issue3805.hg
688 688 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
689 689 searching for changes
690 690 2:3816541e5485 (draft) [tip ] A
691 691 $ hg outgoing
692 692 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
693 693 searching for changes
694 694 no changes found
695 695 [1]
696 696
697 697 #if serve
698 698
699 699 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
700 700 $ cat hg.pid >> $DAEMON_PIDS
701 701
702 702 $ hg incoming http://localhost:$HGPORT
703 703 comparing with http://localhost:$HGPORT/
704 704 searching for changes
705 705 1:3816541e5485 (draft) [tip ] A
706 706 $ hg outgoing http://localhost:$HGPORT
707 707 comparing with http://localhost:$HGPORT/
708 708 searching for changes
709 709 no changes found
710 710 [1]
711 711
712 712 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
713 713
714 714 #endif
715 715
716 716 This test issue 3814
717 717
718 718 (nothing to push but locally hidden changeset)
719 719
720 720 $ cd ..
721 721 $ hg init repo-issue3814
722 722 $ cd repo-issue3805
723 723 $ hg push -r 3816541e5485 ../repo-issue3814
724 724 pushing to ../repo-issue3814
725 725 searching for changes
726 726 adding changesets
727 727 adding manifests
728 728 adding file changes
729 729 added 1 changesets with 1 changes to 1 files
730 730 $ hg out ../repo-issue3814
731 731 comparing with ../repo-issue3814
732 732 searching for changes
733 733 no changes found
734 734 [1]
735 735
736 736 Test that a local tag blocks a changeset from being hidden
737 737
738 738 $ hg tag -l visible -r 0 --hidden
739 739 $ hg log -G
740 740 @ 2:3816541e5485 (draft) [tip ] A
741 741
742 742 x 0:193e9254ce7e (draft) [visible ] A
743 743
744 744 Test that removing a local tag does not cause some commands to fail
745 745
746 746 $ hg tag -l -r tip tiptag
747 747 $ hg tags
748 748 tiptag 2:3816541e5485
749 749 tip 2:3816541e5485
750 750 visible 0:193e9254ce7e
751 751 $ hg --config extensions.strip= strip -r tip --no-backup
752 752 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
753 753 $ hg tags
754 754 visible 0:193e9254ce7e
755 755 tip 0:193e9254ce7e
756 756
757 #if serve
758
759 Test issue 4506
760
761 $ cd ..
762 $ hg init repo-issue4506
763 $ cd repo-issue4506
764 $ echo "0" > foo
765 $ hg add foo
766 $ hg ci -m "content-0"
767
768 $ hg up null
769 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
770 $ echo "1" > bar
771 $ hg add bar
772 $ hg ci -m "content-1"
773 created new head
774 $ hg up 0
775 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
776 $ hg graft 1
777 grafting 1:1c9eddb02162 "content-1" (tip)
778
779 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
780
781 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
782 $ cat hg.pid >> $DAEMON_PIDS
783
784 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/1'
785 404 Not Found
786 [1]
787 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'file/tip/bar'
788 200 Script output follows
789 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'annotate/tip/bar'
790 200 Script output follows
791
792 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
793
794 #endif
795
757 796 $ hg init a
758 797 $ cd a
759 798 $ touch foo
760 799 $ hg add foo
761 800 $ hg ci -mfoo
762 801 $ touch bar
763 802 $ hg add bar
764 803 $ hg ci -mbar
765 804 $ hg up 0
766 805 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
767 806 $ touch quux
768 807 $ hg add quux
769 808 $ hg ci -m quux
770 809 created new head
771 810 $ hg up 1
772 811 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
773 812 $ hg tag 1.0
774 813
775 814 $ hg up 2
776 815 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
777 816 $ hg log -G
778 817 o 3:bc47fc7e1c1d (draft) [tip ] Added tag 1.0 for changeset 50c889141114
779 818 |
780 819 | @ 2:3d7f255a0081 (draft) [ ] quux
781 820 | |
782 821 o | 1:50c889141114 (draft) [1.0 ] bar
783 822 |/
784 823 o 0:1f7b0de80e11 (draft) [ ] foo
785 824
786 825 $ hg debugobsolete `getid bar`
787 826 $ hg debugobsolete `getid 1.0`
788 827 $ hg tag 1.0
789 828 $ hg log -G
790 829 @ 4:f9f2ab71ffd5 (draft) [tip ] Added tag 1.0 for changeset 3d7f255a0081
791 830 |
792 831 o 2:3d7f255a0081 (draft) [1.0 ] quux
793 832 |
794 833 o 0:1f7b0de80e11 (draft) [ ] foo
795 834
796 835 $ cat .hgtags
797 836 3d7f255a008103380aeb2a7d581fe257f40969e7 1.0
General Comments 0
You need to be logged in to leave comments. Login now