##// END OF EJS Templates
graphlog: paths/-I/-X handling requires a new revset...
Patrick Mezard -
r16161:5a627b49 default
parent child Browse files
Show More
@@ -1,412 +1,422 b''
1 1 # ASCII graph log extension for Mercurial
2 2 #
3 3 # Copyright 2007 Joel Rosdahl <joel@rosdahl.net>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 '''command to view revision graphs from a shell
9 9
10 10 This extension adds a --graph option to the incoming, outgoing and log
11 11 commands. When this options is given, an ASCII representation of the
12 12 revision graph is also shown.
13 13 '''
14 14
15 15 from mercurial.cmdutil import show_changeset
16 16 from mercurial.commands import templateopts
17 17 from mercurial.i18n import _
18 18 from mercurial.node import nullrev
19 19 from mercurial import cmdutil, commands, extensions, scmutil
20 20 from mercurial import hg, util, graphmod
21 21
22 22 cmdtable = {}
23 23 command = cmdutil.command(cmdtable)
24 24
25 25 ASCIIDATA = 'ASC'
26 26
27 27 def asciiedges(type, char, lines, seen, rev, parents):
28 28 """adds edge info to changelog DAG walk suitable for ascii()"""
29 29 if rev not in seen:
30 30 seen.append(rev)
31 31 nodeidx = seen.index(rev)
32 32
33 33 knownparents = []
34 34 newparents = []
35 35 for parent in parents:
36 36 if parent in seen:
37 37 knownparents.append(parent)
38 38 else:
39 39 newparents.append(parent)
40 40
41 41 ncols = len(seen)
42 42 nextseen = seen[:]
43 43 nextseen[nodeidx:nodeidx + 1] = newparents
44 44 edges = [(nodeidx, nextseen.index(p)) for p in knownparents]
45 45
46 46 while len(newparents) > 2:
47 47 # ascii() only knows how to add or remove a single column between two
48 48 # calls. Nodes with more than two parents break this constraint so we
49 49 # introduce intermediate expansion lines to grow the active node list
50 50 # slowly.
51 51 edges.append((nodeidx, nodeidx))
52 52 edges.append((nodeidx, nodeidx + 1))
53 53 nmorecols = 1
54 54 yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))
55 55 char = '\\'
56 56 lines = []
57 57 nodeidx += 1
58 58 ncols += 1
59 59 edges = []
60 60 del newparents[0]
61 61
62 62 if len(newparents) > 0:
63 63 edges.append((nodeidx, nodeidx))
64 64 if len(newparents) > 1:
65 65 edges.append((nodeidx, nodeidx + 1))
66 66 nmorecols = len(nextseen) - ncols
67 67 seen[:] = nextseen
68 68 yield (type, char, lines, (nodeidx, edges, ncols, nmorecols))
69 69
70 70 def fix_long_right_edges(edges):
71 71 for (i, (start, end)) in enumerate(edges):
72 72 if end > start:
73 73 edges[i] = (start, end + 1)
74 74
75 75 def get_nodeline_edges_tail(
76 76 node_index, p_node_index, n_columns, n_columns_diff, p_diff, fix_tail):
77 77 if fix_tail and n_columns_diff == p_diff and n_columns_diff != 0:
78 78 # Still going in the same non-vertical direction.
79 79 if n_columns_diff == -1:
80 80 start = max(node_index + 1, p_node_index)
81 81 tail = ["|", " "] * (start - node_index - 1)
82 82 tail.extend(["/", " "] * (n_columns - start))
83 83 return tail
84 84 else:
85 85 return ["\\", " "] * (n_columns - node_index - 1)
86 86 else:
87 87 return ["|", " "] * (n_columns - node_index - 1)
88 88
89 89 def draw_edges(edges, nodeline, interline):
90 90 for (start, end) in edges:
91 91 if start == end + 1:
92 92 interline[2 * end + 1] = "/"
93 93 elif start == end - 1:
94 94 interline[2 * start + 1] = "\\"
95 95 elif start == end:
96 96 interline[2 * start] = "|"
97 97 else:
98 98 if 2 * end >= len(nodeline):
99 99 continue
100 100 nodeline[2 * end] = "+"
101 101 if start > end:
102 102 (start, end) = (end, start)
103 103 for i in range(2 * start + 1, 2 * end):
104 104 if nodeline[i] != "+":
105 105 nodeline[i] = "-"
106 106
107 107 def get_padding_line(ni, n_columns, edges):
108 108 line = []
109 109 line.extend(["|", " "] * ni)
110 110 if (ni, ni - 1) in edges or (ni, ni) in edges:
111 111 # (ni, ni - 1) (ni, ni)
112 112 # | | | | | | | |
113 113 # +---o | | o---+
114 114 # | | c | | c | |
115 115 # | |/ / | |/ /
116 116 # | | | | | |
117 117 c = "|"
118 118 else:
119 119 c = " "
120 120 line.extend([c, " "])
121 121 line.extend(["|", " "] * (n_columns - ni - 1))
122 122 return line
123 123
124 124 def asciistate():
125 125 """returns the initial value for the "state" argument to ascii()"""
126 126 return [0, 0]
127 127
128 128 def ascii(ui, state, type, char, text, coldata):
129 129 """prints an ASCII graph of the DAG
130 130
131 131 takes the following arguments (one call per node in the graph):
132 132
133 133 - ui to write to
134 134 - Somewhere to keep the needed state in (init to asciistate())
135 135 - Column of the current node in the set of ongoing edges.
136 136 - Type indicator of node data == ASCIIDATA.
137 137 - Payload: (char, lines):
138 138 - Character to use as node's symbol.
139 139 - List of lines to display as the node's text.
140 140 - Edges; a list of (col, next_col) indicating the edges between
141 141 the current node and its parents.
142 142 - Number of columns (ongoing edges) in the current revision.
143 143 - The difference between the number of columns (ongoing edges)
144 144 in the next revision and the number of columns (ongoing edges)
145 145 in the current revision. That is: -1 means one column removed;
146 146 0 means no columns added or removed; 1 means one column added.
147 147 """
148 148
149 149 idx, edges, ncols, coldiff = coldata
150 150 assert -2 < coldiff < 2
151 151 if coldiff == -1:
152 152 # Transform
153 153 #
154 154 # | | | | | |
155 155 # o | | into o---+
156 156 # |X / |/ /
157 157 # | | | |
158 158 fix_long_right_edges(edges)
159 159
160 160 # add_padding_line says whether to rewrite
161 161 #
162 162 # | | | | | | | |
163 163 # | o---+ into | o---+
164 164 # | / / | | | # <--- padding line
165 165 # o | | | / /
166 166 # o | |
167 167 add_padding_line = (len(text) > 2 and coldiff == -1 and
168 168 [x for (x, y) in edges if x + 1 < y])
169 169
170 170 # fix_nodeline_tail says whether to rewrite
171 171 #
172 172 # | | o | | | | o | |
173 173 # | | |/ / | | |/ /
174 174 # | o | | into | o / / # <--- fixed nodeline tail
175 175 # | |/ / | |/ /
176 176 # o | | o | |
177 177 fix_nodeline_tail = len(text) <= 2 and not add_padding_line
178 178
179 179 # nodeline is the line containing the node character (typically o)
180 180 nodeline = ["|", " "] * idx
181 181 nodeline.extend([char, " "])
182 182
183 183 nodeline.extend(
184 184 get_nodeline_edges_tail(idx, state[1], ncols, coldiff,
185 185 state[0], fix_nodeline_tail))
186 186
187 187 # shift_interline is the line containing the non-vertical
188 188 # edges between this entry and the next
189 189 shift_interline = ["|", " "] * idx
190 190 if coldiff == -1:
191 191 n_spaces = 1
192 192 edge_ch = "/"
193 193 elif coldiff == 0:
194 194 n_spaces = 2
195 195 edge_ch = "|"
196 196 else:
197 197 n_spaces = 3
198 198 edge_ch = "\\"
199 199 shift_interline.extend(n_spaces * [" "])
200 200 shift_interline.extend([edge_ch, " "] * (ncols - idx - 1))
201 201
202 202 # draw edges from the current node to its parents
203 203 draw_edges(edges, nodeline, shift_interline)
204 204
205 205 # lines is the list of all graph lines to print
206 206 lines = [nodeline]
207 207 if add_padding_line:
208 208 lines.append(get_padding_line(idx, ncols, edges))
209 209 lines.append(shift_interline)
210 210
211 211 # make sure that there are as many graph lines as there are
212 212 # log strings
213 213 while len(text) < len(lines):
214 214 text.append("")
215 215 if len(lines) < len(text):
216 216 extra_interline = ["|", " "] * (ncols + coldiff)
217 217 while len(lines) < len(text):
218 218 lines.append(extra_interline)
219 219
220 220 # print lines
221 221 indentation_level = max(ncols, ncols + coldiff)
222 222 for (line, logstr) in zip(lines, text):
223 223 ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr)
224 224 ui.write(ln.rstrip() + '\n')
225 225
226 226 # ... and start over
227 227 state[0] = coldiff
228 228 state[1] = idx
229 229
230 230 def get_revs(repo, rev_opt):
231 231 if rev_opt:
232 232 revs = scmutil.revrange(repo, rev_opt)
233 233 if len(revs) == 0:
234 234 return (nullrev, nullrev)
235 235 return (max(revs), min(revs))
236 236 else:
237 237 return (len(repo) - 1, 0)
238 238
239 239 def check_unsupported_flags(pats, opts):
240 240 for op in ["follow_first", "copies", "newest_first"]:
241 241 if op in opts and opts[op]:
242 242 raise util.Abort(_("-G/--graph option is incompatible with --%s")
243 243 % op.replace("_", "-"))
244 244 if pats and opts.get('follow'):
245 245 raise util.Abort(_("-G/--graph option is incompatible with --follow "
246 246 "with file argument"))
247 247
248 248 def revset(repo, pats, opts):
249 249 """Return revset str built of revisions, log options and file patterns.
250 250 """
251 251 opt2revset = {
252 252 'follow': ('follow()', None),
253 253 'no_merges': ('not merge()', None),
254 254 'only_merges': ('merge()', None),
255 255 'removed': ('removes("*")', None),
256 256 'date': ('date(%(val)r)', None),
257 257 'branch': ('branch(%(val)r)', ' or '),
258 'exclude': ('not file(%(val)r)', ' and '),
259 'include': ('file(%(val)r)', ' and '),
260 '_pats': ('file(%(val)r)', ' or '),
261 258 '_patslog': ('filelog(%(val)r)', ' or '),
262 259 'keyword': ('keyword(%(val)r)', ' or '),
263 260 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
264 261 'user': ('user(%(val)r)', ' or '),
265 262 'rev': ('%(val)s', ' or '),
266 263 }
267 264
268 265 opts = dict(opts)
269 266 # branch and only_branch are really aliases and must be handled at
270 267 # the same time
271 268 if 'branch' in opts and 'only_branch' in opts:
272 269 opts['branch'] = opts['branch'] + opts.pop('only_branch')
273 270
274 271 match = scmutil.match(repo[None], pats, opts)
275 272 slowpath = match.anypats() or (match.files() and opts.get('removed'))
276 273 if not slowpath:
277 274 for f in match.files():
278 275 filelog = repo.file(f)
279 276 if not len(filelog):
280 277 # A zero count may be a directory or deleted file, so
281 278 # try to find matching entries on the slow path.
282 279 slowpath = True
283 280 if slowpath:
284 # See cmdutil.walkchangerevs() slow path
285 opts['_pats'] = list(pats)
281 # See cmdutil.walkchangerevs() slow path.
282 #
283 # pats/include/exclude cannot be represented as separate
284 # revset expressions as their filtering logic applies at file
285 # level. For instance "-I a -X a" matches a revision touching
286 # "a" and "b" while "file(a) and not file(b)" does not.
287 matchargs = []
288 for p in pats:
289 matchargs.append('p:' + p)
290 for p in opts.get('include', []):
291 matchargs.append('i:' + p)
292 for p in opts.get('exclude', []):
293 matchargs.append('x:' + p)
294 matchargs = ','.join(('%r' % p) for p in matchargs)
295 opts['rev'] = opts.get('rev', []) + ['_matchfiles(%s)' % matchargs]
286 296 else:
287 297 opts['_patslog'] = list(pats)
288 298
289 299 revset = []
290 300 for op, val in opts.iteritems():
291 301 if not val:
292 302 continue
293 303 if op not in opt2revset:
294 304 continue
295 305 revop, andor = opt2revset[op]
296 306 if '%(val)' not in revop:
297 307 revset.append(revop)
298 308 else:
299 309 if not isinstance(val, list):
300 310 expr = revop % {'val': val}
301 311 else:
302 312 expr = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
303 313 revset.append(expr)
304 314
305 315 if revset:
306 316 revset = '(' + ' and '.join(revset) + ')'
307 317 else:
308 318 revset = 'all()'
309 319 return revset
310 320
311 321 def generate(ui, dag, displayer, showparents, edgefn):
312 322 seen, state = [], asciistate()
313 323 for rev, type, ctx, parents in dag:
314 324 char = ctx.node() in showparents and '@' or 'o'
315 325 displayer.show(ctx)
316 326 lines = displayer.hunk.pop(rev).split('\n')[:-1]
317 327 displayer.flush(rev)
318 328 edges = edgefn(type, char, lines, seen, rev, parents)
319 329 for type, char, lines, coldata in edges:
320 330 ascii(ui, state, type, char, lines, coldata)
321 331 displayer.close()
322 332
323 333 @command('glog',
324 334 [('l', 'limit', '',
325 335 _('limit number of changes displayed'), _('NUM')),
326 336 ('p', 'patch', False, _('show patch')),
327 337 ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
328 338 ] + templateopts,
329 339 _('hg glog [OPTION]... [FILE]'))
330 340 def graphlog(ui, repo, *pats, **opts):
331 341 """show revision history alongside an ASCII revision graph
332 342
333 343 Print a revision history alongside a revision graph drawn with
334 344 ASCII characters.
335 345
336 346 Nodes printed as an @ character are parents of the working
337 347 directory.
338 348 """
339 349
340 350 check_unsupported_flags(pats, opts)
341 351
342 352 revs = sorted(scmutil.revrange(repo, [revset(repo, pats, opts)]), reverse=1)
343 353 limit = cmdutil.loglimit(opts)
344 354 if limit is not None:
345 355 revs = revs[:limit]
346 356 revdag = graphmod.dagwalker(repo, revs)
347 357
348 358 displayer = show_changeset(ui, repo, opts, buffered=True)
349 359 showparents = [ctx.node() for ctx in repo[None].parents()]
350 360 generate(ui, revdag, displayer, showparents, asciiedges)
351 361
352 362 def graphrevs(repo, nodes, opts):
353 363 limit = cmdutil.loglimit(opts)
354 364 nodes.reverse()
355 365 if limit is not None:
356 366 nodes = nodes[:limit]
357 367 return graphmod.nodes(repo, nodes)
358 368
359 369 def goutgoing(ui, repo, dest=None, **opts):
360 370 """show the outgoing changesets alongside an ASCII revision graph
361 371
362 372 Print the outgoing changesets alongside a revision graph drawn with
363 373 ASCII characters.
364 374
365 375 Nodes printed as an @ character are parents of the working
366 376 directory.
367 377 """
368 378
369 379 check_unsupported_flags([], opts)
370 380 o = hg._outgoing(ui, repo, dest, opts)
371 381 if o is None:
372 382 return
373 383
374 384 revdag = graphrevs(repo, o, opts)
375 385 displayer = show_changeset(ui, repo, opts, buffered=True)
376 386 showparents = [ctx.node() for ctx in repo[None].parents()]
377 387 generate(ui, revdag, displayer, showparents, asciiedges)
378 388
379 389 def gincoming(ui, repo, source="default", **opts):
380 390 """show the incoming changesets alongside an ASCII revision graph
381 391
382 392 Print the incoming changesets alongside a revision graph drawn with
383 393 ASCII characters.
384 394
385 395 Nodes printed as an @ character are parents of the working
386 396 directory.
387 397 """
388 398 def subreporecurse():
389 399 return 1
390 400
391 401 check_unsupported_flags([], opts)
392 402 def display(other, chlist, displayer):
393 403 revdag = graphrevs(other, chlist, opts)
394 404 showparents = [ctx.node() for ctx in repo[None].parents()]
395 405 generate(ui, revdag, displayer, showparents, asciiedges)
396 406
397 407 hg._incoming(display, subreporecurse, ui, repo, source, opts, buffered=True)
398 408
399 409 def uisetup(ui):
400 410 '''Initialize the extension.'''
401 411 _wrapcmd('log', commands.table, graphlog)
402 412 _wrapcmd('incoming', commands.table, gincoming)
403 413 _wrapcmd('outgoing', commands.table, goutgoing)
404 414
405 415 def _wrapcmd(cmd, table, wrapfn):
406 416 '''wrap the command'''
407 417 def graph(orig, *args, **kwargs):
408 418 if kwargs['graph']:
409 419 return wrapfn(*args, **kwargs)
410 420 return orig(*args, **kwargs)
411 421 entry = extensions.wrapcommand(table, cmd, graph)
412 422 entry[1].append(('G', 'graph', None, _("show the revision DAG")))
@@ -1,1264 +1,1294 b''
1 1 # revset.py - revision set queries for mercurial
2 2 #
3 3 # Copyright 2010 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 import re
9 9 import parser, util, error, discovery, hbisect, phases
10 10 import node as nodemod
11 11 import bookmarks as bookmarksmod
12 12 import match as matchmod
13 13 from i18n import _
14 14 import encoding
15 15
16 16 elements = {
17 17 "(": (20, ("group", 1, ")"), ("func", 1, ")")),
18 18 "~": (18, None, ("ancestor", 18)),
19 19 "^": (18, None, ("parent", 18), ("parentpost", 18)),
20 20 "-": (5, ("negate", 19), ("minus", 5)),
21 21 "::": (17, ("dagrangepre", 17), ("dagrange", 17),
22 22 ("dagrangepost", 17)),
23 23 "..": (17, ("dagrangepre", 17), ("dagrange", 17),
24 24 ("dagrangepost", 17)),
25 25 ":": (15, ("rangepre", 15), ("range", 15), ("rangepost", 15)),
26 26 "not": (10, ("not", 10)),
27 27 "!": (10, ("not", 10)),
28 28 "and": (5, None, ("and", 5)),
29 29 "&": (5, None, ("and", 5)),
30 30 "or": (4, None, ("or", 4)),
31 31 "|": (4, None, ("or", 4)),
32 32 "+": (4, None, ("or", 4)),
33 33 ",": (2, None, ("list", 2)),
34 34 ")": (0, None, None),
35 35 "symbol": (0, ("symbol",), None),
36 36 "string": (0, ("string",), None),
37 37 "end": (0, None, None),
38 38 }
39 39
40 40 keywords = set(['and', 'or', 'not'])
41 41
42 42 def tokenize(program):
43 43 pos, l = 0, len(program)
44 44 while pos < l:
45 45 c = program[pos]
46 46 if c.isspace(): # skip inter-token whitespace
47 47 pass
48 48 elif c == ':' and program[pos:pos + 2] == '::': # look ahead carefully
49 49 yield ('::', None, pos)
50 50 pos += 1 # skip ahead
51 51 elif c == '.' and program[pos:pos + 2] == '..': # look ahead carefully
52 52 yield ('..', None, pos)
53 53 pos += 1 # skip ahead
54 54 elif c in "():,-|&+!~^": # handle simple operators
55 55 yield (c, None, pos)
56 56 elif (c in '"\'' or c == 'r' and
57 57 program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings
58 58 if c == 'r':
59 59 pos += 1
60 60 c = program[pos]
61 61 decode = lambda x: x
62 62 else:
63 63 decode = lambda x: x.decode('string-escape')
64 64 pos += 1
65 65 s = pos
66 66 while pos < l: # find closing quote
67 67 d = program[pos]
68 68 if d == '\\': # skip over escaped characters
69 69 pos += 2
70 70 continue
71 71 if d == c:
72 72 yield ('string', decode(program[s:pos]), s)
73 73 break
74 74 pos += 1
75 75 else:
76 76 raise error.ParseError(_("unterminated string"), s)
77 77 elif c.isalnum() or c in '._' or ord(c) > 127: # gather up a symbol/keyword
78 78 s = pos
79 79 pos += 1
80 80 while pos < l: # find end of symbol
81 81 d = program[pos]
82 82 if not (d.isalnum() or d in "._/" or ord(d) > 127):
83 83 break
84 84 if d == '.' and program[pos - 1] == '.': # special case for ..
85 85 pos -= 1
86 86 break
87 87 pos += 1
88 88 sym = program[s:pos]
89 89 if sym in keywords: # operator keywords
90 90 yield (sym, None, s)
91 91 else:
92 92 yield ('symbol', sym, s)
93 93 pos -= 1
94 94 else:
95 95 raise error.ParseError(_("syntax error"), pos)
96 96 pos += 1
97 97 yield ('end', None, pos)
98 98
99 99 # helpers
100 100
101 101 def getstring(x, err):
102 102 if x and (x[0] == 'string' or x[0] == 'symbol'):
103 103 return x[1]
104 104 raise error.ParseError(err)
105 105
106 106 def getlist(x):
107 107 if not x:
108 108 return []
109 109 if x[0] == 'list':
110 110 return getlist(x[1]) + [x[2]]
111 111 return [x]
112 112
113 113 def getargs(x, min, max, err):
114 114 l = getlist(x)
115 if len(l) < min or len(l) > max:
115 if len(l) < min or (max >= 0 and len(l) > max):
116 116 raise error.ParseError(err)
117 117 return l
118 118
119 119 def getset(repo, subset, x):
120 120 if not x:
121 121 raise error.ParseError(_("missing argument"))
122 122 return methods[x[0]](repo, subset, *x[1:])
123 123
124 124 # operator methods
125 125
126 126 def stringset(repo, subset, x):
127 127 x = repo[x].rev()
128 128 if x == -1 and len(subset) == len(repo):
129 129 return [-1]
130 130 if len(subset) == len(repo) or x in subset:
131 131 return [x]
132 132 return []
133 133
134 134 def symbolset(repo, subset, x):
135 135 if x in symbols:
136 136 raise error.ParseError(_("can't use %s here") % x)
137 137 return stringset(repo, subset, x)
138 138
139 139 def rangeset(repo, subset, x, y):
140 140 m = getset(repo, subset, x)
141 141 if not m:
142 142 m = getset(repo, range(len(repo)), x)
143 143
144 144 n = getset(repo, subset, y)
145 145 if not n:
146 146 n = getset(repo, range(len(repo)), y)
147 147
148 148 if not m or not n:
149 149 return []
150 150 m, n = m[0], n[-1]
151 151
152 152 if m < n:
153 153 r = range(m, n + 1)
154 154 else:
155 155 r = range(m, n - 1, -1)
156 156 s = set(subset)
157 157 return [x for x in r if x in s]
158 158
159 159 def andset(repo, subset, x, y):
160 160 return getset(repo, getset(repo, subset, x), y)
161 161
162 162 def orset(repo, subset, x, y):
163 163 xl = getset(repo, subset, x)
164 164 s = set(xl)
165 165 yl = getset(repo, [r for r in subset if r not in s], y)
166 166 return xl + yl
167 167
168 168 def notset(repo, subset, x):
169 169 s = set(getset(repo, subset, x))
170 170 return [r for r in subset if r not in s]
171 171
172 172 def listset(repo, subset, a, b):
173 173 raise error.ParseError(_("can't use a list in this context"))
174 174
175 175 def func(repo, subset, a, b):
176 176 if a[0] == 'symbol' and a[1] in symbols:
177 177 return symbols[a[1]](repo, subset, b)
178 178 raise error.ParseError(_("not a function: %s") % a[1])
179 179
180 180 # functions
181 181
182 182 def adds(repo, subset, x):
183 183 """``adds(pattern)``
184 184 Changesets that add a file matching pattern.
185 185 """
186 186 # i18n: "adds" is a keyword
187 187 pat = getstring(x, _("adds requires a pattern"))
188 188 return checkstatus(repo, subset, pat, 1)
189 189
190 190 def ancestor(repo, subset, x):
191 191 """``ancestor(single, single)``
192 192 Greatest common ancestor of the two changesets.
193 193 """
194 194 # i18n: "ancestor" is a keyword
195 195 l = getargs(x, 2, 2, _("ancestor requires two arguments"))
196 196 r = range(len(repo))
197 197 a = getset(repo, r, l[0])
198 198 b = getset(repo, r, l[1])
199 199 if len(a) != 1 or len(b) != 1:
200 200 # i18n: "ancestor" is a keyword
201 201 raise error.ParseError(_("ancestor arguments must be single revisions"))
202 202 an = [repo[a[0]].ancestor(repo[b[0]]).rev()]
203 203
204 204 return [r for r in an if r in subset]
205 205
206 206 def ancestors(repo, subset, x):
207 207 """``ancestors(set)``
208 208 Changesets that are ancestors of a changeset in set.
209 209 """
210 210 args = getset(repo, range(len(repo)), x)
211 211 if not args:
212 212 return []
213 213 s = set(repo.changelog.ancestors(*args)) | set(args)
214 214 return [r for r in subset if r in s]
215 215
216 216 def ancestorspec(repo, subset, x, n):
217 217 """``set~n``
218 218 Changesets that are the Nth ancestor (first parents only) of a changeset in set.
219 219 """
220 220 try:
221 221 n = int(n[1])
222 222 except (TypeError, ValueError):
223 223 raise error.ParseError(_("~ expects a number"))
224 224 ps = set()
225 225 cl = repo.changelog
226 226 for r in getset(repo, subset, x):
227 227 for i in range(n):
228 228 r = cl.parentrevs(r)[0]
229 229 ps.add(r)
230 230 return [r for r in subset if r in ps]
231 231
232 232 def author(repo, subset, x):
233 233 """``author(string)``
234 234 Alias for ``user(string)``.
235 235 """
236 236 # i18n: "author" is a keyword
237 237 n = encoding.lower(getstring(x, _("author requires a string")))
238 238 return [r for r in subset if n in encoding.lower(repo[r].user())]
239 239
240 240 def bisect(repo, subset, x):
241 241 """``bisect(string)``
242 242 Changesets marked in the specified bisect status:
243 243
244 244 - ``good``, ``bad``, ``skip``: csets explicitly marked as good/bad/skip
245 245 - ``goods``, ``bads`` : csets topologicaly good/bad
246 246 - ``range`` : csets taking part in the bisection
247 247 - ``pruned`` : csets that are goods, bads or skipped
248 248 - ``untested`` : csets whose fate is yet unknown
249 249 - ``ignored`` : csets ignored due to DAG topology
250 250 """
251 251 status = getstring(x, _("bisect requires a string")).lower()
252 252 return [r for r in subset if r in hbisect.get(repo, status)]
253 253
254 254 # Backward-compatibility
255 255 # - no help entry so that we do not advertise it any more
256 256 def bisected(repo, subset, x):
257 257 return bisect(repo, subset, x)
258 258
259 259 def bookmark(repo, subset, x):
260 260 """``bookmark([name])``
261 261 The named bookmark or all bookmarks.
262 262 """
263 263 # i18n: "bookmark" is a keyword
264 264 args = getargs(x, 0, 1, _('bookmark takes one or no arguments'))
265 265 if args:
266 266 bm = getstring(args[0],
267 267 # i18n: "bookmark" is a keyword
268 268 _('the argument to bookmark must be a string'))
269 269 bmrev = bookmarksmod.listbookmarks(repo).get(bm, None)
270 270 if not bmrev:
271 271 raise util.Abort(_("bookmark '%s' does not exist") % bm)
272 272 bmrev = repo[bmrev].rev()
273 273 return [r for r in subset if r == bmrev]
274 274 bms = set([repo[r].rev()
275 275 for r in bookmarksmod.listbookmarks(repo).values()])
276 276 return [r for r in subset if r in bms]
277 277
278 278 def branch(repo, subset, x):
279 279 """``branch(string or set)``
280 280 All changesets belonging to the given branch or the branches of the given
281 281 changesets.
282 282 """
283 283 try:
284 284 b = getstring(x, '')
285 285 if b in repo.branchmap():
286 286 return [r for r in subset if repo[r].branch() == b]
287 287 except error.ParseError:
288 288 # not a string, but another revspec, e.g. tip()
289 289 pass
290 290
291 291 s = getset(repo, range(len(repo)), x)
292 292 b = set()
293 293 for r in s:
294 294 b.add(repo[r].branch())
295 295 s = set(s)
296 296 return [r for r in subset if r in s or repo[r].branch() in b]
297 297
298 298 def checkstatus(repo, subset, pat, field):
299 299 m = None
300 300 s = []
301 301 fast = not matchmod.patkind(pat)
302 302 for r in subset:
303 303 c = repo[r]
304 304 if fast:
305 305 if pat not in c.files():
306 306 continue
307 307 else:
308 308 if not m or matchmod.patkind(pat) == 'set':
309 309 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
310 310 for f in c.files():
311 311 if m(f):
312 312 break
313 313 else:
314 314 continue
315 315 files = repo.status(c.p1().node(), c.node())[field]
316 316 if fast:
317 317 if pat in files:
318 318 s.append(r)
319 319 else:
320 320 for f in files:
321 321 if m(f):
322 322 s.append(r)
323 323 break
324 324 return s
325 325
326 326 def _children(repo, narrow, s):
327 327 cs = set()
328 328 pr = repo.changelog.parentrevs
329 329 s = set(s)
330 330 for r in xrange(len(repo)):
331 331 for p in pr(r):
332 332 if p in s:
333 333 cs.add(r)
334 334 return cs
335 335
336 336 def children(repo, subset, x):
337 337 """``children(set)``
338 338 Child changesets of changesets in set.
339 339 """
340 340 s = getset(repo, range(len(repo)), x)
341 341 cs = _children(repo, subset, s)
342 342 return [r for r in subset if r in cs]
343 343
344 344 def closed(repo, subset, x):
345 345 """``closed()``
346 346 Changeset is closed.
347 347 """
348 348 # i18n: "closed" is a keyword
349 349 getargs(x, 0, 0, _("closed takes no arguments"))
350 350 return [r for r in subset if repo[r].extra().get('close')]
351 351
352 352 def contains(repo, subset, x):
353 353 """``contains(pattern)``
354 354 Revision contains a file matching pattern. See :hg:`help patterns`
355 355 for information about file patterns.
356 356 """
357 357 # i18n: "contains" is a keyword
358 358 pat = getstring(x, _("contains requires a pattern"))
359 359 m = None
360 360 s = []
361 361 if not matchmod.patkind(pat):
362 362 for r in subset:
363 363 if pat in repo[r]:
364 364 s.append(r)
365 365 else:
366 366 for r in subset:
367 367 c = repo[r]
368 368 if not m or matchmod.patkind(pat) == 'set':
369 369 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
370 370 for f in c.manifest():
371 371 if m(f):
372 372 s.append(r)
373 373 break
374 374 return s
375 375
376 376 def date(repo, subset, x):
377 377 """``date(interval)``
378 378 Changesets within the interval, see :hg:`help dates`.
379 379 """
380 380 # i18n: "date" is a keyword
381 381 ds = getstring(x, _("date requires a string"))
382 382 dm = util.matchdate(ds)
383 383 return [r for r in subset if dm(repo[r].date()[0])]
384 384
385 385 def desc(repo, subset, x):
386 386 """``desc(string)``
387 387 Search commit message for string. The match is case-insensitive.
388 388 """
389 389 # i18n: "desc" is a keyword
390 390 ds = encoding.lower(getstring(x, _("desc requires a string")))
391 391 l = []
392 392 for r in subset:
393 393 c = repo[r]
394 394 if ds in encoding.lower(c.description()):
395 395 l.append(r)
396 396 return l
397 397
398 398 def descendants(repo, subset, x):
399 399 """``descendants(set)``
400 400 Changesets which are descendants of changesets in set.
401 401 """
402 402 args = getset(repo, range(len(repo)), x)
403 403 if not args:
404 404 return []
405 405 s = set(repo.changelog.descendants(*args)) | set(args)
406 406 return [r for r in subset if r in s]
407 407
408 408 def draft(repo, subset, x):
409 409 """``draft()``
410 410 Changeset in draft phase."""
411 411 getargs(x, 0, 0, _("draft takes no arguments"))
412 412 return [r for r in subset if repo._phaserev[r] == phases.draft]
413 413
414 414 def filelog(repo, subset, x):
415 415 """``filelog(pattern)``
416 416 Changesets connected to the specified filelog.
417 417 """
418 418
419 419 pat = getstring(x, _("filelog requires a pattern"))
420 420 m = matchmod.match(repo.root, repo.getcwd(), [pat], default='relpath',
421 421 ctx=repo[None])
422 422 s = set()
423 423
424 424 if not matchmod.patkind(pat):
425 425 for f in m.files():
426 426 fl = repo.file(f)
427 427 for fr in fl:
428 428 s.add(fl.linkrev(fr))
429 429 else:
430 430 for f in repo[None]:
431 431 if m(f):
432 432 fl = repo.file(f)
433 433 for fr in fl:
434 434 s.add(fl.linkrev(fr))
435 435
436 436 return [r for r in subset if r in s]
437 437
438 438 def first(repo, subset, x):
439 439 """``first(set, [n])``
440 440 An alias for limit().
441 441 """
442 442 return limit(repo, subset, x)
443 443
444 444 def follow(repo, subset, x):
445 445 """``follow([file])``
446 446 An alias for ``::.`` (ancestors of the working copy's first parent).
447 447 If a filename is specified, the history of the given file is followed,
448 448 including copies.
449 449 """
450 450 # i18n: "follow" is a keyword
451 451 l = getargs(x, 0, 1, _("follow takes no arguments or a filename"))
452 452 c = repo['.']
453 453 if l:
454 454 x = getstring(l[0], _("follow expected a filename"))
455 455 if x in c:
456 456 cx = c[x]
457 457 s = set(ctx.rev() for ctx in cx.ancestors())
458 458 # include the revision responsible for the most recent version
459 459 s.add(cx.linkrev())
460 460 else:
461 461 return []
462 462 else:
463 463 s = set(repo.changelog.ancestors(c.rev()))
464 464 s.add(c.rev())
465 465
466 466 return [r for r in subset if r in s]
467 467
468 468 def getall(repo, subset, x):
469 469 """``all()``
470 470 All changesets, the same as ``0:tip``.
471 471 """
472 472 # i18n: "all" is a keyword
473 473 getargs(x, 0, 0, _("all takes no arguments"))
474 474 return subset
475 475
476 476 def grep(repo, subset, x):
477 477 """``grep(regex)``
478 478 Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')``
479 479 to ensure special escape characters are handled correctly. Unlike
480 480 ``keyword(string)``, the match is case-sensitive.
481 481 """
482 482 try:
483 483 # i18n: "grep" is a keyword
484 484 gr = re.compile(getstring(x, _("grep requires a string")))
485 485 except re.error, e:
486 486 raise error.ParseError(_('invalid match pattern: %s') % e)
487 487 l = []
488 488 for r in subset:
489 489 c = repo[r]
490 490 for e in c.files() + [c.user(), c.description()]:
491 491 if gr.search(e):
492 492 l.append(r)
493 493 break
494 494 return l
495 495
496 def _matchfiles(repo, subset, x):
497 # _matchfiles takes a revset list of prefixed arguments:
498 #
499 # [p:foo, i:bar, x:baz]
500 #
501 # builds a match object from them and filters subset. Allowed
502 # prefixes are 'p:' for regular patterns, 'i:' for include
503 # patterns and 'x:' for exclude patterns.
504
505 # i18n: "_matchfiles" is a keyword
506 l = getargs(x, 1, -1, _("_matchfiles requires at least one argument"))
507 pats, inc, exc = [], [], []
508 hasset = False
509 for arg in l:
510 s = getstring(arg, _("_matchfiles requires string arguments"))
511 prefix, value = s[:2], s[2:]
512 if prefix == 'p:':
513 pats.append(value)
514 elif prefix == 'i:':
515 inc.append(value)
516 elif prefix == 'x:':
517 exc.append(value)
518 else:
519 raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix)
520 if not hasset and matchmod.patkind(value) == 'set':
521 hasset = True
522 m = None
523 s = []
524 for r in subset:
525 c = repo[r]
526 if not m or hasset:
527 m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc,
528 exclude=exc, ctx=c)
529 for f in c.files():
530 if m(f):
531 s.append(r)
532 break
533 return s
534
496 535 def hasfile(repo, subset, x):
497 536 """``file(pattern)``
498 537 Changesets affecting files matched by pattern.
499 538 """
500 539 # i18n: "file" is a keyword
501 540 pat = getstring(x, _("file requires a pattern"))
502 m = None
503 s = []
504 for r in subset:
505 c = repo[r]
506 if not m or matchmod.patkind(pat) == 'set':
507 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
508 for f in c.files():
509 if m(f):
510 s.append(r)
511 break
512 return s
541 return _matchfiles(repo, subset, ('string', 'p:' + pat))
513 542
514 543 def head(repo, subset, x):
515 544 """``head()``
516 545 Changeset is a named branch head.
517 546 """
518 547 # i18n: "head" is a keyword
519 548 getargs(x, 0, 0, _("head takes no arguments"))
520 549 hs = set()
521 550 for b, ls in repo.branchmap().iteritems():
522 551 hs.update(repo[h].rev() for h in ls)
523 552 return [r for r in subset if r in hs]
524 553
525 554 def heads(repo, subset, x):
526 555 """``heads(set)``
527 556 Members of set with no children in set.
528 557 """
529 558 s = getset(repo, subset, x)
530 559 ps = set(parents(repo, subset, x))
531 560 return [r for r in s if r not in ps]
532 561
533 562 def keyword(repo, subset, x):
534 563 """``keyword(string)``
535 564 Search commit message, user name, and names of changed files for
536 565 string. The match is case-insensitive.
537 566 """
538 567 # i18n: "keyword" is a keyword
539 568 kw = encoding.lower(getstring(x, _("keyword requires a string")))
540 569 l = []
541 570 for r in subset:
542 571 c = repo[r]
543 572 t = " ".join(c.files() + [c.user(), c.description()])
544 573 if kw in encoding.lower(t):
545 574 l.append(r)
546 575 return l
547 576
548 577 def limit(repo, subset, x):
549 578 """``limit(set, [n])``
550 579 First n members of set, defaulting to 1.
551 580 """
552 581 # i18n: "limit" is a keyword
553 582 l = getargs(x, 1, 2, _("limit requires one or two arguments"))
554 583 try:
555 584 lim = 1
556 585 if len(l) == 2:
557 586 # i18n: "limit" is a keyword
558 587 lim = int(getstring(l[1], _("limit requires a number")))
559 588 except (TypeError, ValueError):
560 589 # i18n: "limit" is a keyword
561 590 raise error.ParseError(_("limit expects a number"))
562 591 ss = set(subset)
563 592 os = getset(repo, range(len(repo)), l[0])[:lim]
564 593 return [r for r in os if r in ss]
565 594
566 595 def last(repo, subset, x):
567 596 """``last(set, [n])``
568 597 Last n members of set, defaulting to 1.
569 598 """
570 599 # i18n: "last" is a keyword
571 600 l = getargs(x, 1, 2, _("last requires one or two arguments"))
572 601 try:
573 602 lim = 1
574 603 if len(l) == 2:
575 604 # i18n: "last" is a keyword
576 605 lim = int(getstring(l[1], _("last requires a number")))
577 606 except (TypeError, ValueError):
578 607 # i18n: "last" is a keyword
579 608 raise error.ParseError(_("last expects a number"))
580 609 ss = set(subset)
581 610 os = getset(repo, range(len(repo)), l[0])[-lim:]
582 611 return [r for r in os if r in ss]
583 612
584 613 def maxrev(repo, subset, x):
585 614 """``max(set)``
586 615 Changeset with highest revision number in set.
587 616 """
588 617 os = getset(repo, range(len(repo)), x)
589 618 if os:
590 619 m = max(os)
591 620 if m in subset:
592 621 return [m]
593 622 return []
594 623
595 624 def merge(repo, subset, x):
596 625 """``merge()``
597 626 Changeset is a merge changeset.
598 627 """
599 628 # i18n: "merge" is a keyword
600 629 getargs(x, 0, 0, _("merge takes no arguments"))
601 630 cl = repo.changelog
602 631 return [r for r in subset if cl.parentrevs(r)[1] != -1]
603 632
604 633 def minrev(repo, subset, x):
605 634 """``min(set)``
606 635 Changeset with lowest revision number in set.
607 636 """
608 637 os = getset(repo, range(len(repo)), x)
609 638 if os:
610 639 m = min(os)
611 640 if m in subset:
612 641 return [m]
613 642 return []
614 643
615 644 def modifies(repo, subset, x):
616 645 """``modifies(pattern)``
617 646 Changesets modifying files matched by pattern.
618 647 """
619 648 # i18n: "modifies" is a keyword
620 649 pat = getstring(x, _("modifies requires a pattern"))
621 650 return checkstatus(repo, subset, pat, 0)
622 651
623 652 def node(repo, subset, x):
624 653 """``id(string)``
625 654 Revision non-ambiguously specified by the given hex string prefix.
626 655 """
627 656 # i18n: "id" is a keyword
628 657 l = getargs(x, 1, 1, _("id requires one argument"))
629 658 # i18n: "id" is a keyword
630 659 n = getstring(l[0], _("id requires a string"))
631 660 if len(n) == 40:
632 661 rn = repo[n].rev()
633 662 else:
634 663 rn = repo.changelog.rev(repo.changelog._partialmatch(n))
635 664 return [r for r in subset if r == rn]
636 665
637 666 def outgoing(repo, subset, x):
638 667 """``outgoing([path])``
639 668 Changesets not found in the specified destination repository, or the
640 669 default push location.
641 670 """
642 671 import hg # avoid start-up nasties
643 672 # i18n: "outgoing" is a keyword
644 673 l = getargs(x, 0, 1, _("outgoing takes one or no arguments"))
645 674 # i18n: "outgoing" is a keyword
646 675 dest = l and getstring(l[0], _("outgoing requires a repository path")) or ''
647 676 dest = repo.ui.expandpath(dest or 'default-push', dest or 'default')
648 677 dest, branches = hg.parseurl(dest)
649 678 revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
650 679 if revs:
651 680 revs = [repo.lookup(rev) for rev in revs]
652 681 other = hg.peer(repo, {}, dest)
653 682 repo.ui.pushbuffer()
654 683 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
655 684 repo.ui.popbuffer()
656 685 cl = repo.changelog
657 686 o = set([cl.rev(r) for r in outgoing.missing])
658 687 return [r for r in subset if r in o]
659 688
660 689 def p1(repo, subset, x):
661 690 """``p1([set])``
662 691 First parent of changesets in set, or the working directory.
663 692 """
664 693 if x is None:
665 694 p = repo[x].p1().rev()
666 695 return [r for r in subset if r == p]
667 696
668 697 ps = set()
669 698 cl = repo.changelog
670 699 for r in getset(repo, range(len(repo)), x):
671 700 ps.add(cl.parentrevs(r)[0])
672 701 return [r for r in subset if r in ps]
673 702
674 703 def p2(repo, subset, x):
675 704 """``p2([set])``
676 705 Second parent of changesets in set, or the working directory.
677 706 """
678 707 if x is None:
679 708 ps = repo[x].parents()
680 709 try:
681 710 p = ps[1].rev()
682 711 return [r for r in subset if r == p]
683 712 except IndexError:
684 713 return []
685 714
686 715 ps = set()
687 716 cl = repo.changelog
688 717 for r in getset(repo, range(len(repo)), x):
689 718 ps.add(cl.parentrevs(r)[1])
690 719 return [r for r in subset if r in ps]
691 720
692 721 def parents(repo, subset, x):
693 722 """``parents([set])``
694 723 The set of all parents for all changesets in set, or the working directory.
695 724 """
696 725 if x is None:
697 726 ps = tuple(p.rev() for p in repo[x].parents())
698 727 return [r for r in subset if r in ps]
699 728
700 729 ps = set()
701 730 cl = repo.changelog
702 731 for r in getset(repo, range(len(repo)), x):
703 732 ps.update(cl.parentrevs(r))
704 733 return [r for r in subset if r in ps]
705 734
706 735 def parentspec(repo, subset, x, n):
707 736 """``set^0``
708 737 The set.
709 738 ``set^1`` (or ``set^``), ``set^2``
710 739 First or second parent, respectively, of all changesets in set.
711 740 """
712 741 try:
713 742 n = int(n[1])
714 743 if n not in (0, 1, 2):
715 744 raise ValueError
716 745 except (TypeError, ValueError):
717 746 raise error.ParseError(_("^ expects a number 0, 1, or 2"))
718 747 ps = set()
719 748 cl = repo.changelog
720 749 for r in getset(repo, subset, x):
721 750 if n == 0:
722 751 ps.add(r)
723 752 elif n == 1:
724 753 ps.add(cl.parentrevs(r)[0])
725 754 elif n == 2:
726 755 parents = cl.parentrevs(r)
727 756 if len(parents) > 1:
728 757 ps.add(parents[1])
729 758 return [r for r in subset if r in ps]
730 759
731 760 def present(repo, subset, x):
732 761 """``present(set)``
733 762 An empty set, if any revision in set isn't found; otherwise,
734 763 all revisions in set.
735 764 """
736 765 try:
737 766 return getset(repo, subset, x)
738 767 except error.RepoLookupError:
739 768 return []
740 769
741 770 def public(repo, subset, x):
742 771 """``public()``
743 772 Changeset in public phase."""
744 773 getargs(x, 0, 0, _("public takes no arguments"))
745 774 return [r for r in subset if repo._phaserev[r] == phases.public]
746 775
747 776 def remote(repo, subset, x):
748 777 """``remote([id [,path]])``
749 778 Local revision that corresponds to the given identifier in a
750 779 remote repository, if present. Here, the '.' identifier is a
751 780 synonym for the current local branch.
752 781 """
753 782
754 783 import hg # avoid start-up nasties
755 784 # i18n: "remote" is a keyword
756 785 l = getargs(x, 0, 2, _("remote takes one, two or no arguments"))
757 786
758 787 q = '.'
759 788 if len(l) > 0:
760 789 # i18n: "remote" is a keyword
761 790 q = getstring(l[0], _("remote requires a string id"))
762 791 if q == '.':
763 792 q = repo['.'].branch()
764 793
765 794 dest = ''
766 795 if len(l) > 1:
767 796 # i18n: "remote" is a keyword
768 797 dest = getstring(l[1], _("remote requires a repository path"))
769 798 dest = repo.ui.expandpath(dest or 'default')
770 799 dest, branches = hg.parseurl(dest)
771 800 revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
772 801 if revs:
773 802 revs = [repo.lookup(rev) for rev in revs]
774 803 other = hg.peer(repo, {}, dest)
775 804 n = other.lookup(q)
776 805 if n in repo:
777 806 r = repo[n].rev()
778 807 if r in subset:
779 808 return [r]
780 809 return []
781 810
782 811 def removes(repo, subset, x):
783 812 """``removes(pattern)``
784 813 Changesets which remove files matching pattern.
785 814 """
786 815 # i18n: "removes" is a keyword
787 816 pat = getstring(x, _("removes requires a pattern"))
788 817 return checkstatus(repo, subset, pat, 2)
789 818
790 819 def rev(repo, subset, x):
791 820 """``rev(number)``
792 821 Revision with the given numeric identifier.
793 822 """
794 823 # i18n: "rev" is a keyword
795 824 l = getargs(x, 1, 1, _("rev requires one argument"))
796 825 try:
797 826 # i18n: "rev" is a keyword
798 827 l = int(getstring(l[0], _("rev requires a number")))
799 828 except (TypeError, ValueError):
800 829 # i18n: "rev" is a keyword
801 830 raise error.ParseError(_("rev expects a number"))
802 831 return [r for r in subset if r == l]
803 832
804 833 def reverse(repo, subset, x):
805 834 """``reverse(set)``
806 835 Reverse order of set.
807 836 """
808 837 l = getset(repo, subset, x)
809 838 l.reverse()
810 839 return l
811 840
812 841 def roots(repo, subset, x):
813 842 """``roots(set)``
814 843 Changesets with no parent changeset in set.
815 844 """
816 845 s = getset(repo, xrange(len(repo)), x)
817 846 cs = _children(repo, s, s)
818 847 return [r for r in s if r not in cs]
819 848
820 849 def secret(repo, subset, x):
821 850 """``secret()``
822 851 Changeset in secret phase."""
823 852 getargs(x, 0, 0, _("secret takes no arguments"))
824 853 return [r for r in subset if repo._phaserev[r] == phases.secret]
825 854
826 855 def sort(repo, subset, x):
827 856 """``sort(set[, [-]key...])``
828 857 Sort set by keys. The default sort order is ascending, specify a key
829 858 as ``-key`` to sort in descending order.
830 859
831 860 The keys can be:
832 861
833 862 - ``rev`` for the revision number,
834 863 - ``branch`` for the branch name,
835 864 - ``desc`` for the commit message (description),
836 865 - ``user`` for user name (``author`` can be used as an alias),
837 866 - ``date`` for the commit date
838 867 """
839 868 # i18n: "sort" is a keyword
840 869 l = getargs(x, 1, 2, _("sort requires one or two arguments"))
841 870 keys = "rev"
842 871 if len(l) == 2:
843 872 keys = getstring(l[1], _("sort spec must be a string"))
844 873
845 874 s = l[0]
846 875 keys = keys.split()
847 876 l = []
848 877 def invert(s):
849 878 return "".join(chr(255 - ord(c)) for c in s)
850 879 for r in getset(repo, subset, s):
851 880 c = repo[r]
852 881 e = []
853 882 for k in keys:
854 883 if k == 'rev':
855 884 e.append(r)
856 885 elif k == '-rev':
857 886 e.append(-r)
858 887 elif k == 'branch':
859 888 e.append(c.branch())
860 889 elif k == '-branch':
861 890 e.append(invert(c.branch()))
862 891 elif k == 'desc':
863 892 e.append(c.description())
864 893 elif k == '-desc':
865 894 e.append(invert(c.description()))
866 895 elif k in 'user author':
867 896 e.append(c.user())
868 897 elif k in '-user -author':
869 898 e.append(invert(c.user()))
870 899 elif k == 'date':
871 900 e.append(c.date()[0])
872 901 elif k == '-date':
873 902 e.append(-c.date()[0])
874 903 else:
875 904 raise error.ParseError(_("unknown sort key %r") % k)
876 905 e.append(r)
877 906 l.append(e)
878 907 l.sort()
879 908 return [e[-1] for e in l]
880 909
881 910 def tag(repo, subset, x):
882 911 """``tag([name])``
883 912 The specified tag by name, or all tagged revisions if no name is given.
884 913 """
885 914 # i18n: "tag" is a keyword
886 915 args = getargs(x, 0, 1, _("tag takes one or no arguments"))
887 916 cl = repo.changelog
888 917 if args:
889 918 tn = getstring(args[0],
890 919 # i18n: "tag" is a keyword
891 920 _('the argument to tag must be a string'))
892 921 if not repo.tags().get(tn, None):
893 922 raise util.Abort(_("tag '%s' does not exist") % tn)
894 923 s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn])
895 924 else:
896 925 s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
897 926 return [r for r in subset if r in s]
898 927
899 928 def tagged(repo, subset, x):
900 929 return tag(repo, subset, x)
901 930
902 931 def user(repo, subset, x):
903 932 """``user(string)``
904 933 User name contains string. The match is case-insensitive.
905 934 """
906 935 return author(repo, subset, x)
907 936
908 937 # for internal use
909 938 def _list(repo, subset, x):
910 939 s = getstring(x, "internal error")
911 940 if not s:
912 941 return []
913 942 if not isinstance(subset, set):
914 943 subset = set(subset)
915 944 ls = [repo[r].rev() for r in s.split('\0')]
916 945 return [r for r in ls if r in subset]
917 946
918 947 symbols = {
919 948 "adds": adds,
920 949 "all": getall,
921 950 "ancestor": ancestor,
922 951 "ancestors": ancestors,
923 952 "author": author,
924 953 "bisect": bisect,
925 954 "bisected": bisected,
926 955 "bookmark": bookmark,
927 956 "branch": branch,
928 957 "children": children,
929 958 "closed": closed,
930 959 "contains": contains,
931 960 "date": date,
932 961 "desc": desc,
933 962 "descendants": descendants,
934 963 "draft": draft,
935 964 "file": hasfile,
936 965 "filelog": filelog,
937 966 "first": first,
938 967 "follow": follow,
939 968 "grep": grep,
940 969 "head": head,
941 970 "heads": heads,
942 971 "id": node,
943 972 "keyword": keyword,
944 973 "last": last,
945 974 "limit": limit,
975 "_matchfiles": _matchfiles,
946 976 "max": maxrev,
947 977 "merge": merge,
948 978 "min": minrev,
949 979 "modifies": modifies,
950 980 "outgoing": outgoing,
951 981 "p1": p1,
952 982 "p2": p2,
953 983 "parents": parents,
954 984 "present": present,
955 985 "public": public,
956 986 "remote": remote,
957 987 "removes": removes,
958 988 "rev": rev,
959 989 "reverse": reverse,
960 990 "roots": roots,
961 991 "sort": sort,
962 992 "secret": secret,
963 993 "tag": tag,
964 994 "tagged": tagged,
965 995 "user": user,
966 996 "_list": _list,
967 997 }
968 998
969 999 methods = {
970 1000 "range": rangeset,
971 1001 "string": stringset,
972 1002 "symbol": symbolset,
973 1003 "and": andset,
974 1004 "or": orset,
975 1005 "not": notset,
976 1006 "list": listset,
977 1007 "func": func,
978 1008 "ancestor": ancestorspec,
979 1009 "parent": parentspec,
980 1010 "parentpost": p1,
981 1011 }
982 1012
983 1013 def optimize(x, small):
984 1014 if x is None:
985 1015 return 0, x
986 1016
987 1017 smallbonus = 1
988 1018 if small:
989 1019 smallbonus = .5
990 1020
991 1021 op = x[0]
992 1022 if op == 'minus':
993 1023 return optimize(('and', x[1], ('not', x[2])), small)
994 1024 elif op == 'dagrange':
995 1025 return optimize(('and', ('func', ('symbol', 'descendants'), x[1]),
996 1026 ('func', ('symbol', 'ancestors'), x[2])), small)
997 1027 elif op == 'dagrangepre':
998 1028 return optimize(('func', ('symbol', 'ancestors'), x[1]), small)
999 1029 elif op == 'dagrangepost':
1000 1030 return optimize(('func', ('symbol', 'descendants'), x[1]), small)
1001 1031 elif op == 'rangepre':
1002 1032 return optimize(('range', ('string', '0'), x[1]), small)
1003 1033 elif op == 'rangepost':
1004 1034 return optimize(('range', x[1], ('string', 'tip')), small)
1005 1035 elif op == 'negate':
1006 1036 return optimize(('string',
1007 1037 '-' + getstring(x[1], _("can't negate that"))), small)
1008 1038 elif op in 'string symbol negate':
1009 1039 return smallbonus, x # single revisions are small
1010 1040 elif op == 'and' or op == 'dagrange':
1011 1041 wa, ta = optimize(x[1], True)
1012 1042 wb, tb = optimize(x[2], True)
1013 1043 w = min(wa, wb)
1014 1044 if wa > wb:
1015 1045 return w, (op, tb, ta)
1016 1046 return w, (op, ta, tb)
1017 1047 elif op == 'or':
1018 1048 wa, ta = optimize(x[1], False)
1019 1049 wb, tb = optimize(x[2], False)
1020 1050 if wb < wa:
1021 1051 wb, wa = wa, wb
1022 1052 return max(wa, wb), (op, ta, tb)
1023 1053 elif op == 'not':
1024 1054 o = optimize(x[1], not small)
1025 1055 return o[0], (op, o[1])
1026 1056 elif op == 'parentpost':
1027 1057 o = optimize(x[1], small)
1028 1058 return o[0], (op, o[1])
1029 1059 elif op == 'group':
1030 1060 return optimize(x[1], small)
1031 1061 elif op in 'range list parent ancestorspec':
1032 1062 if op == 'parent':
1033 1063 # x^:y means (x^) : y, not x ^ (:y)
1034 1064 post = ('parentpost', x[1])
1035 1065 if x[2][0] == 'dagrangepre':
1036 1066 return optimize(('dagrange', post, x[2][1]), small)
1037 1067 elif x[2][0] == 'rangepre':
1038 1068 return optimize(('range', post, x[2][1]), small)
1039 1069
1040 1070 wa, ta = optimize(x[1], small)
1041 1071 wb, tb = optimize(x[2], small)
1042 1072 return wa + wb, (op, ta, tb)
1043 1073 elif op == 'func':
1044 1074 f = getstring(x[1], _("not a symbol"))
1045 1075 wa, ta = optimize(x[2], small)
1046 1076 if f in ("author branch closed date desc file grep keyword "
1047 1077 "outgoing user"):
1048 1078 w = 10 # slow
1049 1079 elif f in "modifies adds removes":
1050 1080 w = 30 # slower
1051 1081 elif f == "contains":
1052 1082 w = 100 # very slow
1053 1083 elif f == "ancestor":
1054 1084 w = 1 * smallbonus
1055 1085 elif f in "reverse limit first":
1056 1086 w = 0
1057 1087 elif f in "sort":
1058 1088 w = 10 # assume most sorts look at changelog
1059 1089 else:
1060 1090 w = 1
1061 1091 return w + wa, (op, x[1], ta)
1062 1092 return 1, x
1063 1093
1064 1094 class revsetalias(object):
1065 1095 funcre = re.compile('^([^(]+)\(([^)]+)\)$')
1066 1096 args = None
1067 1097
1068 1098 def __init__(self, name, value):
1069 1099 '''Aliases like:
1070 1100
1071 1101 h = heads(default)
1072 1102 b($1) = ancestors($1) - ancestors(default)
1073 1103 '''
1074 1104 m = self.funcre.search(name)
1075 1105 if m:
1076 1106 self.name = m.group(1)
1077 1107 self.tree = ('func', ('symbol', m.group(1)))
1078 1108 self.args = [x.strip() for x in m.group(2).split(',')]
1079 1109 for arg in self.args:
1080 1110 value = value.replace(arg, repr(arg))
1081 1111 else:
1082 1112 self.name = name
1083 1113 self.tree = ('symbol', name)
1084 1114
1085 1115 self.replacement, pos = parse(value)
1086 1116 if pos != len(value):
1087 1117 raise error.ParseError(_('invalid token'), pos)
1088 1118
1089 1119 def _getalias(aliases, tree):
1090 1120 """If tree looks like an unexpanded alias, return it. Return None
1091 1121 otherwise.
1092 1122 """
1093 1123 if isinstance(tree, tuple) and tree:
1094 1124 if tree[0] == 'symbol' and len(tree) == 2:
1095 1125 name = tree[1]
1096 1126 alias = aliases.get(name)
1097 1127 if alias and alias.args is None and alias.tree == tree:
1098 1128 return alias
1099 1129 if tree[0] == 'func' and len(tree) > 1:
1100 1130 if tree[1][0] == 'symbol' and len(tree[1]) == 2:
1101 1131 name = tree[1][1]
1102 1132 alias = aliases.get(name)
1103 1133 if alias and alias.args is not None and alias.tree == tree[:2]:
1104 1134 return alias
1105 1135 return None
1106 1136
1107 1137 def _expandargs(tree, args):
1108 1138 """Replace all occurences of ('string', name) with the
1109 1139 substitution value of the same name in args, recursively.
1110 1140 """
1111 1141 if not isinstance(tree, tuple):
1112 1142 return tree
1113 1143 if len(tree) == 2 and tree[0] == 'string':
1114 1144 return args.get(tree[1], tree)
1115 1145 return tuple(_expandargs(t, args) for t in tree)
1116 1146
1117 1147 def _expandaliases(aliases, tree, expanding):
1118 1148 """Expand aliases in tree, recursively.
1119 1149
1120 1150 'aliases' is a dictionary mapping user defined aliases to
1121 1151 revsetalias objects.
1122 1152 """
1123 1153 if not isinstance(tree, tuple):
1124 1154 # Do not expand raw strings
1125 1155 return tree
1126 1156 alias = _getalias(aliases, tree)
1127 1157 if alias is not None:
1128 1158 if alias in expanding:
1129 1159 raise error.ParseError(_('infinite expansion of revset alias "%s" '
1130 1160 'detected') % alias.name)
1131 1161 expanding.append(alias)
1132 1162 result = alias.replacement
1133 1163 if alias.args is not None:
1134 1164 l = getlist(tree[2])
1135 1165 if len(l) != len(alias.args):
1136 1166 raise error.ParseError(
1137 1167 _('invalid number of arguments: %s') % len(l))
1138 1168 result = _expandargs(result, dict(zip(alias.args, l)))
1139 1169 # Recurse in place, the base expression may have been rewritten
1140 1170 result = _expandaliases(aliases, result, expanding)
1141 1171 expanding.pop()
1142 1172 else:
1143 1173 result = tuple(_expandaliases(aliases, t, expanding)
1144 1174 for t in tree)
1145 1175 return result
1146 1176
1147 1177 def findaliases(ui, tree):
1148 1178 aliases = {}
1149 1179 for k, v in ui.configitems('revsetalias'):
1150 1180 alias = revsetalias(k, v)
1151 1181 aliases[alias.name] = alias
1152 1182 return _expandaliases(aliases, tree, [])
1153 1183
1154 1184 parse = parser.parser(tokenize, elements).parse
1155 1185
1156 1186 def match(ui, spec):
1157 1187 if not spec:
1158 1188 raise error.ParseError(_("empty query"))
1159 1189 tree, pos = parse(spec)
1160 1190 if (pos != len(spec)):
1161 1191 raise error.ParseError(_("invalid token"), pos)
1162 1192 if ui:
1163 1193 tree = findaliases(ui, tree)
1164 1194 weight, tree = optimize(tree, True)
1165 1195 def mfunc(repo, subset):
1166 1196 return getset(repo, subset, tree)
1167 1197 return mfunc
1168 1198
1169 1199 def formatspec(expr, *args):
1170 1200 '''
1171 1201 This is a convenience function for using revsets internally, and
1172 1202 escapes arguments appropriately. Aliases are intentionally ignored
1173 1203 so that intended expression behavior isn't accidentally subverted.
1174 1204
1175 1205 Supported arguments:
1176 1206
1177 1207 %r = revset expression, parenthesized
1178 1208 %d = int(arg), no quoting
1179 1209 %s = string(arg), escaped and single-quoted
1180 1210 %b = arg.branch(), escaped and single-quoted
1181 1211 %n = hex(arg), single-quoted
1182 1212 %% = a literal '%'
1183 1213
1184 1214 Prefixing the type with 'l' specifies a parenthesized list of that type.
1185 1215
1186 1216 >>> formatspec('%r:: and %lr', '10 or 11', ("this()", "that()"))
1187 1217 '(10 or 11):: and ((this()) or (that()))'
1188 1218 >>> formatspec('%d:: and not %d::', 10, 20)
1189 1219 '10:: and not 20::'
1190 1220 >>> formatspec('%ld or %ld', [], [1])
1191 1221 "_list('') or 1"
1192 1222 >>> formatspec('keyword(%s)', 'foo\\xe9')
1193 1223 "keyword('foo\\\\xe9')"
1194 1224 >>> b = lambda: 'default'
1195 1225 >>> b.branch = b
1196 1226 >>> formatspec('branch(%b)', b)
1197 1227 "branch('default')"
1198 1228 >>> formatspec('root(%ls)', ['a', 'b', 'c', 'd'])
1199 1229 "root(_list('a\\x00b\\x00c\\x00d'))"
1200 1230 '''
1201 1231
1202 1232 def quote(s):
1203 1233 return repr(str(s))
1204 1234
1205 1235 def argtype(c, arg):
1206 1236 if c == 'd':
1207 1237 return str(int(arg))
1208 1238 elif c == 's':
1209 1239 return quote(arg)
1210 1240 elif c == 'r':
1211 1241 parse(arg) # make sure syntax errors are confined
1212 1242 return '(%s)' % arg
1213 1243 elif c == 'n':
1214 1244 return quote(nodemod.hex(arg))
1215 1245 elif c == 'b':
1216 1246 return quote(arg.branch())
1217 1247
1218 1248 def listexp(s, t):
1219 1249 l = len(s)
1220 1250 if l == 0:
1221 1251 return "_list('')"
1222 1252 elif l == 1:
1223 1253 return argtype(t, s[0])
1224 1254 elif t == 'd':
1225 1255 return "_list('%s')" % "\0".join(str(int(a)) for a in s)
1226 1256 elif t == 's':
1227 1257 return "_list('%s')" % "\0".join(s)
1228 1258 elif t == 'n':
1229 1259 return "_list('%s')" % "\0".join(nodemod.hex(a) for a in s)
1230 1260 elif t == 'b':
1231 1261 return "_list('%s')" % "\0".join(a.branch() for a in s)
1232 1262
1233 1263 m = l // 2
1234 1264 return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t))
1235 1265
1236 1266 ret = ''
1237 1267 pos = 0
1238 1268 arg = 0
1239 1269 while pos < len(expr):
1240 1270 c = expr[pos]
1241 1271 if c == '%':
1242 1272 pos += 1
1243 1273 d = expr[pos]
1244 1274 if d == '%':
1245 1275 ret += d
1246 1276 elif d in 'dsnbr':
1247 1277 ret += argtype(d, args[arg])
1248 1278 arg += 1
1249 1279 elif d == 'l':
1250 1280 # a list of some type
1251 1281 pos += 1
1252 1282 d = expr[pos]
1253 1283 ret += listexp(list(args[arg]), d)
1254 1284 arg += 1
1255 1285 else:
1256 1286 raise util.Abort('unexpected revspec format character %s' % d)
1257 1287 else:
1258 1288 ret += c
1259 1289 pos += 1
1260 1290
1261 1291 return ret
1262 1292
1263 1293 # tell hggettext to extract docstrings from these functions:
1264 1294 i18nfunctions = symbols.values()
@@ -1,1530 +1,1534 b''
1 1 @ (34) head
2 2 |
3 3 | o (33) head
4 4 | |
5 5 o | (32) expand
6 6 |\ \
7 7 | o \ (31) expand
8 8 | |\ \
9 9 | | o \ (30) expand
10 10 | | |\ \
11 11 | | | o | (29) regular commit
12 12 | | | | |
13 13 | | o | | (28) merge zero known
14 14 | | |\ \ \
15 15 o | | | | | (27) collapse
16 16 |/ / / / /
17 17 | | o---+ (26) merge one known; far right
18 18 | | | | |
19 19 +---o | | (25) merge one known; far left
20 20 | | | | |
21 21 | | o | | (24) merge one known; immediate right
22 22 | | |\| |
23 23 | | o | | (23) merge one known; immediate left
24 24 | |/| | |
25 25 +---o---+ (22) merge two known; one far left, one far right
26 26 | | / /
27 27 o | | | (21) expand
28 28 |\ \ \ \
29 29 | o---+-+ (20) merge two known; two far right
30 30 | / / /
31 31 o | | | (19) expand
32 32 |\ \ \ \
33 33 +---+---o (18) merge two known; two far left
34 34 | | | |
35 35 | o | | (17) expand
36 36 | |\ \ \
37 37 | | o---+ (16) merge two known; one immediate right, one near right
38 38 | | |/ /
39 39 o | | | (15) expand
40 40 |\ \ \ \
41 41 | o-----+ (14) merge two known; one immediate right, one far right
42 42 | |/ / /
43 43 o | | | (13) expand
44 44 |\ \ \ \
45 45 +---o | | (12) merge two known; one immediate right, one far left
46 46 | | |/ /
47 47 | o | | (11) expand
48 48 | |\ \ \
49 49 | | o---+ (10) merge two known; one immediate left, one near right
50 50 | |/ / /
51 51 o | | | (9) expand
52 52 |\ \ \ \
53 53 | o-----+ (8) merge two known; one immediate left, one far right
54 54 |/ / / /
55 55 o | | | (7) expand
56 56 |\ \ \ \
57 57 +---o | | (6) merge two known; one immediate left, one far left
58 58 | |/ / /
59 59 | o | | (5) expand
60 60 | |\ \ \
61 61 | | o | | (4) merge two known; one immediate left, one immediate right
62 62 | |/|/ /
63 63 | o / / (3) collapse
64 64 |/ / /
65 65 o / / (2) collapse
66 66 |/ /
67 67 o / (1) collapse
68 68 |/
69 69 o (0) root
70 70
71 71
72 72 $ "$TESTDIR/hghave" no-outer-repo || exit 80
73 73
74 74 $ commit()
75 75 > {
76 76 > rev=$1
77 77 > msg=$2
78 78 > shift 2
79 79 > if [ "$#" -gt 0 ]; then
80 80 > hg debugsetparents "$@"
81 81 > fi
82 82 > echo $rev > a
83 83 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
84 84 > }
85 85
86 86 $ cat > printrevset.py <<EOF
87 87 > from mercurial import extensions, revset, commands
88 88 > from hgext import graphlog
89 89 >
90 90 > def uisetup(ui):
91 91 > def printrevset(orig, ui, repo, *pats, **opts):
92 92 > if opts.get('print_revset'):
93 93 > expr = graphlog.revset(repo, pats, opts)
94 94 > tree = revset.parse(expr)[0]
95 95 > ui.write(tree, "\n")
96 96 > return 0
97 97 > return orig(ui, repo, *pats, **opts)
98 98 > entry = extensions.wrapcommand(commands.table, 'log', printrevset)
99 99 > entry[1].append(('', 'print-revset', False,
100 100 > 'print generated revset and exit (DEPRECATED)'))
101 101 > EOF
102 102
103 103 $ echo "[extensions]" >> $HGRCPATH
104 104 $ echo "graphlog=" >> $HGRCPATH
105 105 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
106 106
107 107 $ hg init repo
108 108 $ cd repo
109 109
110 110 Empty repo:
111 111
112 112 $ hg glog
113 113
114 114
115 115 Building DAG:
116 116
117 117 $ commit 0 "root"
118 118 $ commit 1 "collapse" 0
119 119 $ commit 2 "collapse" 1
120 120 $ commit 3 "collapse" 2
121 121 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
122 122 $ commit 5 "expand" 3 4
123 123 $ commit 6 "merge two known; one immediate left, one far left" 2 5
124 124 $ commit 7 "expand" 2 5
125 125 $ commit 8 "merge two known; one immediate left, one far right" 0 7
126 126 $ commit 9 "expand" 7 8
127 127 $ commit 10 "merge two known; one immediate left, one near right" 0 6
128 128 $ commit 11 "expand" 6 10
129 129 $ commit 12 "merge two known; one immediate right, one far left" 1 9
130 130 $ commit 13 "expand" 9 11
131 131 $ commit 14 "merge two known; one immediate right, one far right" 0 12
132 132 $ commit 15 "expand" 13 14
133 133 $ commit 16 "merge two known; one immediate right, one near right" 0 1
134 134 $ commit 17 "expand" 12 16
135 135 $ commit 18 "merge two known; two far left" 1 15
136 136 $ commit 19 "expand" 15 17
137 137 $ commit 20 "merge two known; two far right" 0 18
138 138 $ commit 21 "expand" 19 20
139 139 $ commit 22 "merge two known; one far left, one far right" 18 21
140 140 $ commit 23 "merge one known; immediate left" 1 22
141 141 $ commit 24 "merge one known; immediate right" 0 23
142 142 $ commit 25 "merge one known; far left" 21 24
143 143 $ commit 26 "merge one known; far right" 18 25
144 144 $ commit 27 "collapse" 21
145 145 $ commit 28 "merge zero known" 1 26
146 146 $ commit 29 "regular commit" 0
147 147 $ commit 30 "expand" 28 29
148 148 $ commit 31 "expand" 21 30
149 149 $ commit 32 "expand" 27 31
150 150 $ commit 33 "head" 18
151 151 $ commit 34 "head" 32
152 152
153 153
154 154 $ hg glog -q
155 155 @ 34:fea3ac5810e0
156 156 |
157 157 | o 33:68608f5145f9
158 158 | |
159 159 o | 32:d06dffa21a31
160 160 |\ \
161 161 | o \ 31:621d83e11f67
162 162 | |\ \
163 163 | | o \ 30:6e11cd4b648f
164 164 | | |\ \
165 165 | | | o | 29:cd9bb2be7593
166 166 | | | | |
167 167 | | o | | 28:44ecd0b9ae99
168 168 | | |\ \ \
169 169 o | | | | | 27:886ed638191b
170 170 |/ / / / /
171 171 | | o---+ 26:7f25b6c2f0b9
172 172 | | | | |
173 173 +---o | | 25:91da8ed57247
174 174 | | | | |
175 175 | | o | | 24:a9c19a3d96b7
176 176 | | |\| |
177 177 | | o | | 23:a01cddf0766d
178 178 | |/| | |
179 179 +---o---+ 22:e0d9cccacb5d
180 180 | | / /
181 181 o | | | 21:d42a756af44d
182 182 |\ \ \ \
183 183 | o---+-+ 20:d30ed6450e32
184 184 | / / /
185 185 o | | | 19:31ddc2c1573b
186 186 |\ \ \ \
187 187 +---+---o 18:1aa84d96232a
188 188 | | | |
189 189 | o | | 17:44765d7c06e0
190 190 | |\ \ \
191 191 | | o---+ 16:3677d192927d
192 192 | | |/ /
193 193 o | | | 15:1dda3f72782d
194 194 |\ \ \ \
195 195 | o-----+ 14:8eac370358ef
196 196 | |/ / /
197 197 o | | | 13:22d8966a97e3
198 198 |\ \ \ \
199 199 +---o | | 12:86b91144a6e9
200 200 | | |/ /
201 201 | o | | 11:832d76e6bdf2
202 202 | |\ \ \
203 203 | | o---+ 10:74c64d036d72
204 204 | |/ / /
205 205 o | | | 9:7010c0af0a35
206 206 |\ \ \ \
207 207 | o-----+ 8:7a0b11f71937
208 208 |/ / / /
209 209 o | | | 7:b632bb1b1224
210 210 |\ \ \ \
211 211 +---o | | 6:b105a072e251
212 212 | |/ / /
213 213 | o | | 5:4409d547b708
214 214 | |\ \ \
215 215 | | o | | 4:26a8bac39d9f
216 216 | |/|/ /
217 217 | o / / 3:27eef8ed80b4
218 218 |/ / /
219 219 o / / 2:3d9a33b8d1e1
220 220 |/ /
221 221 o / 1:6db2ef61d156
222 222 |/
223 223 o 0:e6eb3150255d
224 224
225 225
226 226 $ hg glog
227 227 @ changeset: 34:fea3ac5810e0
228 228 | tag: tip
229 229 | parent: 32:d06dffa21a31
230 230 | user: test
231 231 | date: Thu Jan 01 00:00:34 1970 +0000
232 232 | summary: (34) head
233 233 |
234 234 | o changeset: 33:68608f5145f9
235 235 | | parent: 18:1aa84d96232a
236 236 | | user: test
237 237 | | date: Thu Jan 01 00:00:33 1970 +0000
238 238 | | summary: (33) head
239 239 | |
240 240 o | changeset: 32:d06dffa21a31
241 241 |\ \ parent: 27:886ed638191b
242 242 | | | parent: 31:621d83e11f67
243 243 | | | user: test
244 244 | | | date: Thu Jan 01 00:00:32 1970 +0000
245 245 | | | summary: (32) expand
246 246 | | |
247 247 | o | changeset: 31:621d83e11f67
248 248 | |\ \ parent: 21:d42a756af44d
249 249 | | | | parent: 30:6e11cd4b648f
250 250 | | | | user: test
251 251 | | | | date: Thu Jan 01 00:00:31 1970 +0000
252 252 | | | | summary: (31) expand
253 253 | | | |
254 254 | | o | changeset: 30:6e11cd4b648f
255 255 | | |\ \ parent: 28:44ecd0b9ae99
256 256 | | | | | parent: 29:cd9bb2be7593
257 257 | | | | | user: test
258 258 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
259 259 | | | | | summary: (30) expand
260 260 | | | | |
261 261 | | | o | changeset: 29:cd9bb2be7593
262 262 | | | | | parent: 0:e6eb3150255d
263 263 | | | | | user: test
264 264 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
265 265 | | | | | summary: (29) regular commit
266 266 | | | | |
267 267 | | o | | changeset: 28:44ecd0b9ae99
268 268 | | |\ \ \ parent: 1:6db2ef61d156
269 269 | | | | | | parent: 26:7f25b6c2f0b9
270 270 | | | | | | user: test
271 271 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
272 272 | | | | | | summary: (28) merge zero known
273 273 | | | | | |
274 274 o | | | | | changeset: 27:886ed638191b
275 275 |/ / / / / parent: 21:d42a756af44d
276 276 | | | | | user: test
277 277 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
278 278 | | | | | summary: (27) collapse
279 279 | | | | |
280 280 | | o---+ changeset: 26:7f25b6c2f0b9
281 281 | | | | | parent: 18:1aa84d96232a
282 282 | | | | | parent: 25:91da8ed57247
283 283 | | | | | user: test
284 284 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
285 285 | | | | | summary: (26) merge one known; far right
286 286 | | | | |
287 287 +---o | | changeset: 25:91da8ed57247
288 288 | | | | | parent: 21:d42a756af44d
289 289 | | | | | parent: 24:a9c19a3d96b7
290 290 | | | | | user: test
291 291 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
292 292 | | | | | summary: (25) merge one known; far left
293 293 | | | | |
294 294 | | o | | changeset: 24:a9c19a3d96b7
295 295 | | |\| | parent: 0:e6eb3150255d
296 296 | | | | | parent: 23:a01cddf0766d
297 297 | | | | | user: test
298 298 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
299 299 | | | | | summary: (24) merge one known; immediate right
300 300 | | | | |
301 301 | | o | | changeset: 23:a01cddf0766d
302 302 | |/| | | parent: 1:6db2ef61d156
303 303 | | | | | parent: 22:e0d9cccacb5d
304 304 | | | | | user: test
305 305 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
306 306 | | | | | summary: (23) merge one known; immediate left
307 307 | | | | |
308 308 +---o---+ changeset: 22:e0d9cccacb5d
309 309 | | | | parent: 18:1aa84d96232a
310 310 | | / / parent: 21:d42a756af44d
311 311 | | | | user: test
312 312 | | | | date: Thu Jan 01 00:00:22 1970 +0000
313 313 | | | | summary: (22) merge two known; one far left, one far right
314 314 | | | |
315 315 o | | | changeset: 21:d42a756af44d
316 316 |\ \ \ \ parent: 19:31ddc2c1573b
317 317 | | | | | parent: 20:d30ed6450e32
318 318 | | | | | user: test
319 319 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
320 320 | | | | | summary: (21) expand
321 321 | | | | |
322 322 | o---+-+ changeset: 20:d30ed6450e32
323 323 | | | | parent: 0:e6eb3150255d
324 324 | / / / parent: 18:1aa84d96232a
325 325 | | | | user: test
326 326 | | | | date: Thu Jan 01 00:00:20 1970 +0000
327 327 | | | | summary: (20) merge two known; two far right
328 328 | | | |
329 329 o | | | changeset: 19:31ddc2c1573b
330 330 |\ \ \ \ parent: 15:1dda3f72782d
331 331 | | | | | parent: 17:44765d7c06e0
332 332 | | | | | user: test
333 333 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
334 334 | | | | | summary: (19) expand
335 335 | | | | |
336 336 +---+---o changeset: 18:1aa84d96232a
337 337 | | | | parent: 1:6db2ef61d156
338 338 | | | | parent: 15:1dda3f72782d
339 339 | | | | user: test
340 340 | | | | date: Thu Jan 01 00:00:18 1970 +0000
341 341 | | | | summary: (18) merge two known; two far left
342 342 | | | |
343 343 | o | | changeset: 17:44765d7c06e0
344 344 | |\ \ \ parent: 12:86b91144a6e9
345 345 | | | | | parent: 16:3677d192927d
346 346 | | | | | user: test
347 347 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
348 348 | | | | | summary: (17) expand
349 349 | | | | |
350 350 | | o---+ changeset: 16:3677d192927d
351 351 | | | | | parent: 0:e6eb3150255d
352 352 | | |/ / parent: 1:6db2ef61d156
353 353 | | | | user: test
354 354 | | | | date: Thu Jan 01 00:00:16 1970 +0000
355 355 | | | | summary: (16) merge two known; one immediate right, one near right
356 356 | | | |
357 357 o | | | changeset: 15:1dda3f72782d
358 358 |\ \ \ \ parent: 13:22d8966a97e3
359 359 | | | | | parent: 14:8eac370358ef
360 360 | | | | | user: test
361 361 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
362 362 | | | | | summary: (15) expand
363 363 | | | | |
364 364 | o-----+ changeset: 14:8eac370358ef
365 365 | | | | | parent: 0:e6eb3150255d
366 366 | |/ / / parent: 12:86b91144a6e9
367 367 | | | | user: test
368 368 | | | | date: Thu Jan 01 00:00:14 1970 +0000
369 369 | | | | summary: (14) merge two known; one immediate right, one far right
370 370 | | | |
371 371 o | | | changeset: 13:22d8966a97e3
372 372 |\ \ \ \ parent: 9:7010c0af0a35
373 373 | | | | | parent: 11:832d76e6bdf2
374 374 | | | | | user: test
375 375 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
376 376 | | | | | summary: (13) expand
377 377 | | | | |
378 378 +---o | | changeset: 12:86b91144a6e9
379 379 | | |/ / parent: 1:6db2ef61d156
380 380 | | | | parent: 9:7010c0af0a35
381 381 | | | | user: test
382 382 | | | | date: Thu Jan 01 00:00:12 1970 +0000
383 383 | | | | summary: (12) merge two known; one immediate right, one far left
384 384 | | | |
385 385 | o | | changeset: 11:832d76e6bdf2
386 386 | |\ \ \ parent: 6:b105a072e251
387 387 | | | | | parent: 10:74c64d036d72
388 388 | | | | | user: test
389 389 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
390 390 | | | | | summary: (11) expand
391 391 | | | | |
392 392 | | o---+ changeset: 10:74c64d036d72
393 393 | | | | | parent: 0:e6eb3150255d
394 394 | |/ / / parent: 6:b105a072e251
395 395 | | | | user: test
396 396 | | | | date: Thu Jan 01 00:00:10 1970 +0000
397 397 | | | | summary: (10) merge two known; one immediate left, one near right
398 398 | | | |
399 399 o | | | changeset: 9:7010c0af0a35
400 400 |\ \ \ \ parent: 7:b632bb1b1224
401 401 | | | | | parent: 8:7a0b11f71937
402 402 | | | | | user: test
403 403 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
404 404 | | | | | summary: (9) expand
405 405 | | | | |
406 406 | o-----+ changeset: 8:7a0b11f71937
407 407 | | | | | parent: 0:e6eb3150255d
408 408 |/ / / / parent: 7:b632bb1b1224
409 409 | | | | user: test
410 410 | | | | date: Thu Jan 01 00:00:08 1970 +0000
411 411 | | | | summary: (8) merge two known; one immediate left, one far right
412 412 | | | |
413 413 o | | | changeset: 7:b632bb1b1224
414 414 |\ \ \ \ parent: 2:3d9a33b8d1e1
415 415 | | | | | parent: 5:4409d547b708
416 416 | | | | | user: test
417 417 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
418 418 | | | | | summary: (7) expand
419 419 | | | | |
420 420 +---o | | changeset: 6:b105a072e251
421 421 | |/ / / parent: 2:3d9a33b8d1e1
422 422 | | | | parent: 5:4409d547b708
423 423 | | | | user: test
424 424 | | | | date: Thu Jan 01 00:00:06 1970 +0000
425 425 | | | | summary: (6) merge two known; one immediate left, one far left
426 426 | | | |
427 427 | o | | changeset: 5:4409d547b708
428 428 | |\ \ \ parent: 3:27eef8ed80b4
429 429 | | | | | parent: 4:26a8bac39d9f
430 430 | | | | | user: test
431 431 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
432 432 | | | | | summary: (5) expand
433 433 | | | | |
434 434 | | o | | changeset: 4:26a8bac39d9f
435 435 | |/|/ / parent: 1:6db2ef61d156
436 436 | | | | parent: 3:27eef8ed80b4
437 437 | | | | user: test
438 438 | | | | date: Thu Jan 01 00:00:04 1970 +0000
439 439 | | | | summary: (4) merge two known; one immediate left, one immediate right
440 440 | | | |
441 441 | o | | changeset: 3:27eef8ed80b4
442 442 |/ / / user: test
443 443 | | | date: Thu Jan 01 00:00:03 1970 +0000
444 444 | | | summary: (3) collapse
445 445 | | |
446 446 o | | changeset: 2:3d9a33b8d1e1
447 447 |/ / user: test
448 448 | | date: Thu Jan 01 00:00:02 1970 +0000
449 449 | | summary: (2) collapse
450 450 | |
451 451 o | changeset: 1:6db2ef61d156
452 452 |/ user: test
453 453 | date: Thu Jan 01 00:00:01 1970 +0000
454 454 | summary: (1) collapse
455 455 |
456 456 o changeset: 0:e6eb3150255d
457 457 user: test
458 458 date: Thu Jan 01 00:00:00 1970 +0000
459 459 summary: (0) root
460 460
461 461
462 462 File glog:
463 463 $ hg glog a
464 464 @ changeset: 34:fea3ac5810e0
465 465 | tag: tip
466 466 | parent: 32:d06dffa21a31
467 467 | user: test
468 468 | date: Thu Jan 01 00:00:34 1970 +0000
469 469 | summary: (34) head
470 470 |
471 471 | o changeset: 33:68608f5145f9
472 472 | | parent: 18:1aa84d96232a
473 473 | | user: test
474 474 | | date: Thu Jan 01 00:00:33 1970 +0000
475 475 | | summary: (33) head
476 476 | |
477 477 o | changeset: 32:d06dffa21a31
478 478 |\ \ parent: 27:886ed638191b
479 479 | | | parent: 31:621d83e11f67
480 480 | | | user: test
481 481 | | | date: Thu Jan 01 00:00:32 1970 +0000
482 482 | | | summary: (32) expand
483 483 | | |
484 484 | o | changeset: 31:621d83e11f67
485 485 | |\ \ parent: 21:d42a756af44d
486 486 | | | | parent: 30:6e11cd4b648f
487 487 | | | | user: test
488 488 | | | | date: Thu Jan 01 00:00:31 1970 +0000
489 489 | | | | summary: (31) expand
490 490 | | | |
491 491 | | o | changeset: 30:6e11cd4b648f
492 492 | | |\ \ parent: 28:44ecd0b9ae99
493 493 | | | | | parent: 29:cd9bb2be7593
494 494 | | | | | user: test
495 495 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
496 496 | | | | | summary: (30) expand
497 497 | | | | |
498 498 | | | o | changeset: 29:cd9bb2be7593
499 499 | | | | | parent: 0:e6eb3150255d
500 500 | | | | | user: test
501 501 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
502 502 | | | | | summary: (29) regular commit
503 503 | | | | |
504 504 | | o | | changeset: 28:44ecd0b9ae99
505 505 | | |\ \ \ parent: 1:6db2ef61d156
506 506 | | | | | | parent: 26:7f25b6c2f0b9
507 507 | | | | | | user: test
508 508 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
509 509 | | | | | | summary: (28) merge zero known
510 510 | | | | | |
511 511 o | | | | | changeset: 27:886ed638191b
512 512 |/ / / / / parent: 21:d42a756af44d
513 513 | | | | | user: test
514 514 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
515 515 | | | | | summary: (27) collapse
516 516 | | | | |
517 517 | | o---+ changeset: 26:7f25b6c2f0b9
518 518 | | | | | parent: 18:1aa84d96232a
519 519 | | | | | parent: 25:91da8ed57247
520 520 | | | | | user: test
521 521 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
522 522 | | | | | summary: (26) merge one known; far right
523 523 | | | | |
524 524 +---o | | changeset: 25:91da8ed57247
525 525 | | | | | parent: 21:d42a756af44d
526 526 | | | | | parent: 24:a9c19a3d96b7
527 527 | | | | | user: test
528 528 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
529 529 | | | | | summary: (25) merge one known; far left
530 530 | | | | |
531 531 | | o | | changeset: 24:a9c19a3d96b7
532 532 | | |\| | parent: 0:e6eb3150255d
533 533 | | | | | parent: 23:a01cddf0766d
534 534 | | | | | user: test
535 535 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
536 536 | | | | | summary: (24) merge one known; immediate right
537 537 | | | | |
538 538 | | o | | changeset: 23:a01cddf0766d
539 539 | |/| | | parent: 1:6db2ef61d156
540 540 | | | | | parent: 22:e0d9cccacb5d
541 541 | | | | | user: test
542 542 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
543 543 | | | | | summary: (23) merge one known; immediate left
544 544 | | | | |
545 545 +---o---+ changeset: 22:e0d9cccacb5d
546 546 | | | | parent: 18:1aa84d96232a
547 547 | | / / parent: 21:d42a756af44d
548 548 | | | | user: test
549 549 | | | | date: Thu Jan 01 00:00:22 1970 +0000
550 550 | | | | summary: (22) merge two known; one far left, one far right
551 551 | | | |
552 552 o | | | changeset: 21:d42a756af44d
553 553 |\ \ \ \ parent: 19:31ddc2c1573b
554 554 | | | | | parent: 20:d30ed6450e32
555 555 | | | | | user: test
556 556 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
557 557 | | | | | summary: (21) expand
558 558 | | | | |
559 559 | o---+-+ changeset: 20:d30ed6450e32
560 560 | | | | parent: 0:e6eb3150255d
561 561 | / / / parent: 18:1aa84d96232a
562 562 | | | | user: test
563 563 | | | | date: Thu Jan 01 00:00:20 1970 +0000
564 564 | | | | summary: (20) merge two known; two far right
565 565 | | | |
566 566 o | | | changeset: 19:31ddc2c1573b
567 567 |\ \ \ \ parent: 15:1dda3f72782d
568 568 | | | | | parent: 17:44765d7c06e0
569 569 | | | | | user: test
570 570 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
571 571 | | | | | summary: (19) expand
572 572 | | | | |
573 573 +---+---o changeset: 18:1aa84d96232a
574 574 | | | | parent: 1:6db2ef61d156
575 575 | | | | parent: 15:1dda3f72782d
576 576 | | | | user: test
577 577 | | | | date: Thu Jan 01 00:00:18 1970 +0000
578 578 | | | | summary: (18) merge two known; two far left
579 579 | | | |
580 580 | o | | changeset: 17:44765d7c06e0
581 581 | |\ \ \ parent: 12:86b91144a6e9
582 582 | | | | | parent: 16:3677d192927d
583 583 | | | | | user: test
584 584 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
585 585 | | | | | summary: (17) expand
586 586 | | | | |
587 587 | | o---+ changeset: 16:3677d192927d
588 588 | | | | | parent: 0:e6eb3150255d
589 589 | | |/ / parent: 1:6db2ef61d156
590 590 | | | | user: test
591 591 | | | | date: Thu Jan 01 00:00:16 1970 +0000
592 592 | | | | summary: (16) merge two known; one immediate right, one near right
593 593 | | | |
594 594 o | | | changeset: 15:1dda3f72782d
595 595 |\ \ \ \ parent: 13:22d8966a97e3
596 596 | | | | | parent: 14:8eac370358ef
597 597 | | | | | user: test
598 598 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
599 599 | | | | | summary: (15) expand
600 600 | | | | |
601 601 | o-----+ changeset: 14:8eac370358ef
602 602 | | | | | parent: 0:e6eb3150255d
603 603 | |/ / / parent: 12:86b91144a6e9
604 604 | | | | user: test
605 605 | | | | date: Thu Jan 01 00:00:14 1970 +0000
606 606 | | | | summary: (14) merge two known; one immediate right, one far right
607 607 | | | |
608 608 o | | | changeset: 13:22d8966a97e3
609 609 |\ \ \ \ parent: 9:7010c0af0a35
610 610 | | | | | parent: 11:832d76e6bdf2
611 611 | | | | | user: test
612 612 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
613 613 | | | | | summary: (13) expand
614 614 | | | | |
615 615 +---o | | changeset: 12:86b91144a6e9
616 616 | | |/ / parent: 1:6db2ef61d156
617 617 | | | | parent: 9:7010c0af0a35
618 618 | | | | user: test
619 619 | | | | date: Thu Jan 01 00:00:12 1970 +0000
620 620 | | | | summary: (12) merge two known; one immediate right, one far left
621 621 | | | |
622 622 | o | | changeset: 11:832d76e6bdf2
623 623 | |\ \ \ parent: 6:b105a072e251
624 624 | | | | | parent: 10:74c64d036d72
625 625 | | | | | user: test
626 626 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
627 627 | | | | | summary: (11) expand
628 628 | | | | |
629 629 | | o---+ changeset: 10:74c64d036d72
630 630 | | | | | parent: 0:e6eb3150255d
631 631 | |/ / / parent: 6:b105a072e251
632 632 | | | | user: test
633 633 | | | | date: Thu Jan 01 00:00:10 1970 +0000
634 634 | | | | summary: (10) merge two known; one immediate left, one near right
635 635 | | | |
636 636 o | | | changeset: 9:7010c0af0a35
637 637 |\ \ \ \ parent: 7:b632bb1b1224
638 638 | | | | | parent: 8:7a0b11f71937
639 639 | | | | | user: test
640 640 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
641 641 | | | | | summary: (9) expand
642 642 | | | | |
643 643 | o-----+ changeset: 8:7a0b11f71937
644 644 | | | | | parent: 0:e6eb3150255d
645 645 |/ / / / parent: 7:b632bb1b1224
646 646 | | | | user: test
647 647 | | | | date: Thu Jan 01 00:00:08 1970 +0000
648 648 | | | | summary: (8) merge two known; one immediate left, one far right
649 649 | | | |
650 650 o | | | changeset: 7:b632bb1b1224
651 651 |\ \ \ \ parent: 2:3d9a33b8d1e1
652 652 | | | | | parent: 5:4409d547b708
653 653 | | | | | user: test
654 654 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
655 655 | | | | | summary: (7) expand
656 656 | | | | |
657 657 +---o | | changeset: 6:b105a072e251
658 658 | |/ / / parent: 2:3d9a33b8d1e1
659 659 | | | | parent: 5:4409d547b708
660 660 | | | | user: test
661 661 | | | | date: Thu Jan 01 00:00:06 1970 +0000
662 662 | | | | summary: (6) merge two known; one immediate left, one far left
663 663 | | | |
664 664 | o | | changeset: 5:4409d547b708
665 665 | |\ \ \ parent: 3:27eef8ed80b4
666 666 | | | | | parent: 4:26a8bac39d9f
667 667 | | | | | user: test
668 668 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
669 669 | | | | | summary: (5) expand
670 670 | | | | |
671 671 | | o | | changeset: 4:26a8bac39d9f
672 672 | |/|/ / parent: 1:6db2ef61d156
673 673 | | | | parent: 3:27eef8ed80b4
674 674 | | | | user: test
675 675 | | | | date: Thu Jan 01 00:00:04 1970 +0000
676 676 | | | | summary: (4) merge two known; one immediate left, one immediate right
677 677 | | | |
678 678 | o | | changeset: 3:27eef8ed80b4
679 679 |/ / / user: test
680 680 | | | date: Thu Jan 01 00:00:03 1970 +0000
681 681 | | | summary: (3) collapse
682 682 | | |
683 683 o | | changeset: 2:3d9a33b8d1e1
684 684 |/ / user: test
685 685 | | date: Thu Jan 01 00:00:02 1970 +0000
686 686 | | summary: (2) collapse
687 687 | |
688 688 o | changeset: 1:6db2ef61d156
689 689 |/ user: test
690 690 | date: Thu Jan 01 00:00:01 1970 +0000
691 691 | summary: (1) collapse
692 692 |
693 693 o changeset: 0:e6eb3150255d
694 694 user: test
695 695 date: Thu Jan 01 00:00:00 1970 +0000
696 696 summary: (0) root
697 697
698 698
699 699 File glog per revset:
700 700
701 701 $ hg glog -r 'file("a")'
702 702 @ changeset: 34:fea3ac5810e0
703 703 | tag: tip
704 704 | parent: 32:d06dffa21a31
705 705 | user: test
706 706 | date: Thu Jan 01 00:00:34 1970 +0000
707 707 | summary: (34) head
708 708 |
709 709 | o changeset: 33:68608f5145f9
710 710 | | parent: 18:1aa84d96232a
711 711 | | user: test
712 712 | | date: Thu Jan 01 00:00:33 1970 +0000
713 713 | | summary: (33) head
714 714 | |
715 715 o | changeset: 32:d06dffa21a31
716 716 |\ \ parent: 27:886ed638191b
717 717 | | | parent: 31:621d83e11f67
718 718 | | | user: test
719 719 | | | date: Thu Jan 01 00:00:32 1970 +0000
720 720 | | | summary: (32) expand
721 721 | | |
722 722 | o | changeset: 31:621d83e11f67
723 723 | |\ \ parent: 21:d42a756af44d
724 724 | | | | parent: 30:6e11cd4b648f
725 725 | | | | user: test
726 726 | | | | date: Thu Jan 01 00:00:31 1970 +0000
727 727 | | | | summary: (31) expand
728 728 | | | |
729 729 | | o | changeset: 30:6e11cd4b648f
730 730 | | |\ \ parent: 28:44ecd0b9ae99
731 731 | | | | | parent: 29:cd9bb2be7593
732 732 | | | | | user: test
733 733 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
734 734 | | | | | summary: (30) expand
735 735 | | | | |
736 736 | | | o | changeset: 29:cd9bb2be7593
737 737 | | | | | parent: 0:e6eb3150255d
738 738 | | | | | user: test
739 739 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
740 740 | | | | | summary: (29) regular commit
741 741 | | | | |
742 742 | | o | | changeset: 28:44ecd0b9ae99
743 743 | | |\ \ \ parent: 1:6db2ef61d156
744 744 | | | | | | parent: 26:7f25b6c2f0b9
745 745 | | | | | | user: test
746 746 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
747 747 | | | | | | summary: (28) merge zero known
748 748 | | | | | |
749 749 o | | | | | changeset: 27:886ed638191b
750 750 |/ / / / / parent: 21:d42a756af44d
751 751 | | | | | user: test
752 752 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
753 753 | | | | | summary: (27) collapse
754 754 | | | | |
755 755 | | o---+ changeset: 26:7f25b6c2f0b9
756 756 | | | | | parent: 18:1aa84d96232a
757 757 | | | | | parent: 25:91da8ed57247
758 758 | | | | | user: test
759 759 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
760 760 | | | | | summary: (26) merge one known; far right
761 761 | | | | |
762 762 +---o | | changeset: 25:91da8ed57247
763 763 | | | | | parent: 21:d42a756af44d
764 764 | | | | | parent: 24:a9c19a3d96b7
765 765 | | | | | user: test
766 766 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
767 767 | | | | | summary: (25) merge one known; far left
768 768 | | | | |
769 769 | | o | | changeset: 24:a9c19a3d96b7
770 770 | | |\| | parent: 0:e6eb3150255d
771 771 | | | | | parent: 23:a01cddf0766d
772 772 | | | | | user: test
773 773 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
774 774 | | | | | summary: (24) merge one known; immediate right
775 775 | | | | |
776 776 | | o | | changeset: 23:a01cddf0766d
777 777 | |/| | | parent: 1:6db2ef61d156
778 778 | | | | | parent: 22:e0d9cccacb5d
779 779 | | | | | user: test
780 780 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
781 781 | | | | | summary: (23) merge one known; immediate left
782 782 | | | | |
783 783 +---o---+ changeset: 22:e0d9cccacb5d
784 784 | | | | parent: 18:1aa84d96232a
785 785 | | / / parent: 21:d42a756af44d
786 786 | | | | user: test
787 787 | | | | date: Thu Jan 01 00:00:22 1970 +0000
788 788 | | | | summary: (22) merge two known; one far left, one far right
789 789 | | | |
790 790 o | | | changeset: 21:d42a756af44d
791 791 |\ \ \ \ parent: 19:31ddc2c1573b
792 792 | | | | | parent: 20:d30ed6450e32
793 793 | | | | | user: test
794 794 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
795 795 | | | | | summary: (21) expand
796 796 | | | | |
797 797 | o---+-+ changeset: 20:d30ed6450e32
798 798 | | | | parent: 0:e6eb3150255d
799 799 | / / / parent: 18:1aa84d96232a
800 800 | | | | user: test
801 801 | | | | date: Thu Jan 01 00:00:20 1970 +0000
802 802 | | | | summary: (20) merge two known; two far right
803 803 | | | |
804 804 o | | | changeset: 19:31ddc2c1573b
805 805 |\ \ \ \ parent: 15:1dda3f72782d
806 806 | | | | | parent: 17:44765d7c06e0
807 807 | | | | | user: test
808 808 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
809 809 | | | | | summary: (19) expand
810 810 | | | | |
811 811 +---+---o changeset: 18:1aa84d96232a
812 812 | | | | parent: 1:6db2ef61d156
813 813 | | | | parent: 15:1dda3f72782d
814 814 | | | | user: test
815 815 | | | | date: Thu Jan 01 00:00:18 1970 +0000
816 816 | | | | summary: (18) merge two known; two far left
817 817 | | | |
818 818 | o | | changeset: 17:44765d7c06e0
819 819 | |\ \ \ parent: 12:86b91144a6e9
820 820 | | | | | parent: 16:3677d192927d
821 821 | | | | | user: test
822 822 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
823 823 | | | | | summary: (17) expand
824 824 | | | | |
825 825 | | o---+ changeset: 16:3677d192927d
826 826 | | | | | parent: 0:e6eb3150255d
827 827 | | |/ / parent: 1:6db2ef61d156
828 828 | | | | user: test
829 829 | | | | date: Thu Jan 01 00:00:16 1970 +0000
830 830 | | | | summary: (16) merge two known; one immediate right, one near right
831 831 | | | |
832 832 o | | | changeset: 15:1dda3f72782d
833 833 |\ \ \ \ parent: 13:22d8966a97e3
834 834 | | | | | parent: 14:8eac370358ef
835 835 | | | | | user: test
836 836 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
837 837 | | | | | summary: (15) expand
838 838 | | | | |
839 839 | o-----+ changeset: 14:8eac370358ef
840 840 | | | | | parent: 0:e6eb3150255d
841 841 | |/ / / parent: 12:86b91144a6e9
842 842 | | | | user: test
843 843 | | | | date: Thu Jan 01 00:00:14 1970 +0000
844 844 | | | | summary: (14) merge two known; one immediate right, one far right
845 845 | | | |
846 846 o | | | changeset: 13:22d8966a97e3
847 847 |\ \ \ \ parent: 9:7010c0af0a35
848 848 | | | | | parent: 11:832d76e6bdf2
849 849 | | | | | user: test
850 850 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
851 851 | | | | | summary: (13) expand
852 852 | | | | |
853 853 +---o | | changeset: 12:86b91144a6e9
854 854 | | |/ / parent: 1:6db2ef61d156
855 855 | | | | parent: 9:7010c0af0a35
856 856 | | | | user: test
857 857 | | | | date: Thu Jan 01 00:00:12 1970 +0000
858 858 | | | | summary: (12) merge two known; one immediate right, one far left
859 859 | | | |
860 860 | o | | changeset: 11:832d76e6bdf2
861 861 | |\ \ \ parent: 6:b105a072e251
862 862 | | | | | parent: 10:74c64d036d72
863 863 | | | | | user: test
864 864 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
865 865 | | | | | summary: (11) expand
866 866 | | | | |
867 867 | | o---+ changeset: 10:74c64d036d72
868 868 | | | | | parent: 0:e6eb3150255d
869 869 | |/ / / parent: 6:b105a072e251
870 870 | | | | user: test
871 871 | | | | date: Thu Jan 01 00:00:10 1970 +0000
872 872 | | | | summary: (10) merge two known; one immediate left, one near right
873 873 | | | |
874 874 o | | | changeset: 9:7010c0af0a35
875 875 |\ \ \ \ parent: 7:b632bb1b1224
876 876 | | | | | parent: 8:7a0b11f71937
877 877 | | | | | user: test
878 878 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
879 879 | | | | | summary: (9) expand
880 880 | | | | |
881 881 | o-----+ changeset: 8:7a0b11f71937
882 882 | | | | | parent: 0:e6eb3150255d
883 883 |/ / / / parent: 7:b632bb1b1224
884 884 | | | | user: test
885 885 | | | | date: Thu Jan 01 00:00:08 1970 +0000
886 886 | | | | summary: (8) merge two known; one immediate left, one far right
887 887 | | | |
888 888 o | | | changeset: 7:b632bb1b1224
889 889 |\ \ \ \ parent: 2:3d9a33b8d1e1
890 890 | | | | | parent: 5:4409d547b708
891 891 | | | | | user: test
892 892 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
893 893 | | | | | summary: (7) expand
894 894 | | | | |
895 895 +---o | | changeset: 6:b105a072e251
896 896 | |/ / / parent: 2:3d9a33b8d1e1
897 897 | | | | parent: 5:4409d547b708
898 898 | | | | user: test
899 899 | | | | date: Thu Jan 01 00:00:06 1970 +0000
900 900 | | | | summary: (6) merge two known; one immediate left, one far left
901 901 | | | |
902 902 | o | | changeset: 5:4409d547b708
903 903 | |\ \ \ parent: 3:27eef8ed80b4
904 904 | | | | | parent: 4:26a8bac39d9f
905 905 | | | | | user: test
906 906 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
907 907 | | | | | summary: (5) expand
908 908 | | | | |
909 909 | | o | | changeset: 4:26a8bac39d9f
910 910 | |/|/ / parent: 1:6db2ef61d156
911 911 | | | | parent: 3:27eef8ed80b4
912 912 | | | | user: test
913 913 | | | | date: Thu Jan 01 00:00:04 1970 +0000
914 914 | | | | summary: (4) merge two known; one immediate left, one immediate right
915 915 | | | |
916 916 | o | | changeset: 3:27eef8ed80b4
917 917 |/ / / user: test
918 918 | | | date: Thu Jan 01 00:00:03 1970 +0000
919 919 | | | summary: (3) collapse
920 920 | | |
921 921 o | | changeset: 2:3d9a33b8d1e1
922 922 |/ / user: test
923 923 | | date: Thu Jan 01 00:00:02 1970 +0000
924 924 | | summary: (2) collapse
925 925 | |
926 926 o | changeset: 1:6db2ef61d156
927 927 |/ user: test
928 928 | date: Thu Jan 01 00:00:01 1970 +0000
929 929 | summary: (1) collapse
930 930 |
931 931 o changeset: 0:e6eb3150255d
932 932 user: test
933 933 date: Thu Jan 01 00:00:00 1970 +0000
934 934 summary: (0) root
935 935
936 936
937 937
938 938 File glog per revset (only merges):
939 939
940 940 $ hg log -G -r 'file("a")' -m
941 941 o changeset: 32:d06dffa21a31
942 942 |\ parent: 27:886ed638191b
943 943 | | parent: 31:621d83e11f67
944 944 | | user: test
945 945 | | date: Thu Jan 01 00:00:32 1970 +0000
946 946 | | summary: (32) expand
947 947 | |
948 948 o | changeset: 31:621d83e11f67
949 949 |\| parent: 21:d42a756af44d
950 950 | | parent: 30:6e11cd4b648f
951 951 | | user: test
952 952 | | date: Thu Jan 01 00:00:31 1970 +0000
953 953 | | summary: (31) expand
954 954 | |
955 955 o | changeset: 30:6e11cd4b648f
956 956 |\ \ parent: 28:44ecd0b9ae99
957 957 | | | parent: 29:cd9bb2be7593
958 958 | | | user: test
959 959 | | | date: Thu Jan 01 00:00:30 1970 +0000
960 960 | | | summary: (30) expand
961 961 | | |
962 962 o | | changeset: 28:44ecd0b9ae99
963 963 |\ \ \ parent: 1:6db2ef61d156
964 964 | | | | parent: 26:7f25b6c2f0b9
965 965 | | | | user: test
966 966 | | | | date: Thu Jan 01 00:00:28 1970 +0000
967 967 | | | | summary: (28) merge zero known
968 968 | | | |
969 969 o | | | changeset: 26:7f25b6c2f0b9
970 970 |\ \ \ \ parent: 18:1aa84d96232a
971 971 | | | | | parent: 25:91da8ed57247
972 972 | | | | | user: test
973 973 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
974 974 | | | | | summary: (26) merge one known; far right
975 975 | | | | |
976 976 | o-----+ changeset: 25:91da8ed57247
977 977 | | | | | parent: 21:d42a756af44d
978 978 | | | | | parent: 24:a9c19a3d96b7
979 979 | | | | | user: test
980 980 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
981 981 | | | | | summary: (25) merge one known; far left
982 982 | | | | |
983 983 | o | | | changeset: 24:a9c19a3d96b7
984 984 | |\ \ \ \ parent: 0:e6eb3150255d
985 985 | | | | | | parent: 23:a01cddf0766d
986 986 | | | | | | user: test
987 987 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
988 988 | | | | | | summary: (24) merge one known; immediate right
989 989 | | | | | |
990 990 | o---+ | | changeset: 23:a01cddf0766d
991 991 | | | | | | parent: 1:6db2ef61d156
992 992 | | | | | | parent: 22:e0d9cccacb5d
993 993 | | | | | | user: test
994 994 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
995 995 | | | | | | summary: (23) merge one known; immediate left
996 996 | | | | | |
997 997 | o-------+ changeset: 22:e0d9cccacb5d
998 998 | | | | | | parent: 18:1aa84d96232a
999 999 |/ / / / / parent: 21:d42a756af44d
1000 1000 | | | | | user: test
1001 1001 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
1002 1002 | | | | | summary: (22) merge two known; one far left, one far right
1003 1003 | | | | |
1004 1004 | | | | o changeset: 21:d42a756af44d
1005 1005 | | | | |\ parent: 19:31ddc2c1573b
1006 1006 | | | | | | parent: 20:d30ed6450e32
1007 1007 | | | | | | user: test
1008 1008 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
1009 1009 | | | | | | summary: (21) expand
1010 1010 | | | | | |
1011 1011 +-+-------o changeset: 20:d30ed6450e32
1012 1012 | | | | | parent: 0:e6eb3150255d
1013 1013 | | | | | parent: 18:1aa84d96232a
1014 1014 | | | | | user: test
1015 1015 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
1016 1016 | | | | | summary: (20) merge two known; two far right
1017 1017 | | | | |
1018 1018 | | | | o changeset: 19:31ddc2c1573b
1019 1019 | | | | |\ parent: 15:1dda3f72782d
1020 1020 | | | | | | parent: 17:44765d7c06e0
1021 1021 | | | | | | user: test
1022 1022 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
1023 1023 | | | | | | summary: (19) expand
1024 1024 | | | | | |
1025 1025 o---+---+ | changeset: 18:1aa84d96232a
1026 1026 | | | | | parent: 1:6db2ef61d156
1027 1027 / / / / / parent: 15:1dda3f72782d
1028 1028 | | | | | user: test
1029 1029 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
1030 1030 | | | | | summary: (18) merge two known; two far left
1031 1031 | | | | |
1032 1032 | | | | o changeset: 17:44765d7c06e0
1033 1033 | | | | |\ parent: 12:86b91144a6e9
1034 1034 | | | | | | parent: 16:3677d192927d
1035 1035 | | | | | | user: test
1036 1036 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
1037 1037 | | | | | | summary: (17) expand
1038 1038 | | | | | |
1039 1039 +-+-------o changeset: 16:3677d192927d
1040 1040 | | | | | parent: 0:e6eb3150255d
1041 1041 | | | | | parent: 1:6db2ef61d156
1042 1042 | | | | | user: test
1043 1043 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
1044 1044 | | | | | summary: (16) merge two known; one immediate right, one near right
1045 1045 | | | | |
1046 1046 | | | o | changeset: 15:1dda3f72782d
1047 1047 | | | |\ \ parent: 13:22d8966a97e3
1048 1048 | | | | | | parent: 14:8eac370358ef
1049 1049 | | | | | | user: test
1050 1050 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
1051 1051 | | | | | | summary: (15) expand
1052 1052 | | | | | |
1053 1053 +-------o | changeset: 14:8eac370358ef
1054 1054 | | | | |/ parent: 0:e6eb3150255d
1055 1055 | | | | | parent: 12:86b91144a6e9
1056 1056 | | | | | user: test
1057 1057 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
1058 1058 | | | | | summary: (14) merge two known; one immediate right, one far right
1059 1059 | | | | |
1060 1060 | | | o | changeset: 13:22d8966a97e3
1061 1061 | | | |\ \ parent: 9:7010c0af0a35
1062 1062 | | | | | | parent: 11:832d76e6bdf2
1063 1063 | | | | | | user: test
1064 1064 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
1065 1065 | | | | | | summary: (13) expand
1066 1066 | | | | | |
1067 1067 | +---+---o changeset: 12:86b91144a6e9
1068 1068 | | | | | parent: 1:6db2ef61d156
1069 1069 | | | | | parent: 9:7010c0af0a35
1070 1070 | | | | | user: test
1071 1071 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
1072 1072 | | | | | summary: (12) merge two known; one immediate right, one far left
1073 1073 | | | | |
1074 1074 | | | | o changeset: 11:832d76e6bdf2
1075 1075 | | | | |\ parent: 6:b105a072e251
1076 1076 | | | | | | parent: 10:74c64d036d72
1077 1077 | | | | | | user: test
1078 1078 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
1079 1079 | | | | | | summary: (11) expand
1080 1080 | | | | | |
1081 1081 +---------o changeset: 10:74c64d036d72
1082 1082 | | | | |/ parent: 0:e6eb3150255d
1083 1083 | | | | | parent: 6:b105a072e251
1084 1084 | | | | | user: test
1085 1085 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
1086 1086 | | | | | summary: (10) merge two known; one immediate left, one near right
1087 1087 | | | | |
1088 1088 | | | o | changeset: 9:7010c0af0a35
1089 1089 | | | |\ \ parent: 7:b632bb1b1224
1090 1090 | | | | | | parent: 8:7a0b11f71937
1091 1091 | | | | | | user: test
1092 1092 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
1093 1093 | | | | | | summary: (9) expand
1094 1094 | | | | | |
1095 1095 +-------o | changeset: 8:7a0b11f71937
1096 1096 | | | |/ / parent: 0:e6eb3150255d
1097 1097 | | | | | parent: 7:b632bb1b1224
1098 1098 | | | | | user: test
1099 1099 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
1100 1100 | | | | | summary: (8) merge two known; one immediate left, one far right
1101 1101 | | | | |
1102 1102 | | | o | changeset: 7:b632bb1b1224
1103 1103 | | | |\ \ parent: 2:3d9a33b8d1e1
1104 1104 | | | | | | parent: 5:4409d547b708
1105 1105 | | | | | | user: test
1106 1106 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
1107 1107 | | | | | | summary: (7) expand
1108 1108 | | | | | |
1109 1109 | | | +---o changeset: 6:b105a072e251
1110 1110 | | | | |/ parent: 2:3d9a33b8d1e1
1111 1111 | | | | | parent: 5:4409d547b708
1112 1112 | | | | | user: test
1113 1113 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
1114 1114 | | | | | summary: (6) merge two known; one immediate left, one far left
1115 1115 | | | | |
1116 1116 | | | o | changeset: 5:4409d547b708
1117 1117 | | | |\ \ parent: 3:27eef8ed80b4
1118 1118 | | | | | | parent: 4:26a8bac39d9f
1119 1119 | | | | | | user: test
1120 1120 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
1121 1121 | | | | | | summary: (5) expand
1122 1122 | | | | | |
1123 1123 | +---o | | changeset: 4:26a8bac39d9f
1124 1124 | | | |/ / parent: 1:6db2ef61d156
1125 1125 | | | | | parent: 3:27eef8ed80b4
1126 1126 | | | | | user: test
1127 1127 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
1128 1128 | | | | | summary: (4) merge two known; one immediate left, one immediate right
1129 1129 | | | | |
1130 1130
1131 1131
1132 1132 Empty revision range - display nothing:
1133 1133 $ hg glog -r 1..0
1134 1134
1135 1135 From outer space:
1136 1136 $ cd ..
1137 1137 $ hg glog -l1 repo
1138 1138 @ changeset: 34:fea3ac5810e0
1139 1139 | tag: tip
1140 1140 | parent: 32:d06dffa21a31
1141 1141 | user: test
1142 1142 | date: Thu Jan 01 00:00:34 1970 +0000
1143 1143 | summary: (34) head
1144 1144 |
1145 1145 $ hg glog -l1 repo/a
1146 1146 @ changeset: 34:fea3ac5810e0
1147 1147 | tag: tip
1148 1148 | parent: 32:d06dffa21a31
1149 1149 | user: test
1150 1150 | date: Thu Jan 01 00:00:34 1970 +0000
1151 1151 | summary: (34) head
1152 1152 |
1153 1153 $ hg glog -l1 repo/missing
1154 1154
1155 1155 File log with revs != cset revs:
1156 1156 $ hg init flog
1157 1157 $ cd flog
1158 1158 $ echo one >one
1159 1159 $ hg add one
1160 1160 $ hg commit -mone
1161 1161 $ echo two >two
1162 1162 $ hg add two
1163 1163 $ hg commit -mtwo
1164 1164 $ echo more >two
1165 1165 $ hg commit -mmore
1166 1166 $ hg glog two
1167 1167 @ changeset: 2:12c28321755b
1168 1168 | tag: tip
1169 1169 | user: test
1170 1170 | date: Thu Jan 01 00:00:00 1970 +0000
1171 1171 | summary: more
1172 1172 |
1173 1173 o changeset: 1:5ac72c0599bf
1174 1174 | user: test
1175 1175 | date: Thu Jan 01 00:00:00 1970 +0000
1176 1176 | summary: two
1177 1177 |
1178 1178
1179 1179 Issue1896: File log with explicit style
1180 1180 $ hg glog --style=default one
1181 1181 o changeset: 0:3d578b4a1f53
1182 1182 user: test
1183 1183 date: Thu Jan 01 00:00:00 1970 +0000
1184 1184 summary: one
1185 1185
1186 1186 Issue2395: glog --style header and footer
1187 1187 $ hg glog --style=xml one
1188 1188 <?xml version="1.0"?>
1189 1189 <log>
1190 1190 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1191 1191 <author email="test">test</author>
1192 1192 <date>1970-01-01T00:00:00+00:00</date>
1193 1193 <msg xml:space="preserve">one</msg>
1194 1194 </logentry>
1195 1195 </log>
1196 1196
1197 1197 $ cd ..
1198 1198
1199 1199 Incoming and outgoing:
1200 1200
1201 1201 $ hg clone -U -r31 repo repo2
1202 1202 adding changesets
1203 1203 adding manifests
1204 1204 adding file changes
1205 1205 added 31 changesets with 31 changes to 1 files
1206 1206 $ cd repo2
1207 1207
1208 1208 $ hg incoming --graph ../repo
1209 1209 comparing with ../repo
1210 1210 searching for changes
1211 1211 o changeset: 34:fea3ac5810e0
1212 1212 | tag: tip
1213 1213 | parent: 32:d06dffa21a31
1214 1214 | user: test
1215 1215 | date: Thu Jan 01 00:00:34 1970 +0000
1216 1216 | summary: (34) head
1217 1217 |
1218 1218 | o changeset: 33:68608f5145f9
1219 1219 | parent: 18:1aa84d96232a
1220 1220 | user: test
1221 1221 | date: Thu Jan 01 00:00:33 1970 +0000
1222 1222 | summary: (33) head
1223 1223 |
1224 1224 o changeset: 32:d06dffa21a31
1225 1225 | parent: 27:886ed638191b
1226 1226 | parent: 31:621d83e11f67
1227 1227 | user: test
1228 1228 | date: Thu Jan 01 00:00:32 1970 +0000
1229 1229 | summary: (32) expand
1230 1230 |
1231 1231 o changeset: 27:886ed638191b
1232 1232 parent: 21:d42a756af44d
1233 1233 user: test
1234 1234 date: Thu Jan 01 00:00:27 1970 +0000
1235 1235 summary: (27) collapse
1236 1236
1237 1237 $ cd ..
1238 1238
1239 1239 $ hg -R repo outgoing --graph repo2
1240 1240 comparing with repo2
1241 1241 searching for changes
1242 1242 @ changeset: 34:fea3ac5810e0
1243 1243 | tag: tip
1244 1244 | parent: 32:d06dffa21a31
1245 1245 | user: test
1246 1246 | date: Thu Jan 01 00:00:34 1970 +0000
1247 1247 | summary: (34) head
1248 1248 |
1249 1249 | o changeset: 33:68608f5145f9
1250 1250 | parent: 18:1aa84d96232a
1251 1251 | user: test
1252 1252 | date: Thu Jan 01 00:00:33 1970 +0000
1253 1253 | summary: (33) head
1254 1254 |
1255 1255 o changeset: 32:d06dffa21a31
1256 1256 | parent: 27:886ed638191b
1257 1257 | parent: 31:621d83e11f67
1258 1258 | user: test
1259 1259 | date: Thu Jan 01 00:00:32 1970 +0000
1260 1260 | summary: (32) expand
1261 1261 |
1262 1262 o changeset: 27:886ed638191b
1263 1263 parent: 21:d42a756af44d
1264 1264 user: test
1265 1265 date: Thu Jan 01 00:00:27 1970 +0000
1266 1266 summary: (27) collapse
1267 1267
1268 1268
1269 1269 File + limit with revs != cset revs:
1270 1270 $ cd repo
1271 1271 $ touch b
1272 1272 $ hg ci -Aqm0
1273 1273 $ hg glog -l2 a
1274 1274 o changeset: 34:fea3ac5810e0
1275 1275 | parent: 32:d06dffa21a31
1276 1276 | user: test
1277 1277 | date: Thu Jan 01 00:00:34 1970 +0000
1278 1278 | summary: (34) head
1279 1279 |
1280 1280 | o changeset: 33:68608f5145f9
1281 1281 | | parent: 18:1aa84d96232a
1282 1282 | | user: test
1283 1283 | | date: Thu Jan 01 00:00:33 1970 +0000
1284 1284 | | summary: (33) head
1285 1285 | |
1286 1286
1287 1287 File + limit + -ra:b, (b - a) < limit:
1288 1288 $ hg glog -l3000 -r32:tip a
1289 1289 o changeset: 34:fea3ac5810e0
1290 1290 | parent: 32:d06dffa21a31
1291 1291 | user: test
1292 1292 | date: Thu Jan 01 00:00:34 1970 +0000
1293 1293 | summary: (34) head
1294 1294 |
1295 1295 | o changeset: 33:68608f5145f9
1296 1296 | | parent: 18:1aa84d96232a
1297 1297 | | user: test
1298 1298 | | date: Thu Jan 01 00:00:33 1970 +0000
1299 1299 | | summary: (33) head
1300 1300 | |
1301 1301 o | changeset: 32:d06dffa21a31
1302 1302 |\ \ parent: 27:886ed638191b
1303 1303 | | | parent: 31:621d83e11f67
1304 1304 | | | user: test
1305 1305 | | | date: Thu Jan 01 00:00:32 1970 +0000
1306 1306 | | | summary: (32) expand
1307 1307 | | |
1308 1308
1309 1309 Point out a common and an uncommon unshown parent
1310 1310
1311 1311 $ hg glog -r 'rev(8) or rev(9)'
1312 1312 o changeset: 9:7010c0af0a35
1313 1313 |\ parent: 7:b632bb1b1224
1314 1314 | | parent: 8:7a0b11f71937
1315 1315 | | user: test
1316 1316 | | date: Thu Jan 01 00:00:09 1970 +0000
1317 1317 | | summary: (9) expand
1318 1318 | |
1319 1319 o | changeset: 8:7a0b11f71937
1320 1320 |\| parent: 0:e6eb3150255d
1321 1321 | | parent: 7:b632bb1b1224
1322 1322 | | user: test
1323 1323 | | date: Thu Jan 01 00:00:08 1970 +0000
1324 1324 | | summary: (8) merge two known; one immediate left, one far right
1325 1325 | |
1326 1326
1327 1327 File + limit + -ra:b, b < tip:
1328 1328
1329 1329 $ hg glog -l1 -r32:34 a
1330 1330 o changeset: 34:fea3ac5810e0
1331 1331 | parent: 32:d06dffa21a31
1332 1332 | user: test
1333 1333 | date: Thu Jan 01 00:00:34 1970 +0000
1334 1334 | summary: (34) head
1335 1335 |
1336 1336
1337 1337 file(File) + limit + -ra:b, b < tip:
1338 1338
1339 1339 $ hg glog -l1 -r32:34 -r 'file("a")'
1340 1340 o changeset: 34:fea3ac5810e0
1341 1341 | parent: 32:d06dffa21a31
1342 1342 | user: test
1343 1343 | date: Thu Jan 01 00:00:34 1970 +0000
1344 1344 | summary: (34) head
1345 1345 |
1346 1346
1347 1347 limit(file(File) and a::b), b < tip:
1348 1348
1349 1349 $ hg glog -r 'limit(file("a") and 32::34, 1)'
1350 1350 o changeset: 32:d06dffa21a31
1351 1351 |\ parent: 27:886ed638191b
1352 1352 | | parent: 31:621d83e11f67
1353 1353 | | user: test
1354 1354 | | date: Thu Jan 01 00:00:32 1970 +0000
1355 1355 | | summary: (32) expand
1356 1356 | |
1357 1357
1358 1358 File + limit + -ra:b, b < tip:
1359 1359
1360 1360 $ hg glog -r 'limit(file("a") and 34::32, 1)'
1361 1361
1362 1362 File + limit + -ra:b, b < tip, (b - a) < limit:
1363 1363
1364 1364 $ hg glog -l10 -r33:34 a
1365 1365 o changeset: 34:fea3ac5810e0
1366 1366 | parent: 32:d06dffa21a31
1367 1367 | user: test
1368 1368 | date: Thu Jan 01 00:00:34 1970 +0000
1369 1369 | summary: (34) head
1370 1370 |
1371 1371 | o changeset: 33:68608f5145f9
1372 1372 | | parent: 18:1aa84d96232a
1373 1373 | | user: test
1374 1374 | | date: Thu Jan 01 00:00:33 1970 +0000
1375 1375 | | summary: (33) head
1376 1376 | |
1377 1377
1378 1378 Do not crash or produce strange graphs if history is buggy
1379 1379
1380 1380 $ hg branch branch
1381 1381 marked working directory as branch branch
1382 1382 (branches are permanent and global, did you want a bookmark?)
1383 1383 $ commit 36 "buggy merge: identical parents" 35 35
1384 1384 $ hg glog -l5
1385 1385 @ changeset: 36:08a19a744424
1386 1386 | branch: branch
1387 1387 | tag: tip
1388 1388 | parent: 35:9159c3644c5e
1389 1389 | parent: 35:9159c3644c5e
1390 1390 | user: test
1391 1391 | date: Thu Jan 01 00:00:36 1970 +0000
1392 1392 | summary: (36) buggy merge: identical parents
1393 1393 |
1394 1394 o changeset: 35:9159c3644c5e
1395 1395 | user: test
1396 1396 | date: Thu Jan 01 00:00:00 1970 +0000
1397 1397 | summary: 0
1398 1398 |
1399 1399 o changeset: 34:fea3ac5810e0
1400 1400 | parent: 32:d06dffa21a31
1401 1401 | user: test
1402 1402 | date: Thu Jan 01 00:00:34 1970 +0000
1403 1403 | summary: (34) head
1404 1404 |
1405 1405 | o changeset: 33:68608f5145f9
1406 1406 | | parent: 18:1aa84d96232a
1407 1407 | | user: test
1408 1408 | | date: Thu Jan 01 00:00:33 1970 +0000
1409 1409 | | summary: (33) head
1410 1410 | |
1411 1411 o | changeset: 32:d06dffa21a31
1412 1412 |\ \ parent: 27:886ed638191b
1413 1413 | | | parent: 31:621d83e11f67
1414 1414 | | | user: test
1415 1415 | | | date: Thu Jan 01 00:00:32 1970 +0000
1416 1416 | | | summary: (32) expand
1417 1417 | | |
1418 1418
1419 1419 Test log -G options
1420 1420
1421 1421 $ testlog() {
1422 1422 > hg log -G --print-revset "$@"
1423 1423 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1424 1424 > | sed 's/.*nodetag/nodetag/' > log.nodes
1425 1425 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1426 1426 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1427 1427 > diff -u log.nodes glog.nodes
1428 1428 > }
1429 1429
1430 1430 $ testlog -u test -u not-a-user
1431 1431 ('group', ('group', ('or', ('func', ('symbol', 'user'), ('string', 'test')), ('func', ('symbol', 'user'), ('string', 'not-a-user')))))
1432 1432 $ testlog -b not-a-branch
1433 1433 ('group', ('group', ('func', ('symbol', 'branch'), ('string', 'not-a-branch'))))
1434 1434 abort: unknown revision 'not-a-branch'!
1435 1435 abort: unknown revision 'not-a-branch'!
1436 1436 $ testlog -b default -b branch --only-branch branch
1437 1437 ('group', ('group', ('or', ('or', ('func', ('symbol', 'branch'), ('string', 'default')), ('func', ('symbol', 'branch'), ('string', 'branch'))), ('func', ('symbol', 'branch'), ('string', 'branch')))))
1438 1438 $ testlog -k expand -k merge
1439 1439 ('group', ('group', ('or', ('func', ('symbol', 'keyword'), ('string', 'expand')), ('func', ('symbol', 'keyword'), ('string', 'merge')))))
1440 $ hg log -G --include 'some file' --exclude 'another file'
1441 1440 $ hg log -G --follow --template 'nodetag {rev}\n' | grep nodetag | wc -l
1442 1441 \s*36 (re)
1443 1442 $ hg log -G --removed --template 'nodetag {rev}\n' | grep nodetag | wc -l
1444 1443 \s*0 (re)
1445 1444 $ hg log -G --only-merges --template 'nodetag {rev}\n' | grep nodetag | wc -l
1446 1445 \s*28 (re)
1447 1446 $ hg log -G --no-merges --template 'nodetag {rev}\n'
1448 1447 o nodetag 35
1449 1448 |
1450 1449 o nodetag 34
1451 1450 |\
1452 1451 | \
1453 1452 | |\
1454 1453 | | \
1455 1454 | | |\
1456 1455 | | | \
1457 1456 | | | |\
1458 1457 | | | | \
1459 1458 | | | | |\
1460 1459 +-+-+-+-----o nodetag 33
1461 1460 | | | | | |
1462 1461 +---------o nodetag 29
1463 1462 | | | | |
1464 1463 +-+-+---o nodetag 27
1465 1464 | | | |/
1466 1465 | | | o nodetag 3
1467 1466 | | |/
1468 1467 | | o nodetag 2
1469 1468 | |/
1470 1469 | o nodetag 1
1471 1470 |/
1472 1471 o nodetag 0
1473 1472
1474 1473 $ hg log -G -d 'brace ) in a date'
1475 1474 abort: invalid date: 'brace ) in a date'
1476 1475 [255]
1477 1476 $ hg log -G -P 32 --template '{rev}\n'
1478 1477 @ 36
1479 1478 |
1480 1479 o 35
1481 1480 |
1482 1481 o 34
1483 1482 |
1484 1483 | o 33
1485 1484 | |
1486 1485 $ hg log -G --follow a
1487 1486 abort: -G/--graph option is incompatible with --follow with file argument
1488 1487 [255]
1489 1488
1490 1489
1491 1490 Dedicated repo for --follow and paths filtering
1492 1491
1493 1492 $ cd ..
1494 1493 $ hg init follow
1495 1494 $ cd follow
1496 1495 $ echo a > a
1497 1496 $ hg ci -Am "add a"
1498 1497 adding a
1499 1498 $ hg cp a b
1500 1499 $ hg ci -m "copy a b"
1501 1500 $ mkdir dir
1502 1501 $ hg mv b dir
1503 1502 $ hg ci -m "mv b dir/b"
1504 1503 $ hg mv a b
1505 1504 $ echo a > d
1506 1505 $ hg add d
1507 1506 $ hg ci -m "mv a b; add d"
1508 1507 $ hg mv dir/b e
1509 1508 $ hg ci -m "mv dir/b e"
1510 1509 $ hg glog --template '({rev}) {desc|firstline}\n'
1511 1510 @ (4) mv dir/b e
1512 1511 |
1513 1512 o (3) mv a b; add d
1514 1513 |
1515 1514 o (2) mv b dir/b
1516 1515 |
1517 1516 o (1) copy a b
1518 1517 |
1519 1518 o (0) add a
1520 1519
1521 1520
1522 1521 $ testlog a
1523 1522 ('group', ('group', ('func', ('symbol', 'filelog'), ('string', 'a'))))
1524 1523 $ testlog a b
1525 1524 ('group', ('group', ('or', ('func', ('symbol', 'filelog'), ('string', 'a')), ('func', ('symbol', 'filelog'), ('string', 'b')))))
1526 1525
1527 1526 Test falling back to slow path for non-existing files
1528 1527
1529 1528 $ testlog a c
1530 ('group', ('group', ('or', ('func', ('symbol', 'file'), ('string', 'a')), ('func', ('symbol', 'file'), ('string', 'c')))))
1529 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'p:a'), ('string', 'p:c')))))
1530
1531 Test multiple --include/--exclude/paths
1532
1533 $ testlog --include a --include e --exclude b --exclude e a e
1534 ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('list', ('list', ('list', ('list', ('string', 'p:a'), ('string', 'p:e')), ('string', 'i:a')), ('string', 'i:e')), ('string', 'x:b')), ('string', 'x:e')))))
General Comments 0
You need to be logged in to leave comments. Login now