##// END OF EJS Templates
graphlog: remove too early return from getgraphlogrevs() for empty repo...
Yuya Nishihara -
r24059:8d295ce6 default
parent child Browse files
Show More
@@ -1,2977 +1,2975 b''
1 # cmdutil.py - help for command processing in mercurial
1 # cmdutil.py - help for command processing in mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from node import hex, nullid, nullrev, short
8 from node import hex, nullid, nullrev, short
9 from i18n import _
9 from i18n import _
10 import os, sys, errno, re, tempfile
10 import os, sys, errno, re, tempfile
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod
12 import match as matchmod
13 import context, repair, graphmod, revset, phases, obsolete, pathutil
13 import context, repair, graphmod, revset, phases, obsolete, pathutil
14 import changelog
14 import changelog
15 import bookmarks
15 import bookmarks
16 import encoding
16 import encoding
17 import lock as lockmod
17 import lock as lockmod
18
18
19 def parsealiases(cmd):
19 def parsealiases(cmd):
20 return cmd.lstrip("^").split("|")
20 return cmd.lstrip("^").split("|")
21
21
22 def findpossible(cmd, table, strict=False):
22 def findpossible(cmd, table, strict=False):
23 """
23 """
24 Return cmd -> (aliases, command table entry)
24 Return cmd -> (aliases, command table entry)
25 for each matching command.
25 for each matching command.
26 Return debug commands (or their aliases) only if no normal command matches.
26 Return debug commands (or their aliases) only if no normal command matches.
27 """
27 """
28 choice = {}
28 choice = {}
29 debugchoice = {}
29 debugchoice = {}
30
30
31 if cmd in table:
31 if cmd in table:
32 # short-circuit exact matches, "log" alias beats "^log|history"
32 # short-circuit exact matches, "log" alias beats "^log|history"
33 keys = [cmd]
33 keys = [cmd]
34 else:
34 else:
35 keys = table.keys()
35 keys = table.keys()
36
36
37 for e in keys:
37 for e in keys:
38 aliases = parsealiases(e)
38 aliases = parsealiases(e)
39 found = None
39 found = None
40 if cmd in aliases:
40 if cmd in aliases:
41 found = cmd
41 found = cmd
42 elif not strict:
42 elif not strict:
43 for a in aliases:
43 for a in aliases:
44 if a.startswith(cmd):
44 if a.startswith(cmd):
45 found = a
45 found = a
46 break
46 break
47 if found is not None:
47 if found is not None:
48 if aliases[0].startswith("debug") or found.startswith("debug"):
48 if aliases[0].startswith("debug") or found.startswith("debug"):
49 debugchoice[found] = (aliases, table[e])
49 debugchoice[found] = (aliases, table[e])
50 else:
50 else:
51 choice[found] = (aliases, table[e])
51 choice[found] = (aliases, table[e])
52
52
53 if not choice and debugchoice:
53 if not choice and debugchoice:
54 choice = debugchoice
54 choice = debugchoice
55
55
56 return choice
56 return choice
57
57
58 def findcmd(cmd, table, strict=True):
58 def findcmd(cmd, table, strict=True):
59 """Return (aliases, command table entry) for command string."""
59 """Return (aliases, command table entry) for command string."""
60 choice = findpossible(cmd, table, strict)
60 choice = findpossible(cmd, table, strict)
61
61
62 if cmd in choice:
62 if cmd in choice:
63 return choice[cmd]
63 return choice[cmd]
64
64
65 if len(choice) > 1:
65 if len(choice) > 1:
66 clist = choice.keys()
66 clist = choice.keys()
67 clist.sort()
67 clist.sort()
68 raise error.AmbiguousCommand(cmd, clist)
68 raise error.AmbiguousCommand(cmd, clist)
69
69
70 if choice:
70 if choice:
71 return choice.values()[0]
71 return choice.values()[0]
72
72
73 raise error.UnknownCommand(cmd)
73 raise error.UnknownCommand(cmd)
74
74
75 def findrepo(p):
75 def findrepo(p):
76 while not os.path.isdir(os.path.join(p, ".hg")):
76 while not os.path.isdir(os.path.join(p, ".hg")):
77 oldp, p = p, os.path.dirname(p)
77 oldp, p = p, os.path.dirname(p)
78 if p == oldp:
78 if p == oldp:
79 return None
79 return None
80
80
81 return p
81 return p
82
82
83 def bailifchanged(repo):
83 def bailifchanged(repo):
84 if repo.dirstate.p2() != nullid:
84 if repo.dirstate.p2() != nullid:
85 raise util.Abort(_('outstanding uncommitted merge'))
85 raise util.Abort(_('outstanding uncommitted merge'))
86 modified, added, removed, deleted = repo.status()[:4]
86 modified, added, removed, deleted = repo.status()[:4]
87 if modified or added or removed or deleted:
87 if modified or added or removed or deleted:
88 raise util.Abort(_('uncommitted changes'))
88 raise util.Abort(_('uncommitted changes'))
89 ctx = repo[None]
89 ctx = repo[None]
90 for s in sorted(ctx.substate):
90 for s in sorted(ctx.substate):
91 if ctx.sub(s).dirty():
91 if ctx.sub(s).dirty():
92 raise util.Abort(_("uncommitted changes in subrepo %s") % s)
92 raise util.Abort(_("uncommitted changes in subrepo %s") % s)
93
93
94 def logmessage(ui, opts):
94 def logmessage(ui, opts):
95 """ get the log message according to -m and -l option """
95 """ get the log message according to -m and -l option """
96 message = opts.get('message')
96 message = opts.get('message')
97 logfile = opts.get('logfile')
97 logfile = opts.get('logfile')
98
98
99 if message and logfile:
99 if message and logfile:
100 raise util.Abort(_('options --message and --logfile are mutually '
100 raise util.Abort(_('options --message and --logfile are mutually '
101 'exclusive'))
101 'exclusive'))
102 if not message and logfile:
102 if not message and logfile:
103 try:
103 try:
104 if logfile == '-':
104 if logfile == '-':
105 message = ui.fin.read()
105 message = ui.fin.read()
106 else:
106 else:
107 message = '\n'.join(util.readfile(logfile).splitlines())
107 message = '\n'.join(util.readfile(logfile).splitlines())
108 except IOError, inst:
108 except IOError, inst:
109 raise util.Abort(_("can't read commit message '%s': %s") %
109 raise util.Abort(_("can't read commit message '%s': %s") %
110 (logfile, inst.strerror))
110 (logfile, inst.strerror))
111 return message
111 return message
112
112
113 def mergeeditform(ctxorbool, baseform):
113 def mergeeditform(ctxorbool, baseform):
114 """build appropriate editform from ctxorbool and baseform
114 """build appropriate editform from ctxorbool and baseform
115
115
116 'ctxorbool' is one of a ctx to be committed, or a bool whether
116 'ctxorbool' is one of a ctx to be committed, or a bool whether
117 merging is committed.
117 merging is committed.
118
118
119 This returns editform 'baseform' with '.merge' if merging is
119 This returns editform 'baseform' with '.merge' if merging is
120 committed, or one with '.normal' suffix otherwise.
120 committed, or one with '.normal' suffix otherwise.
121 """
121 """
122 if isinstance(ctxorbool, bool):
122 if isinstance(ctxorbool, bool):
123 if ctxorbool:
123 if ctxorbool:
124 return baseform + ".merge"
124 return baseform + ".merge"
125 elif 1 < len(ctxorbool.parents()):
125 elif 1 < len(ctxorbool.parents()):
126 return baseform + ".merge"
126 return baseform + ".merge"
127
127
128 return baseform + ".normal"
128 return baseform + ".normal"
129
129
130 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
130 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
131 editform='', **opts):
131 editform='', **opts):
132 """get appropriate commit message editor according to '--edit' option
132 """get appropriate commit message editor according to '--edit' option
133
133
134 'finishdesc' is a function to be called with edited commit message
134 'finishdesc' is a function to be called with edited commit message
135 (= 'description' of the new changeset) just after editing, but
135 (= 'description' of the new changeset) just after editing, but
136 before checking empty-ness. It should return actual text to be
136 before checking empty-ness. It should return actual text to be
137 stored into history. This allows to change description before
137 stored into history. This allows to change description before
138 storing.
138 storing.
139
139
140 'extramsg' is a extra message to be shown in the editor instead of
140 'extramsg' is a extra message to be shown in the editor instead of
141 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
141 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
142 is automatically added.
142 is automatically added.
143
143
144 'editform' is a dot-separated list of names, to distinguish
144 'editform' is a dot-separated list of names, to distinguish
145 the purpose of commit text editing.
145 the purpose of commit text editing.
146
146
147 'getcommiteditor' returns 'commitforceeditor' regardless of
147 'getcommiteditor' returns 'commitforceeditor' regardless of
148 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
148 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
149 they are specific for usage in MQ.
149 they are specific for usage in MQ.
150 """
150 """
151 if edit or finishdesc or extramsg:
151 if edit or finishdesc or extramsg:
152 return lambda r, c, s: commitforceeditor(r, c, s,
152 return lambda r, c, s: commitforceeditor(r, c, s,
153 finishdesc=finishdesc,
153 finishdesc=finishdesc,
154 extramsg=extramsg,
154 extramsg=extramsg,
155 editform=editform)
155 editform=editform)
156 elif editform:
156 elif editform:
157 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
157 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
158 else:
158 else:
159 return commiteditor
159 return commiteditor
160
160
161 def loglimit(opts):
161 def loglimit(opts):
162 """get the log limit according to option -l/--limit"""
162 """get the log limit according to option -l/--limit"""
163 limit = opts.get('limit')
163 limit = opts.get('limit')
164 if limit:
164 if limit:
165 try:
165 try:
166 limit = int(limit)
166 limit = int(limit)
167 except ValueError:
167 except ValueError:
168 raise util.Abort(_('limit must be a positive integer'))
168 raise util.Abort(_('limit must be a positive integer'))
169 if limit <= 0:
169 if limit <= 0:
170 raise util.Abort(_('limit must be positive'))
170 raise util.Abort(_('limit must be positive'))
171 else:
171 else:
172 limit = None
172 limit = None
173 return limit
173 return limit
174
174
175 def makefilename(repo, pat, node, desc=None,
175 def makefilename(repo, pat, node, desc=None,
176 total=None, seqno=None, revwidth=None, pathname=None):
176 total=None, seqno=None, revwidth=None, pathname=None):
177 node_expander = {
177 node_expander = {
178 'H': lambda: hex(node),
178 'H': lambda: hex(node),
179 'R': lambda: str(repo.changelog.rev(node)),
179 'R': lambda: str(repo.changelog.rev(node)),
180 'h': lambda: short(node),
180 'h': lambda: short(node),
181 'm': lambda: re.sub('[^\w]', '_', str(desc))
181 'm': lambda: re.sub('[^\w]', '_', str(desc))
182 }
182 }
183 expander = {
183 expander = {
184 '%': lambda: '%',
184 '%': lambda: '%',
185 'b': lambda: os.path.basename(repo.root),
185 'b': lambda: os.path.basename(repo.root),
186 }
186 }
187
187
188 try:
188 try:
189 if node:
189 if node:
190 expander.update(node_expander)
190 expander.update(node_expander)
191 if node:
191 if node:
192 expander['r'] = (lambda:
192 expander['r'] = (lambda:
193 str(repo.changelog.rev(node)).zfill(revwidth or 0))
193 str(repo.changelog.rev(node)).zfill(revwidth or 0))
194 if total is not None:
194 if total is not None:
195 expander['N'] = lambda: str(total)
195 expander['N'] = lambda: str(total)
196 if seqno is not None:
196 if seqno is not None:
197 expander['n'] = lambda: str(seqno)
197 expander['n'] = lambda: str(seqno)
198 if total is not None and seqno is not None:
198 if total is not None and seqno is not None:
199 expander['n'] = lambda: str(seqno).zfill(len(str(total)))
199 expander['n'] = lambda: str(seqno).zfill(len(str(total)))
200 if pathname is not None:
200 if pathname is not None:
201 expander['s'] = lambda: os.path.basename(pathname)
201 expander['s'] = lambda: os.path.basename(pathname)
202 expander['d'] = lambda: os.path.dirname(pathname) or '.'
202 expander['d'] = lambda: os.path.dirname(pathname) or '.'
203 expander['p'] = lambda: pathname
203 expander['p'] = lambda: pathname
204
204
205 newname = []
205 newname = []
206 patlen = len(pat)
206 patlen = len(pat)
207 i = 0
207 i = 0
208 while i < patlen:
208 while i < patlen:
209 c = pat[i]
209 c = pat[i]
210 if c == '%':
210 if c == '%':
211 i += 1
211 i += 1
212 c = pat[i]
212 c = pat[i]
213 c = expander[c]()
213 c = expander[c]()
214 newname.append(c)
214 newname.append(c)
215 i += 1
215 i += 1
216 return ''.join(newname)
216 return ''.join(newname)
217 except KeyError, inst:
217 except KeyError, inst:
218 raise util.Abort(_("invalid format spec '%%%s' in output filename") %
218 raise util.Abort(_("invalid format spec '%%%s' in output filename") %
219 inst.args[0])
219 inst.args[0])
220
220
221 def makefileobj(repo, pat, node=None, desc=None, total=None,
221 def makefileobj(repo, pat, node=None, desc=None, total=None,
222 seqno=None, revwidth=None, mode='wb', modemap=None,
222 seqno=None, revwidth=None, mode='wb', modemap=None,
223 pathname=None):
223 pathname=None):
224
224
225 writable = mode not in ('r', 'rb')
225 writable = mode not in ('r', 'rb')
226
226
227 if not pat or pat == '-':
227 if not pat or pat == '-':
228 fp = writable and repo.ui.fout or repo.ui.fin
228 fp = writable and repo.ui.fout or repo.ui.fin
229 if util.safehasattr(fp, 'fileno'):
229 if util.safehasattr(fp, 'fileno'):
230 return os.fdopen(os.dup(fp.fileno()), mode)
230 return os.fdopen(os.dup(fp.fileno()), mode)
231 else:
231 else:
232 # if this fp can't be duped properly, return
232 # if this fp can't be duped properly, return
233 # a dummy object that can be closed
233 # a dummy object that can be closed
234 class wrappedfileobj(object):
234 class wrappedfileobj(object):
235 noop = lambda x: None
235 noop = lambda x: None
236 def __init__(self, f):
236 def __init__(self, f):
237 self.f = f
237 self.f = f
238 def __getattr__(self, attr):
238 def __getattr__(self, attr):
239 if attr == 'close':
239 if attr == 'close':
240 return self.noop
240 return self.noop
241 else:
241 else:
242 return getattr(self.f, attr)
242 return getattr(self.f, attr)
243
243
244 return wrappedfileobj(fp)
244 return wrappedfileobj(fp)
245 if util.safehasattr(pat, 'write') and writable:
245 if util.safehasattr(pat, 'write') and writable:
246 return pat
246 return pat
247 if util.safehasattr(pat, 'read') and 'r' in mode:
247 if util.safehasattr(pat, 'read') and 'r' in mode:
248 return pat
248 return pat
249 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
249 fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname)
250 if modemap is not None:
250 if modemap is not None:
251 mode = modemap.get(fn, mode)
251 mode = modemap.get(fn, mode)
252 if mode == 'wb':
252 if mode == 'wb':
253 modemap[fn] = 'ab'
253 modemap[fn] = 'ab'
254 return open(fn, mode)
254 return open(fn, mode)
255
255
256 def openrevlog(repo, cmd, file_, opts):
256 def openrevlog(repo, cmd, file_, opts):
257 """opens the changelog, manifest, a filelog or a given revlog"""
257 """opens the changelog, manifest, a filelog or a given revlog"""
258 cl = opts['changelog']
258 cl = opts['changelog']
259 mf = opts['manifest']
259 mf = opts['manifest']
260 msg = None
260 msg = None
261 if cl and mf:
261 if cl and mf:
262 msg = _('cannot specify --changelog and --manifest at the same time')
262 msg = _('cannot specify --changelog and --manifest at the same time')
263 elif cl or mf:
263 elif cl or mf:
264 if file_:
264 if file_:
265 msg = _('cannot specify filename with --changelog or --manifest')
265 msg = _('cannot specify filename with --changelog or --manifest')
266 elif not repo:
266 elif not repo:
267 msg = _('cannot specify --changelog or --manifest '
267 msg = _('cannot specify --changelog or --manifest '
268 'without a repository')
268 'without a repository')
269 if msg:
269 if msg:
270 raise util.Abort(msg)
270 raise util.Abort(msg)
271
271
272 r = None
272 r = None
273 if repo:
273 if repo:
274 if cl:
274 if cl:
275 r = repo.unfiltered().changelog
275 r = repo.unfiltered().changelog
276 elif mf:
276 elif mf:
277 r = repo.manifest
277 r = repo.manifest
278 elif file_:
278 elif file_:
279 filelog = repo.file(file_)
279 filelog = repo.file(file_)
280 if len(filelog):
280 if len(filelog):
281 r = filelog
281 r = filelog
282 if not r:
282 if not r:
283 if not file_:
283 if not file_:
284 raise error.CommandError(cmd, _('invalid arguments'))
284 raise error.CommandError(cmd, _('invalid arguments'))
285 if not os.path.isfile(file_):
285 if not os.path.isfile(file_):
286 raise util.Abort(_("revlog '%s' not found") % file_)
286 raise util.Abort(_("revlog '%s' not found") % file_)
287 r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False),
287 r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False),
288 file_[:-2] + ".i")
288 file_[:-2] + ".i")
289 return r
289 return r
290
290
291 def copy(ui, repo, pats, opts, rename=False):
291 def copy(ui, repo, pats, opts, rename=False):
292 # called with the repo lock held
292 # called with the repo lock held
293 #
293 #
294 # hgsep => pathname that uses "/" to separate directories
294 # hgsep => pathname that uses "/" to separate directories
295 # ossep => pathname that uses os.sep to separate directories
295 # ossep => pathname that uses os.sep to separate directories
296 cwd = repo.getcwd()
296 cwd = repo.getcwd()
297 targets = {}
297 targets = {}
298 after = opts.get("after")
298 after = opts.get("after")
299 dryrun = opts.get("dry_run")
299 dryrun = opts.get("dry_run")
300 wctx = repo[None]
300 wctx = repo[None]
301
301
302 def walkpat(pat):
302 def walkpat(pat):
303 srcs = []
303 srcs = []
304 badstates = after and '?' or '?r'
304 badstates = after and '?' or '?r'
305 m = scmutil.match(repo[None], [pat], opts, globbed=True)
305 m = scmutil.match(repo[None], [pat], opts, globbed=True)
306 for abs in repo.walk(m):
306 for abs in repo.walk(m):
307 state = repo.dirstate[abs]
307 state = repo.dirstate[abs]
308 rel = m.rel(abs)
308 rel = m.rel(abs)
309 exact = m.exact(abs)
309 exact = m.exact(abs)
310 if state in badstates:
310 if state in badstates:
311 if exact and state == '?':
311 if exact and state == '?':
312 ui.warn(_('%s: not copying - file is not managed\n') % rel)
312 ui.warn(_('%s: not copying - file is not managed\n') % rel)
313 if exact and state == 'r':
313 if exact and state == 'r':
314 ui.warn(_('%s: not copying - file has been marked for'
314 ui.warn(_('%s: not copying - file has been marked for'
315 ' remove\n') % rel)
315 ' remove\n') % rel)
316 continue
316 continue
317 # abs: hgsep
317 # abs: hgsep
318 # rel: ossep
318 # rel: ossep
319 srcs.append((abs, rel, exact))
319 srcs.append((abs, rel, exact))
320 return srcs
320 return srcs
321
321
322 # abssrc: hgsep
322 # abssrc: hgsep
323 # relsrc: ossep
323 # relsrc: ossep
324 # otarget: ossep
324 # otarget: ossep
325 def copyfile(abssrc, relsrc, otarget, exact):
325 def copyfile(abssrc, relsrc, otarget, exact):
326 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
326 abstarget = pathutil.canonpath(repo.root, cwd, otarget)
327 if '/' in abstarget:
327 if '/' in abstarget:
328 # We cannot normalize abstarget itself, this would prevent
328 # We cannot normalize abstarget itself, this would prevent
329 # case only renames, like a => A.
329 # case only renames, like a => A.
330 abspath, absname = abstarget.rsplit('/', 1)
330 abspath, absname = abstarget.rsplit('/', 1)
331 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
331 abstarget = repo.dirstate.normalize(abspath) + '/' + absname
332 reltarget = repo.pathto(abstarget, cwd)
332 reltarget = repo.pathto(abstarget, cwd)
333 target = repo.wjoin(abstarget)
333 target = repo.wjoin(abstarget)
334 src = repo.wjoin(abssrc)
334 src = repo.wjoin(abssrc)
335 state = repo.dirstate[abstarget]
335 state = repo.dirstate[abstarget]
336
336
337 scmutil.checkportable(ui, abstarget)
337 scmutil.checkportable(ui, abstarget)
338
338
339 # check for collisions
339 # check for collisions
340 prevsrc = targets.get(abstarget)
340 prevsrc = targets.get(abstarget)
341 if prevsrc is not None:
341 if prevsrc is not None:
342 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
342 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
343 (reltarget, repo.pathto(abssrc, cwd),
343 (reltarget, repo.pathto(abssrc, cwd),
344 repo.pathto(prevsrc, cwd)))
344 repo.pathto(prevsrc, cwd)))
345 return
345 return
346
346
347 # check for overwrites
347 # check for overwrites
348 exists = os.path.lexists(target)
348 exists = os.path.lexists(target)
349 samefile = False
349 samefile = False
350 if exists and abssrc != abstarget:
350 if exists and abssrc != abstarget:
351 if (repo.dirstate.normalize(abssrc) ==
351 if (repo.dirstate.normalize(abssrc) ==
352 repo.dirstate.normalize(abstarget)):
352 repo.dirstate.normalize(abstarget)):
353 if not rename:
353 if not rename:
354 ui.warn(_("%s: can't copy - same file\n") % reltarget)
354 ui.warn(_("%s: can't copy - same file\n") % reltarget)
355 return
355 return
356 exists = False
356 exists = False
357 samefile = True
357 samefile = True
358
358
359 if not after and exists or after and state in 'mn':
359 if not after and exists or after and state in 'mn':
360 if not opts['force']:
360 if not opts['force']:
361 ui.warn(_('%s: not overwriting - file exists\n') %
361 ui.warn(_('%s: not overwriting - file exists\n') %
362 reltarget)
362 reltarget)
363 return
363 return
364
364
365 if after:
365 if after:
366 if not exists:
366 if not exists:
367 if rename:
367 if rename:
368 ui.warn(_('%s: not recording move - %s does not exist\n') %
368 ui.warn(_('%s: not recording move - %s does not exist\n') %
369 (relsrc, reltarget))
369 (relsrc, reltarget))
370 else:
370 else:
371 ui.warn(_('%s: not recording copy - %s does not exist\n') %
371 ui.warn(_('%s: not recording copy - %s does not exist\n') %
372 (relsrc, reltarget))
372 (relsrc, reltarget))
373 return
373 return
374 elif not dryrun:
374 elif not dryrun:
375 try:
375 try:
376 if exists:
376 if exists:
377 os.unlink(target)
377 os.unlink(target)
378 targetdir = os.path.dirname(target) or '.'
378 targetdir = os.path.dirname(target) or '.'
379 if not os.path.isdir(targetdir):
379 if not os.path.isdir(targetdir):
380 os.makedirs(targetdir)
380 os.makedirs(targetdir)
381 if samefile:
381 if samefile:
382 tmp = target + "~hgrename"
382 tmp = target + "~hgrename"
383 os.rename(src, tmp)
383 os.rename(src, tmp)
384 os.rename(tmp, target)
384 os.rename(tmp, target)
385 else:
385 else:
386 util.copyfile(src, target)
386 util.copyfile(src, target)
387 srcexists = True
387 srcexists = True
388 except IOError, inst:
388 except IOError, inst:
389 if inst.errno == errno.ENOENT:
389 if inst.errno == errno.ENOENT:
390 ui.warn(_('%s: deleted in working copy\n') % relsrc)
390 ui.warn(_('%s: deleted in working copy\n') % relsrc)
391 srcexists = False
391 srcexists = False
392 else:
392 else:
393 ui.warn(_('%s: cannot copy - %s\n') %
393 ui.warn(_('%s: cannot copy - %s\n') %
394 (relsrc, inst.strerror))
394 (relsrc, inst.strerror))
395 return True # report a failure
395 return True # report a failure
396
396
397 if ui.verbose or not exact:
397 if ui.verbose or not exact:
398 if rename:
398 if rename:
399 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
399 ui.status(_('moving %s to %s\n') % (relsrc, reltarget))
400 else:
400 else:
401 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
401 ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
402
402
403 targets[abstarget] = abssrc
403 targets[abstarget] = abssrc
404
404
405 # fix up dirstate
405 # fix up dirstate
406 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
406 scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget,
407 dryrun=dryrun, cwd=cwd)
407 dryrun=dryrun, cwd=cwd)
408 if rename and not dryrun:
408 if rename and not dryrun:
409 if not after and srcexists and not samefile:
409 if not after and srcexists and not samefile:
410 util.unlinkpath(repo.wjoin(abssrc))
410 util.unlinkpath(repo.wjoin(abssrc))
411 wctx.forget([abssrc])
411 wctx.forget([abssrc])
412
412
413 # pat: ossep
413 # pat: ossep
414 # dest ossep
414 # dest ossep
415 # srcs: list of (hgsep, hgsep, ossep, bool)
415 # srcs: list of (hgsep, hgsep, ossep, bool)
416 # return: function that takes hgsep and returns ossep
416 # return: function that takes hgsep and returns ossep
417 def targetpathfn(pat, dest, srcs):
417 def targetpathfn(pat, dest, srcs):
418 if os.path.isdir(pat):
418 if os.path.isdir(pat):
419 abspfx = pathutil.canonpath(repo.root, cwd, pat)
419 abspfx = pathutil.canonpath(repo.root, cwd, pat)
420 abspfx = util.localpath(abspfx)
420 abspfx = util.localpath(abspfx)
421 if destdirexists:
421 if destdirexists:
422 striplen = len(os.path.split(abspfx)[0])
422 striplen = len(os.path.split(abspfx)[0])
423 else:
423 else:
424 striplen = len(abspfx)
424 striplen = len(abspfx)
425 if striplen:
425 if striplen:
426 striplen += len(os.sep)
426 striplen += len(os.sep)
427 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
427 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
428 elif destdirexists:
428 elif destdirexists:
429 res = lambda p: os.path.join(dest,
429 res = lambda p: os.path.join(dest,
430 os.path.basename(util.localpath(p)))
430 os.path.basename(util.localpath(p)))
431 else:
431 else:
432 res = lambda p: dest
432 res = lambda p: dest
433 return res
433 return res
434
434
435 # pat: ossep
435 # pat: ossep
436 # dest ossep
436 # dest ossep
437 # srcs: list of (hgsep, hgsep, ossep, bool)
437 # srcs: list of (hgsep, hgsep, ossep, bool)
438 # return: function that takes hgsep and returns ossep
438 # return: function that takes hgsep and returns ossep
439 def targetpathafterfn(pat, dest, srcs):
439 def targetpathafterfn(pat, dest, srcs):
440 if matchmod.patkind(pat):
440 if matchmod.patkind(pat):
441 # a mercurial pattern
441 # a mercurial pattern
442 res = lambda p: os.path.join(dest,
442 res = lambda p: os.path.join(dest,
443 os.path.basename(util.localpath(p)))
443 os.path.basename(util.localpath(p)))
444 else:
444 else:
445 abspfx = pathutil.canonpath(repo.root, cwd, pat)
445 abspfx = pathutil.canonpath(repo.root, cwd, pat)
446 if len(abspfx) < len(srcs[0][0]):
446 if len(abspfx) < len(srcs[0][0]):
447 # A directory. Either the target path contains the last
447 # A directory. Either the target path contains the last
448 # component of the source path or it does not.
448 # component of the source path or it does not.
449 def evalpath(striplen):
449 def evalpath(striplen):
450 score = 0
450 score = 0
451 for s in srcs:
451 for s in srcs:
452 t = os.path.join(dest, util.localpath(s[0])[striplen:])
452 t = os.path.join(dest, util.localpath(s[0])[striplen:])
453 if os.path.lexists(t):
453 if os.path.lexists(t):
454 score += 1
454 score += 1
455 return score
455 return score
456
456
457 abspfx = util.localpath(abspfx)
457 abspfx = util.localpath(abspfx)
458 striplen = len(abspfx)
458 striplen = len(abspfx)
459 if striplen:
459 if striplen:
460 striplen += len(os.sep)
460 striplen += len(os.sep)
461 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
461 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
462 score = evalpath(striplen)
462 score = evalpath(striplen)
463 striplen1 = len(os.path.split(abspfx)[0])
463 striplen1 = len(os.path.split(abspfx)[0])
464 if striplen1:
464 if striplen1:
465 striplen1 += len(os.sep)
465 striplen1 += len(os.sep)
466 if evalpath(striplen1) > score:
466 if evalpath(striplen1) > score:
467 striplen = striplen1
467 striplen = striplen1
468 res = lambda p: os.path.join(dest,
468 res = lambda p: os.path.join(dest,
469 util.localpath(p)[striplen:])
469 util.localpath(p)[striplen:])
470 else:
470 else:
471 # a file
471 # a file
472 if destdirexists:
472 if destdirexists:
473 res = lambda p: os.path.join(dest,
473 res = lambda p: os.path.join(dest,
474 os.path.basename(util.localpath(p)))
474 os.path.basename(util.localpath(p)))
475 else:
475 else:
476 res = lambda p: dest
476 res = lambda p: dest
477 return res
477 return res
478
478
479
479
480 pats = scmutil.expandpats(pats)
480 pats = scmutil.expandpats(pats)
481 if not pats:
481 if not pats:
482 raise util.Abort(_('no source or destination specified'))
482 raise util.Abort(_('no source or destination specified'))
483 if len(pats) == 1:
483 if len(pats) == 1:
484 raise util.Abort(_('no destination specified'))
484 raise util.Abort(_('no destination specified'))
485 dest = pats.pop()
485 dest = pats.pop()
486 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
486 destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
487 if not destdirexists:
487 if not destdirexists:
488 if len(pats) > 1 or matchmod.patkind(pats[0]):
488 if len(pats) > 1 or matchmod.patkind(pats[0]):
489 raise util.Abort(_('with multiple sources, destination must be an '
489 raise util.Abort(_('with multiple sources, destination must be an '
490 'existing directory'))
490 'existing directory'))
491 if util.endswithsep(dest):
491 if util.endswithsep(dest):
492 raise util.Abort(_('destination %s is not a directory') % dest)
492 raise util.Abort(_('destination %s is not a directory') % dest)
493
493
494 tfn = targetpathfn
494 tfn = targetpathfn
495 if after:
495 if after:
496 tfn = targetpathafterfn
496 tfn = targetpathafterfn
497 copylist = []
497 copylist = []
498 for pat in pats:
498 for pat in pats:
499 srcs = walkpat(pat)
499 srcs = walkpat(pat)
500 if not srcs:
500 if not srcs:
501 continue
501 continue
502 copylist.append((tfn(pat, dest, srcs), srcs))
502 copylist.append((tfn(pat, dest, srcs), srcs))
503 if not copylist:
503 if not copylist:
504 raise util.Abort(_('no files to copy'))
504 raise util.Abort(_('no files to copy'))
505
505
506 errors = 0
506 errors = 0
507 for targetpath, srcs in copylist:
507 for targetpath, srcs in copylist:
508 for abssrc, relsrc, exact in srcs:
508 for abssrc, relsrc, exact in srcs:
509 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
509 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
510 errors += 1
510 errors += 1
511
511
512 if errors:
512 if errors:
513 ui.warn(_('(consider using --after)\n'))
513 ui.warn(_('(consider using --after)\n'))
514
514
515 return errors != 0
515 return errors != 0
516
516
517 def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
517 def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
518 runargs=None, appendpid=False):
518 runargs=None, appendpid=False):
519 '''Run a command as a service.'''
519 '''Run a command as a service.'''
520
520
521 def writepid(pid):
521 def writepid(pid):
522 if opts['pid_file']:
522 if opts['pid_file']:
523 mode = appendpid and 'a' or 'w'
523 mode = appendpid and 'a' or 'w'
524 fp = open(opts['pid_file'], mode)
524 fp = open(opts['pid_file'], mode)
525 fp.write(str(pid) + '\n')
525 fp.write(str(pid) + '\n')
526 fp.close()
526 fp.close()
527
527
528 if opts['daemon'] and not opts['daemon_pipefds']:
528 if opts['daemon'] and not opts['daemon_pipefds']:
529 # Signal child process startup with file removal
529 # Signal child process startup with file removal
530 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-')
530 lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-')
531 os.close(lockfd)
531 os.close(lockfd)
532 try:
532 try:
533 if not runargs:
533 if not runargs:
534 runargs = util.hgcmd() + sys.argv[1:]
534 runargs = util.hgcmd() + sys.argv[1:]
535 runargs.append('--daemon-pipefds=%s' % lockpath)
535 runargs.append('--daemon-pipefds=%s' % lockpath)
536 # Don't pass --cwd to the child process, because we've already
536 # Don't pass --cwd to the child process, because we've already
537 # changed directory.
537 # changed directory.
538 for i in xrange(1, len(runargs)):
538 for i in xrange(1, len(runargs)):
539 if runargs[i].startswith('--cwd='):
539 if runargs[i].startswith('--cwd='):
540 del runargs[i]
540 del runargs[i]
541 break
541 break
542 elif runargs[i].startswith('--cwd'):
542 elif runargs[i].startswith('--cwd'):
543 del runargs[i:i + 2]
543 del runargs[i:i + 2]
544 break
544 break
545 def condfn():
545 def condfn():
546 return not os.path.exists(lockpath)
546 return not os.path.exists(lockpath)
547 pid = util.rundetached(runargs, condfn)
547 pid = util.rundetached(runargs, condfn)
548 if pid < 0:
548 if pid < 0:
549 raise util.Abort(_('child process failed to start'))
549 raise util.Abort(_('child process failed to start'))
550 writepid(pid)
550 writepid(pid)
551 finally:
551 finally:
552 try:
552 try:
553 os.unlink(lockpath)
553 os.unlink(lockpath)
554 except OSError, e:
554 except OSError, e:
555 if e.errno != errno.ENOENT:
555 if e.errno != errno.ENOENT:
556 raise
556 raise
557 if parentfn:
557 if parentfn:
558 return parentfn(pid)
558 return parentfn(pid)
559 else:
559 else:
560 return
560 return
561
561
562 if initfn:
562 if initfn:
563 initfn()
563 initfn()
564
564
565 if not opts['daemon']:
565 if not opts['daemon']:
566 writepid(os.getpid())
566 writepid(os.getpid())
567
567
568 if opts['daemon_pipefds']:
568 if opts['daemon_pipefds']:
569 lockpath = opts['daemon_pipefds']
569 lockpath = opts['daemon_pipefds']
570 try:
570 try:
571 os.setsid()
571 os.setsid()
572 except AttributeError:
572 except AttributeError:
573 pass
573 pass
574 os.unlink(lockpath)
574 os.unlink(lockpath)
575 util.hidewindow()
575 util.hidewindow()
576 sys.stdout.flush()
576 sys.stdout.flush()
577 sys.stderr.flush()
577 sys.stderr.flush()
578
578
579 nullfd = os.open(os.devnull, os.O_RDWR)
579 nullfd = os.open(os.devnull, os.O_RDWR)
580 logfilefd = nullfd
580 logfilefd = nullfd
581 if logfile:
581 if logfile:
582 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND)
582 logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND)
583 os.dup2(nullfd, 0)
583 os.dup2(nullfd, 0)
584 os.dup2(logfilefd, 1)
584 os.dup2(logfilefd, 1)
585 os.dup2(logfilefd, 2)
585 os.dup2(logfilefd, 2)
586 if nullfd not in (0, 1, 2):
586 if nullfd not in (0, 1, 2):
587 os.close(nullfd)
587 os.close(nullfd)
588 if logfile and logfilefd not in (0, 1, 2):
588 if logfile and logfilefd not in (0, 1, 2):
589 os.close(logfilefd)
589 os.close(logfilefd)
590
590
591 if runfn:
591 if runfn:
592 return runfn()
592 return runfn()
593
593
594 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
594 def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
595 """Utility function used by commands.import to import a single patch
595 """Utility function used by commands.import to import a single patch
596
596
597 This function is explicitly defined here to help the evolve extension to
597 This function is explicitly defined here to help the evolve extension to
598 wrap this part of the import logic.
598 wrap this part of the import logic.
599
599
600 The API is currently a bit ugly because it a simple code translation from
600 The API is currently a bit ugly because it a simple code translation from
601 the import command. Feel free to make it better.
601 the import command. Feel free to make it better.
602
602
603 :hunk: a patch (as a binary string)
603 :hunk: a patch (as a binary string)
604 :parents: nodes that will be parent of the created commit
604 :parents: nodes that will be parent of the created commit
605 :opts: the full dict of option passed to the import command
605 :opts: the full dict of option passed to the import command
606 :msgs: list to save commit message to.
606 :msgs: list to save commit message to.
607 (used in case we need to save it when failing)
607 (used in case we need to save it when failing)
608 :updatefunc: a function that update a repo to a given node
608 :updatefunc: a function that update a repo to a given node
609 updatefunc(<repo>, <node>)
609 updatefunc(<repo>, <node>)
610 """
610 """
611 tmpname, message, user, date, branch, nodeid, p1, p2 = \
611 tmpname, message, user, date, branch, nodeid, p1, p2 = \
612 patch.extract(ui, hunk)
612 patch.extract(ui, hunk)
613
613
614 update = not opts.get('bypass')
614 update = not opts.get('bypass')
615 strip = opts["strip"]
615 strip = opts["strip"]
616 sim = float(opts.get('similarity') or 0)
616 sim = float(opts.get('similarity') or 0)
617 if not tmpname:
617 if not tmpname:
618 return (None, None, False)
618 return (None, None, False)
619 msg = _('applied to working directory')
619 msg = _('applied to working directory')
620
620
621 rejects = False
621 rejects = False
622
622
623 try:
623 try:
624 cmdline_message = logmessage(ui, opts)
624 cmdline_message = logmessage(ui, opts)
625 if cmdline_message:
625 if cmdline_message:
626 # pickup the cmdline msg
626 # pickup the cmdline msg
627 message = cmdline_message
627 message = cmdline_message
628 elif message:
628 elif message:
629 # pickup the patch msg
629 # pickup the patch msg
630 message = message.strip()
630 message = message.strip()
631 else:
631 else:
632 # launch the editor
632 # launch the editor
633 message = None
633 message = None
634 ui.debug('message:\n%s\n' % message)
634 ui.debug('message:\n%s\n' % message)
635
635
636 if len(parents) == 1:
636 if len(parents) == 1:
637 parents.append(repo[nullid])
637 parents.append(repo[nullid])
638 if opts.get('exact'):
638 if opts.get('exact'):
639 if not nodeid or not p1:
639 if not nodeid or not p1:
640 raise util.Abort(_('not a Mercurial patch'))
640 raise util.Abort(_('not a Mercurial patch'))
641 p1 = repo[p1]
641 p1 = repo[p1]
642 p2 = repo[p2 or nullid]
642 p2 = repo[p2 or nullid]
643 elif p2:
643 elif p2:
644 try:
644 try:
645 p1 = repo[p1]
645 p1 = repo[p1]
646 p2 = repo[p2]
646 p2 = repo[p2]
647 # Without any options, consider p2 only if the
647 # Without any options, consider p2 only if the
648 # patch is being applied on top of the recorded
648 # patch is being applied on top of the recorded
649 # first parent.
649 # first parent.
650 if p1 != parents[0]:
650 if p1 != parents[0]:
651 p1 = parents[0]
651 p1 = parents[0]
652 p2 = repo[nullid]
652 p2 = repo[nullid]
653 except error.RepoError:
653 except error.RepoError:
654 p1, p2 = parents
654 p1, p2 = parents
655 if p2.node() == nullid:
655 if p2.node() == nullid:
656 ui.warn(_("warning: import the patch as a normal revision\n"
656 ui.warn(_("warning: import the patch as a normal revision\n"
657 "(use --exact to import the patch as a merge)\n"))
657 "(use --exact to import the patch as a merge)\n"))
658 else:
658 else:
659 p1, p2 = parents
659 p1, p2 = parents
660
660
661 n = None
661 n = None
662 if update:
662 if update:
663 repo.dirstate.beginparentchange()
663 repo.dirstate.beginparentchange()
664 if p1 != parents[0]:
664 if p1 != parents[0]:
665 updatefunc(repo, p1.node())
665 updatefunc(repo, p1.node())
666 if p2 != parents[1]:
666 if p2 != parents[1]:
667 repo.setparents(p1.node(), p2.node())
667 repo.setparents(p1.node(), p2.node())
668
668
669 if opts.get('exact') or opts.get('import_branch'):
669 if opts.get('exact') or opts.get('import_branch'):
670 repo.dirstate.setbranch(branch or 'default')
670 repo.dirstate.setbranch(branch or 'default')
671
671
672 partial = opts.get('partial', False)
672 partial = opts.get('partial', False)
673 files = set()
673 files = set()
674 try:
674 try:
675 patch.patch(ui, repo, tmpname, strip=strip, files=files,
675 patch.patch(ui, repo, tmpname, strip=strip, files=files,
676 eolmode=None, similarity=sim / 100.0)
676 eolmode=None, similarity=sim / 100.0)
677 except patch.PatchError, e:
677 except patch.PatchError, e:
678 if not partial:
678 if not partial:
679 raise util.Abort(str(e))
679 raise util.Abort(str(e))
680 if partial:
680 if partial:
681 rejects = True
681 rejects = True
682
682
683 files = list(files)
683 files = list(files)
684 if opts.get('no_commit'):
684 if opts.get('no_commit'):
685 if message:
685 if message:
686 msgs.append(message)
686 msgs.append(message)
687 else:
687 else:
688 if opts.get('exact') or p2:
688 if opts.get('exact') or p2:
689 # If you got here, you either use --force and know what
689 # If you got here, you either use --force and know what
690 # you are doing or used --exact or a merge patch while
690 # you are doing or used --exact or a merge patch while
691 # being updated to its first parent.
691 # being updated to its first parent.
692 m = None
692 m = None
693 else:
693 else:
694 m = scmutil.matchfiles(repo, files or [])
694 m = scmutil.matchfiles(repo, files or [])
695 editform = mergeeditform(repo[None], 'import.normal')
695 editform = mergeeditform(repo[None], 'import.normal')
696 if opts.get('exact'):
696 if opts.get('exact'):
697 editor = None
697 editor = None
698 else:
698 else:
699 editor = getcommiteditor(editform=editform, **opts)
699 editor = getcommiteditor(editform=editform, **opts)
700 n = repo.commit(message, opts.get('user') or user,
700 n = repo.commit(message, opts.get('user') or user,
701 opts.get('date') or date, match=m,
701 opts.get('date') or date, match=m,
702 editor=editor, force=partial)
702 editor=editor, force=partial)
703 repo.dirstate.endparentchange()
703 repo.dirstate.endparentchange()
704 else:
704 else:
705 if opts.get('exact') or opts.get('import_branch'):
705 if opts.get('exact') or opts.get('import_branch'):
706 branch = branch or 'default'
706 branch = branch or 'default'
707 else:
707 else:
708 branch = p1.branch()
708 branch = p1.branch()
709 store = patch.filestore()
709 store = patch.filestore()
710 try:
710 try:
711 files = set()
711 files = set()
712 try:
712 try:
713 patch.patchrepo(ui, repo, p1, store, tmpname, strip,
713 patch.patchrepo(ui, repo, p1, store, tmpname, strip,
714 files, eolmode=None)
714 files, eolmode=None)
715 except patch.PatchError, e:
715 except patch.PatchError, e:
716 raise util.Abort(str(e))
716 raise util.Abort(str(e))
717 if opts.get('exact'):
717 if opts.get('exact'):
718 editor = None
718 editor = None
719 else:
719 else:
720 editor = getcommiteditor(editform='import.bypass')
720 editor = getcommiteditor(editform='import.bypass')
721 memctx = context.makememctx(repo, (p1.node(), p2.node()),
721 memctx = context.makememctx(repo, (p1.node(), p2.node()),
722 message,
722 message,
723 opts.get('user') or user,
723 opts.get('user') or user,
724 opts.get('date') or date,
724 opts.get('date') or date,
725 branch, files, store,
725 branch, files, store,
726 editor=editor)
726 editor=editor)
727 n = memctx.commit()
727 n = memctx.commit()
728 finally:
728 finally:
729 store.close()
729 store.close()
730 if opts.get('exact') and opts.get('no_commit'):
730 if opts.get('exact') and opts.get('no_commit'):
731 # --exact with --no-commit is still useful in that it does merge
731 # --exact with --no-commit is still useful in that it does merge
732 # and branch bits
732 # and branch bits
733 ui.warn(_("warning: can't check exact import with --no-commit\n"))
733 ui.warn(_("warning: can't check exact import with --no-commit\n"))
734 elif opts.get('exact') and hex(n) != nodeid:
734 elif opts.get('exact') and hex(n) != nodeid:
735 raise util.Abort(_('patch is damaged or loses information'))
735 raise util.Abort(_('patch is damaged or loses information'))
736 if n:
736 if n:
737 # i18n: refers to a short changeset id
737 # i18n: refers to a short changeset id
738 msg = _('created %s') % short(n)
738 msg = _('created %s') % short(n)
739 return (msg, n, rejects)
739 return (msg, n, rejects)
740 finally:
740 finally:
741 os.unlink(tmpname)
741 os.unlink(tmpname)
742
742
743 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
743 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
744 opts=None):
744 opts=None):
745 '''export changesets as hg patches.'''
745 '''export changesets as hg patches.'''
746
746
747 total = len(revs)
747 total = len(revs)
748 revwidth = max([len(str(rev)) for rev in revs])
748 revwidth = max([len(str(rev)) for rev in revs])
749 filemode = {}
749 filemode = {}
750
750
751 def single(rev, seqno, fp):
751 def single(rev, seqno, fp):
752 ctx = repo[rev]
752 ctx = repo[rev]
753 node = ctx.node()
753 node = ctx.node()
754 parents = [p.node() for p in ctx.parents() if p]
754 parents = [p.node() for p in ctx.parents() if p]
755 branch = ctx.branch()
755 branch = ctx.branch()
756 if switch_parent:
756 if switch_parent:
757 parents.reverse()
757 parents.reverse()
758 prev = (parents and parents[0]) or nullid
758 prev = (parents and parents[0]) or nullid
759
759
760 shouldclose = False
760 shouldclose = False
761 if not fp and len(template) > 0:
761 if not fp and len(template) > 0:
762 desc_lines = ctx.description().rstrip().split('\n')
762 desc_lines = ctx.description().rstrip().split('\n')
763 desc = desc_lines[0] #Commit always has a first line.
763 desc = desc_lines[0] #Commit always has a first line.
764 fp = makefileobj(repo, template, node, desc=desc, total=total,
764 fp = makefileobj(repo, template, node, desc=desc, total=total,
765 seqno=seqno, revwidth=revwidth, mode='wb',
765 seqno=seqno, revwidth=revwidth, mode='wb',
766 modemap=filemode)
766 modemap=filemode)
767 if fp != template:
767 if fp != template:
768 shouldclose = True
768 shouldclose = True
769 if fp and fp != sys.stdout and util.safehasattr(fp, 'name'):
769 if fp and fp != sys.stdout and util.safehasattr(fp, 'name'):
770 repo.ui.note("%s\n" % fp.name)
770 repo.ui.note("%s\n" % fp.name)
771
771
772 if not fp:
772 if not fp:
773 write = repo.ui.write
773 write = repo.ui.write
774 else:
774 else:
775 def write(s, **kw):
775 def write(s, **kw):
776 fp.write(s)
776 fp.write(s)
777
777
778
778
779 write("# HG changeset patch\n")
779 write("# HG changeset patch\n")
780 write("# User %s\n" % ctx.user())
780 write("# User %s\n" % ctx.user())
781 write("# Date %d %d\n" % ctx.date())
781 write("# Date %d %d\n" % ctx.date())
782 write("# %s\n" % util.datestr(ctx.date()))
782 write("# %s\n" % util.datestr(ctx.date()))
783 if branch and branch != 'default':
783 if branch and branch != 'default':
784 write("# Branch %s\n" % branch)
784 write("# Branch %s\n" % branch)
785 write("# Node ID %s\n" % hex(node))
785 write("# Node ID %s\n" % hex(node))
786 write("# Parent %s\n" % hex(prev))
786 write("# Parent %s\n" % hex(prev))
787 if len(parents) > 1:
787 if len(parents) > 1:
788 write("# Parent %s\n" % hex(parents[1]))
788 write("# Parent %s\n" % hex(parents[1]))
789 write(ctx.description().rstrip())
789 write(ctx.description().rstrip())
790 write("\n\n")
790 write("\n\n")
791
791
792 for chunk, label in patch.diffui(repo, prev, node, opts=opts):
792 for chunk, label in patch.diffui(repo, prev, node, opts=opts):
793 write(chunk, label=label)
793 write(chunk, label=label)
794
794
795 if shouldclose:
795 if shouldclose:
796 fp.close()
796 fp.close()
797
797
798 for seqno, rev in enumerate(revs):
798 for seqno, rev in enumerate(revs):
799 single(rev, seqno + 1, fp)
799 single(rev, seqno + 1, fp)
800
800
801 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
801 def diffordiffstat(ui, repo, diffopts, node1, node2, match,
802 changes=None, stat=False, fp=None, prefix='',
802 changes=None, stat=False, fp=None, prefix='',
803 listsubrepos=False):
803 listsubrepos=False):
804 '''show diff or diffstat.'''
804 '''show diff or diffstat.'''
805 if fp is None:
805 if fp is None:
806 write = ui.write
806 write = ui.write
807 else:
807 else:
808 def write(s, **kw):
808 def write(s, **kw):
809 fp.write(s)
809 fp.write(s)
810
810
811 if stat:
811 if stat:
812 diffopts = diffopts.copy(context=0)
812 diffopts = diffopts.copy(context=0)
813 width = 80
813 width = 80
814 if not ui.plain():
814 if not ui.plain():
815 width = ui.termwidth()
815 width = ui.termwidth()
816 chunks = patch.diff(repo, node1, node2, match, changes, diffopts,
816 chunks = patch.diff(repo, node1, node2, match, changes, diffopts,
817 prefix=prefix)
817 prefix=prefix)
818 for chunk, label in patch.diffstatui(util.iterlines(chunks),
818 for chunk, label in patch.diffstatui(util.iterlines(chunks),
819 width=width,
819 width=width,
820 git=diffopts.git):
820 git=diffopts.git):
821 write(chunk, label=label)
821 write(chunk, label=label)
822 else:
822 else:
823 for chunk, label in patch.diffui(repo, node1, node2, match,
823 for chunk, label in patch.diffui(repo, node1, node2, match,
824 changes, diffopts, prefix=prefix):
824 changes, diffopts, prefix=prefix):
825 write(chunk, label=label)
825 write(chunk, label=label)
826
826
827 if listsubrepos:
827 if listsubrepos:
828 ctx1 = repo[node1]
828 ctx1 = repo[node1]
829 ctx2 = repo[node2]
829 ctx2 = repo[node2]
830 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
830 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
831 tempnode2 = node2
831 tempnode2 = node2
832 try:
832 try:
833 if node2 is not None:
833 if node2 is not None:
834 tempnode2 = ctx2.substate[subpath][1]
834 tempnode2 = ctx2.substate[subpath][1]
835 except KeyError:
835 except KeyError:
836 # A subrepo that existed in node1 was deleted between node1 and
836 # A subrepo that existed in node1 was deleted between node1 and
837 # node2 (inclusive). Thus, ctx2's substate won't contain that
837 # node2 (inclusive). Thus, ctx2's substate won't contain that
838 # subpath. The best we can do is to ignore it.
838 # subpath. The best we can do is to ignore it.
839 tempnode2 = None
839 tempnode2 = None
840 submatch = matchmod.narrowmatcher(subpath, match)
840 submatch = matchmod.narrowmatcher(subpath, match)
841 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
841 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
842 stat=stat, fp=fp, prefix=prefix)
842 stat=stat, fp=fp, prefix=prefix)
843
843
844 class changeset_printer(object):
844 class changeset_printer(object):
845 '''show changeset information when templating not requested.'''
845 '''show changeset information when templating not requested.'''
846
846
847 def __init__(self, ui, repo, matchfn, diffopts, buffered):
847 def __init__(self, ui, repo, matchfn, diffopts, buffered):
848 self.ui = ui
848 self.ui = ui
849 self.repo = repo
849 self.repo = repo
850 self.buffered = buffered
850 self.buffered = buffered
851 self.matchfn = matchfn
851 self.matchfn = matchfn
852 self.diffopts = diffopts
852 self.diffopts = diffopts
853 self.header = {}
853 self.header = {}
854 self.hunk = {}
854 self.hunk = {}
855 self.lastheader = None
855 self.lastheader = None
856 self.footer = None
856 self.footer = None
857
857
858 def flush(self, rev):
858 def flush(self, rev):
859 if rev in self.header:
859 if rev in self.header:
860 h = self.header[rev]
860 h = self.header[rev]
861 if h != self.lastheader:
861 if h != self.lastheader:
862 self.lastheader = h
862 self.lastheader = h
863 self.ui.write(h)
863 self.ui.write(h)
864 del self.header[rev]
864 del self.header[rev]
865 if rev in self.hunk:
865 if rev in self.hunk:
866 self.ui.write(self.hunk[rev])
866 self.ui.write(self.hunk[rev])
867 del self.hunk[rev]
867 del self.hunk[rev]
868 return 1
868 return 1
869 return 0
869 return 0
870
870
871 def close(self):
871 def close(self):
872 if self.footer:
872 if self.footer:
873 self.ui.write(self.footer)
873 self.ui.write(self.footer)
874
874
875 def show(self, ctx, copies=None, matchfn=None, **props):
875 def show(self, ctx, copies=None, matchfn=None, **props):
876 if self.buffered:
876 if self.buffered:
877 self.ui.pushbuffer()
877 self.ui.pushbuffer()
878 self._show(ctx, copies, matchfn, props)
878 self._show(ctx, copies, matchfn, props)
879 self.hunk[ctx.rev()] = self.ui.popbuffer(labeled=True)
879 self.hunk[ctx.rev()] = self.ui.popbuffer(labeled=True)
880 else:
880 else:
881 self._show(ctx, copies, matchfn, props)
881 self._show(ctx, copies, matchfn, props)
882
882
883 def _show(self, ctx, copies, matchfn, props):
883 def _show(self, ctx, copies, matchfn, props):
884 '''show a single changeset or file revision'''
884 '''show a single changeset or file revision'''
885 changenode = ctx.node()
885 changenode = ctx.node()
886 rev = ctx.rev()
886 rev = ctx.rev()
887
887
888 if self.ui.quiet:
888 if self.ui.quiet:
889 self.ui.write("%d:%s\n" % (rev, short(changenode)),
889 self.ui.write("%d:%s\n" % (rev, short(changenode)),
890 label='log.node')
890 label='log.node')
891 return
891 return
892
892
893 log = self.repo.changelog
893 log = self.repo.changelog
894 date = util.datestr(ctx.date())
894 date = util.datestr(ctx.date())
895
895
896 hexfunc = self.ui.debugflag and hex or short
896 hexfunc = self.ui.debugflag and hex or short
897
897
898 parents = [(p, hexfunc(log.node(p)))
898 parents = [(p, hexfunc(log.node(p)))
899 for p in self._meaningful_parentrevs(log, rev)]
899 for p in self._meaningful_parentrevs(log, rev)]
900
900
901 # i18n: column positioning for "hg log"
901 # i18n: column positioning for "hg log"
902 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)),
902 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)),
903 label='log.changeset changeset.%s' % ctx.phasestr())
903 label='log.changeset changeset.%s' % ctx.phasestr())
904
904
905 # branches are shown first before any other names due to backwards
905 # branches are shown first before any other names due to backwards
906 # compatibility
906 # compatibility
907 branch = ctx.branch()
907 branch = ctx.branch()
908 # don't show the default branch name
908 # don't show the default branch name
909 if branch != 'default':
909 if branch != 'default':
910 # i18n: column positioning for "hg log"
910 # i18n: column positioning for "hg log"
911 self.ui.write(_("branch: %s\n") % branch,
911 self.ui.write(_("branch: %s\n") % branch,
912 label='log.branch')
912 label='log.branch')
913
913
914 for name, ns in self.repo.names.iteritems():
914 for name, ns in self.repo.names.iteritems():
915 # branches has special logic already handled above, so here we just
915 # branches has special logic already handled above, so here we just
916 # skip it
916 # skip it
917 if name == 'branches':
917 if name == 'branches':
918 continue
918 continue
919 # we will use the templatename as the color name since those two
919 # we will use the templatename as the color name since those two
920 # should be the same
920 # should be the same
921 for name in ns.names(self.repo, changenode):
921 for name in ns.names(self.repo, changenode):
922 self.ui.write(ns.logfmt % name,
922 self.ui.write(ns.logfmt % name,
923 label='log.%s' % ns.colorname)
923 label='log.%s' % ns.colorname)
924 if self.ui.debugflag:
924 if self.ui.debugflag:
925 # i18n: column positioning for "hg log"
925 # i18n: column positioning for "hg log"
926 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
926 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
927 label='log.phase')
927 label='log.phase')
928 for parent in parents:
928 for parent in parents:
929 label = 'log.parent changeset.%s' % self.repo[parent[0]].phasestr()
929 label = 'log.parent changeset.%s' % self.repo[parent[0]].phasestr()
930 # i18n: column positioning for "hg log"
930 # i18n: column positioning for "hg log"
931 self.ui.write(_("parent: %d:%s\n") % parent,
931 self.ui.write(_("parent: %d:%s\n") % parent,
932 label=label)
932 label=label)
933
933
934 if self.ui.debugflag:
934 if self.ui.debugflag:
935 mnode = ctx.manifestnode()
935 mnode = ctx.manifestnode()
936 # i18n: column positioning for "hg log"
936 # i18n: column positioning for "hg log"
937 self.ui.write(_("manifest: %d:%s\n") %
937 self.ui.write(_("manifest: %d:%s\n") %
938 (self.repo.manifest.rev(mnode), hex(mnode)),
938 (self.repo.manifest.rev(mnode), hex(mnode)),
939 label='ui.debug log.manifest')
939 label='ui.debug log.manifest')
940 # i18n: column positioning for "hg log"
940 # i18n: column positioning for "hg log"
941 self.ui.write(_("user: %s\n") % ctx.user(),
941 self.ui.write(_("user: %s\n") % ctx.user(),
942 label='log.user')
942 label='log.user')
943 # i18n: column positioning for "hg log"
943 # i18n: column positioning for "hg log"
944 self.ui.write(_("date: %s\n") % date,
944 self.ui.write(_("date: %s\n") % date,
945 label='log.date')
945 label='log.date')
946
946
947 if self.ui.debugflag:
947 if self.ui.debugflag:
948 files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
948 files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
949 for key, value in zip([# i18n: column positioning for "hg log"
949 for key, value in zip([# i18n: column positioning for "hg log"
950 _("files:"),
950 _("files:"),
951 # i18n: column positioning for "hg log"
951 # i18n: column positioning for "hg log"
952 _("files+:"),
952 _("files+:"),
953 # i18n: column positioning for "hg log"
953 # i18n: column positioning for "hg log"
954 _("files-:")], files):
954 _("files-:")], files):
955 if value:
955 if value:
956 self.ui.write("%-12s %s\n" % (key, " ".join(value)),
956 self.ui.write("%-12s %s\n" % (key, " ".join(value)),
957 label='ui.debug log.files')
957 label='ui.debug log.files')
958 elif ctx.files() and self.ui.verbose:
958 elif ctx.files() and self.ui.verbose:
959 # i18n: column positioning for "hg log"
959 # i18n: column positioning for "hg log"
960 self.ui.write(_("files: %s\n") % " ".join(ctx.files()),
960 self.ui.write(_("files: %s\n") % " ".join(ctx.files()),
961 label='ui.note log.files')
961 label='ui.note log.files')
962 if copies and self.ui.verbose:
962 if copies and self.ui.verbose:
963 copies = ['%s (%s)' % c for c in copies]
963 copies = ['%s (%s)' % c for c in copies]
964 # i18n: column positioning for "hg log"
964 # i18n: column positioning for "hg log"
965 self.ui.write(_("copies: %s\n") % ' '.join(copies),
965 self.ui.write(_("copies: %s\n") % ' '.join(copies),
966 label='ui.note log.copies')
966 label='ui.note log.copies')
967
967
968 extra = ctx.extra()
968 extra = ctx.extra()
969 if extra and self.ui.debugflag:
969 if extra and self.ui.debugflag:
970 for key, value in sorted(extra.items()):
970 for key, value in sorted(extra.items()):
971 # i18n: column positioning for "hg log"
971 # i18n: column positioning for "hg log"
972 self.ui.write(_("extra: %s=%s\n")
972 self.ui.write(_("extra: %s=%s\n")
973 % (key, value.encode('string_escape')),
973 % (key, value.encode('string_escape')),
974 label='ui.debug log.extra')
974 label='ui.debug log.extra')
975
975
976 description = ctx.description().strip()
976 description = ctx.description().strip()
977 if description:
977 if description:
978 if self.ui.verbose:
978 if self.ui.verbose:
979 self.ui.write(_("description:\n"),
979 self.ui.write(_("description:\n"),
980 label='ui.note log.description')
980 label='ui.note log.description')
981 self.ui.write(description,
981 self.ui.write(description,
982 label='ui.note log.description')
982 label='ui.note log.description')
983 self.ui.write("\n\n")
983 self.ui.write("\n\n")
984 else:
984 else:
985 # i18n: column positioning for "hg log"
985 # i18n: column positioning for "hg log"
986 self.ui.write(_("summary: %s\n") %
986 self.ui.write(_("summary: %s\n") %
987 description.splitlines()[0],
987 description.splitlines()[0],
988 label='log.summary')
988 label='log.summary')
989 self.ui.write("\n")
989 self.ui.write("\n")
990
990
991 self.showpatch(changenode, matchfn)
991 self.showpatch(changenode, matchfn)
992
992
993 def showpatch(self, node, matchfn):
993 def showpatch(self, node, matchfn):
994 if not matchfn:
994 if not matchfn:
995 matchfn = self.matchfn
995 matchfn = self.matchfn
996 if matchfn:
996 if matchfn:
997 stat = self.diffopts.get('stat')
997 stat = self.diffopts.get('stat')
998 diff = self.diffopts.get('patch')
998 diff = self.diffopts.get('patch')
999 diffopts = patch.diffallopts(self.ui, self.diffopts)
999 diffopts = patch.diffallopts(self.ui, self.diffopts)
1000 prev = self.repo.changelog.parents(node)[0]
1000 prev = self.repo.changelog.parents(node)[0]
1001 if stat:
1001 if stat:
1002 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1002 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1003 match=matchfn, stat=True)
1003 match=matchfn, stat=True)
1004 if diff:
1004 if diff:
1005 if stat:
1005 if stat:
1006 self.ui.write("\n")
1006 self.ui.write("\n")
1007 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1007 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1008 match=matchfn, stat=False)
1008 match=matchfn, stat=False)
1009 self.ui.write("\n")
1009 self.ui.write("\n")
1010
1010
1011 def _meaningful_parentrevs(self, log, rev):
1011 def _meaningful_parentrevs(self, log, rev):
1012 """Return list of meaningful (or all if debug) parentrevs for rev.
1012 """Return list of meaningful (or all if debug) parentrevs for rev.
1013
1013
1014 For merges (two non-nullrev revisions) both parents are meaningful.
1014 For merges (two non-nullrev revisions) both parents are meaningful.
1015 Otherwise the first parent revision is considered meaningful if it
1015 Otherwise the first parent revision is considered meaningful if it
1016 is not the preceding revision.
1016 is not the preceding revision.
1017 """
1017 """
1018 parents = log.parentrevs(rev)
1018 parents = log.parentrevs(rev)
1019 if not self.ui.debugflag and parents[1] == nullrev:
1019 if not self.ui.debugflag and parents[1] == nullrev:
1020 if parents[0] >= rev - 1:
1020 if parents[0] >= rev - 1:
1021 parents = []
1021 parents = []
1022 else:
1022 else:
1023 parents = [parents[0]]
1023 parents = [parents[0]]
1024 return parents
1024 return parents
1025
1025
1026 class jsonchangeset(changeset_printer):
1026 class jsonchangeset(changeset_printer):
1027 '''format changeset information.'''
1027 '''format changeset information.'''
1028
1028
1029 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1029 def __init__(self, ui, repo, matchfn, diffopts, buffered):
1030 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1030 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1031 self.cache = {}
1031 self.cache = {}
1032 self._first = True
1032 self._first = True
1033
1033
1034 def close(self):
1034 def close(self):
1035 if not self._first:
1035 if not self._first:
1036 self.ui.write("\n]\n")
1036 self.ui.write("\n]\n")
1037 else:
1037 else:
1038 self.ui.write("[]\n")
1038 self.ui.write("[]\n")
1039
1039
1040 def _show(self, ctx, copies, matchfn, props):
1040 def _show(self, ctx, copies, matchfn, props):
1041 '''show a single changeset or file revision'''
1041 '''show a single changeset or file revision'''
1042 hexnode = hex(ctx.node())
1042 hexnode = hex(ctx.node())
1043 rev = ctx.rev()
1043 rev = ctx.rev()
1044 j = encoding.jsonescape
1044 j = encoding.jsonescape
1045
1045
1046 if self._first:
1046 if self._first:
1047 self.ui.write("[\n {")
1047 self.ui.write("[\n {")
1048 self._first = False
1048 self._first = False
1049 else:
1049 else:
1050 self.ui.write(",\n {")
1050 self.ui.write(",\n {")
1051
1051
1052 if self.ui.quiet:
1052 if self.ui.quiet:
1053 self.ui.write('\n "rev": %d' % rev)
1053 self.ui.write('\n "rev": %d' % rev)
1054 self.ui.write(',\n "node": "%s"' % hexnode)
1054 self.ui.write(',\n "node": "%s"' % hexnode)
1055 self.ui.write('\n }')
1055 self.ui.write('\n }')
1056 return
1056 return
1057
1057
1058 self.ui.write('\n "rev": %d' % rev)
1058 self.ui.write('\n "rev": %d' % rev)
1059 self.ui.write(',\n "node": "%s"' % hexnode)
1059 self.ui.write(',\n "node": "%s"' % hexnode)
1060 self.ui.write(',\n "branch": "%s"' % j(ctx.branch()))
1060 self.ui.write(',\n "branch": "%s"' % j(ctx.branch()))
1061 self.ui.write(',\n "phase": "%s"' % ctx.phasestr())
1061 self.ui.write(',\n "phase": "%s"' % ctx.phasestr())
1062 self.ui.write(',\n "user": "%s"' % j(ctx.user()))
1062 self.ui.write(',\n "user": "%s"' % j(ctx.user()))
1063 self.ui.write(',\n "date": [%d, %d]' % ctx.date())
1063 self.ui.write(',\n "date": [%d, %d]' % ctx.date())
1064 self.ui.write(',\n "desc": "%s"' % j(ctx.description()))
1064 self.ui.write(',\n "desc": "%s"' % j(ctx.description()))
1065
1065
1066 self.ui.write(',\n "bookmarks": [%s]' %
1066 self.ui.write(',\n "bookmarks": [%s]' %
1067 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1067 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
1068 self.ui.write(',\n "tags": [%s]' %
1068 self.ui.write(',\n "tags": [%s]' %
1069 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1069 ", ".join('"%s"' % j(t) for t in ctx.tags()))
1070 self.ui.write(',\n "parents": [%s]' %
1070 self.ui.write(',\n "parents": [%s]' %
1071 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1071 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
1072
1072
1073 if self.ui.debugflag:
1073 if self.ui.debugflag:
1074 self.ui.write(',\n "manifest": "%s"' % hex(ctx.manifestnode()))
1074 self.ui.write(',\n "manifest": "%s"' % hex(ctx.manifestnode()))
1075
1075
1076 self.ui.write(',\n "extra": {%s}' %
1076 self.ui.write(',\n "extra": {%s}' %
1077 ", ".join('"%s": "%s"' % (j(k), j(v))
1077 ", ".join('"%s": "%s"' % (j(k), j(v))
1078 for k, v in ctx.extra().items()))
1078 for k, v in ctx.extra().items()))
1079
1079
1080 files = ctx.p1().status(ctx)
1080 files = ctx.p1().status(ctx)
1081 self.ui.write(',\n "modified": [%s]' %
1081 self.ui.write(',\n "modified": [%s]' %
1082 ", ".join('"%s"' % j(f) for f in files[0]))
1082 ", ".join('"%s"' % j(f) for f in files[0]))
1083 self.ui.write(',\n "added": [%s]' %
1083 self.ui.write(',\n "added": [%s]' %
1084 ", ".join('"%s"' % j(f) for f in files[1]))
1084 ", ".join('"%s"' % j(f) for f in files[1]))
1085 self.ui.write(',\n "removed": [%s]' %
1085 self.ui.write(',\n "removed": [%s]' %
1086 ", ".join('"%s"' % j(f) for f in files[2]))
1086 ", ".join('"%s"' % j(f) for f in files[2]))
1087
1087
1088 elif self.ui.verbose:
1088 elif self.ui.verbose:
1089 self.ui.write(',\n "files": [%s]' %
1089 self.ui.write(',\n "files": [%s]' %
1090 ", ".join('"%s"' % j(f) for f in ctx.files()))
1090 ", ".join('"%s"' % j(f) for f in ctx.files()))
1091
1091
1092 if copies:
1092 if copies:
1093 self.ui.write(',\n "copies": {%s}' %
1093 self.ui.write(',\n "copies": {%s}' %
1094 ", ".join('"%s": "%s"' % (j(k), j(v))
1094 ", ".join('"%s": "%s"' % (j(k), j(v))
1095 for k, v in copies))
1095 for k, v in copies))
1096
1096
1097 matchfn = self.matchfn
1097 matchfn = self.matchfn
1098 if matchfn:
1098 if matchfn:
1099 stat = self.diffopts.get('stat')
1099 stat = self.diffopts.get('stat')
1100 diff = self.diffopts.get('patch')
1100 diff = self.diffopts.get('patch')
1101 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1101 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
1102 node, prev = ctx.node(), ctx.p1().node()
1102 node, prev = ctx.node(), ctx.p1().node()
1103 if stat:
1103 if stat:
1104 self.ui.pushbuffer()
1104 self.ui.pushbuffer()
1105 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1105 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1106 match=matchfn, stat=True)
1106 match=matchfn, stat=True)
1107 self.ui.write(',\n "diffstat": "%s"' % j(self.ui.popbuffer()))
1107 self.ui.write(',\n "diffstat": "%s"' % j(self.ui.popbuffer()))
1108 if diff:
1108 if diff:
1109 self.ui.pushbuffer()
1109 self.ui.pushbuffer()
1110 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1110 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
1111 match=matchfn, stat=False)
1111 match=matchfn, stat=False)
1112 self.ui.write(',\n "diff": "%s"' % j(self.ui.popbuffer()))
1112 self.ui.write(',\n "diff": "%s"' % j(self.ui.popbuffer()))
1113
1113
1114 self.ui.write("\n }")
1114 self.ui.write("\n }")
1115
1115
1116 class changeset_templater(changeset_printer):
1116 class changeset_templater(changeset_printer):
1117 '''format changeset information.'''
1117 '''format changeset information.'''
1118
1118
1119 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
1119 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
1120 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1120 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1121 formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12])
1121 formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12])
1122 defaulttempl = {
1122 defaulttempl = {
1123 'parent': '{rev}:{node|formatnode} ',
1123 'parent': '{rev}:{node|formatnode} ',
1124 'manifest': '{rev}:{node|formatnode}',
1124 'manifest': '{rev}:{node|formatnode}',
1125 'file_copy': '{name} ({source})',
1125 'file_copy': '{name} ({source})',
1126 'extra': '{key}={value|stringescape}'
1126 'extra': '{key}={value|stringescape}'
1127 }
1127 }
1128 # filecopy is preserved for compatibility reasons
1128 # filecopy is preserved for compatibility reasons
1129 defaulttempl['filecopy'] = defaulttempl['file_copy']
1129 defaulttempl['filecopy'] = defaulttempl['file_copy']
1130 self.t = templater.templater(mapfile, {'formatnode': formatnode},
1130 self.t = templater.templater(mapfile, {'formatnode': formatnode},
1131 cache=defaulttempl)
1131 cache=defaulttempl)
1132 if tmpl:
1132 if tmpl:
1133 self.t.cache['changeset'] = tmpl
1133 self.t.cache['changeset'] = tmpl
1134
1134
1135 self.cache = {}
1135 self.cache = {}
1136
1136
1137 def _meaningful_parentrevs(self, ctx):
1137 def _meaningful_parentrevs(self, ctx):
1138 """Return list of meaningful (or all if debug) parentrevs for rev.
1138 """Return list of meaningful (or all if debug) parentrevs for rev.
1139 """
1139 """
1140 parents = ctx.parents()
1140 parents = ctx.parents()
1141 if len(parents) > 1:
1141 if len(parents) > 1:
1142 return parents
1142 return parents
1143 if self.ui.debugflag:
1143 if self.ui.debugflag:
1144 return [parents[0], self.repo['null']]
1144 return [parents[0], self.repo['null']]
1145 if parents[0].rev() >= ctx.rev() - 1:
1145 if parents[0].rev() >= ctx.rev() - 1:
1146 return []
1146 return []
1147 return parents
1147 return parents
1148
1148
1149 def _show(self, ctx, copies, matchfn, props):
1149 def _show(self, ctx, copies, matchfn, props):
1150 '''show a single changeset or file revision'''
1150 '''show a single changeset or file revision'''
1151
1151
1152 showlist = templatekw.showlist
1152 showlist = templatekw.showlist
1153
1153
1154 # showparents() behaviour depends on ui trace level which
1154 # showparents() behaviour depends on ui trace level which
1155 # causes unexpected behaviours at templating level and makes
1155 # causes unexpected behaviours at templating level and makes
1156 # it harder to extract it in a standalone function. Its
1156 # it harder to extract it in a standalone function. Its
1157 # behaviour cannot be changed so leave it here for now.
1157 # behaviour cannot be changed so leave it here for now.
1158 def showparents(**args):
1158 def showparents(**args):
1159 ctx = args['ctx']
1159 ctx = args['ctx']
1160 parents = [[('rev', p.rev()),
1160 parents = [[('rev', p.rev()),
1161 ('node', p.hex()),
1161 ('node', p.hex()),
1162 ('phase', p.phasestr())]
1162 ('phase', p.phasestr())]
1163 for p in self._meaningful_parentrevs(ctx)]
1163 for p in self._meaningful_parentrevs(ctx)]
1164 return showlist('parent', parents, **args)
1164 return showlist('parent', parents, **args)
1165
1165
1166 props = props.copy()
1166 props = props.copy()
1167 props.update(templatekw.keywords)
1167 props.update(templatekw.keywords)
1168 props['parents'] = showparents
1168 props['parents'] = showparents
1169 props['templ'] = self.t
1169 props['templ'] = self.t
1170 props['ctx'] = ctx
1170 props['ctx'] = ctx
1171 props['repo'] = self.repo
1171 props['repo'] = self.repo
1172 props['revcache'] = {'copies': copies}
1172 props['revcache'] = {'copies': copies}
1173 props['cache'] = self.cache
1173 props['cache'] = self.cache
1174
1174
1175 # find correct templates for current mode
1175 # find correct templates for current mode
1176
1176
1177 tmplmodes = [
1177 tmplmodes = [
1178 (True, None),
1178 (True, None),
1179 (self.ui.verbose, 'verbose'),
1179 (self.ui.verbose, 'verbose'),
1180 (self.ui.quiet, 'quiet'),
1180 (self.ui.quiet, 'quiet'),
1181 (self.ui.debugflag, 'debug'),
1181 (self.ui.debugflag, 'debug'),
1182 ]
1182 ]
1183
1183
1184 types = {'header': '', 'footer':'', 'changeset': 'changeset'}
1184 types = {'header': '', 'footer':'', 'changeset': 'changeset'}
1185 for mode, postfix in tmplmodes:
1185 for mode, postfix in tmplmodes:
1186 for type in types:
1186 for type in types:
1187 cur = postfix and ('%s_%s' % (type, postfix)) or type
1187 cur = postfix and ('%s_%s' % (type, postfix)) or type
1188 if mode and cur in self.t:
1188 if mode and cur in self.t:
1189 types[type] = cur
1189 types[type] = cur
1190
1190
1191 try:
1191 try:
1192
1192
1193 # write header
1193 # write header
1194 if types['header']:
1194 if types['header']:
1195 h = templater.stringify(self.t(types['header'], **props))
1195 h = templater.stringify(self.t(types['header'], **props))
1196 if self.buffered:
1196 if self.buffered:
1197 self.header[ctx.rev()] = h
1197 self.header[ctx.rev()] = h
1198 else:
1198 else:
1199 if self.lastheader != h:
1199 if self.lastheader != h:
1200 self.lastheader = h
1200 self.lastheader = h
1201 self.ui.write(h)
1201 self.ui.write(h)
1202
1202
1203 # write changeset metadata, then patch if requested
1203 # write changeset metadata, then patch if requested
1204 key = types['changeset']
1204 key = types['changeset']
1205 self.ui.write(templater.stringify(self.t(key, **props)))
1205 self.ui.write(templater.stringify(self.t(key, **props)))
1206 self.showpatch(ctx.node(), matchfn)
1206 self.showpatch(ctx.node(), matchfn)
1207
1207
1208 if types['footer']:
1208 if types['footer']:
1209 if not self.footer:
1209 if not self.footer:
1210 self.footer = templater.stringify(self.t(types['footer'],
1210 self.footer = templater.stringify(self.t(types['footer'],
1211 **props))
1211 **props))
1212
1212
1213 except KeyError, inst:
1213 except KeyError, inst:
1214 msg = _("%s: no key named '%s'")
1214 msg = _("%s: no key named '%s'")
1215 raise util.Abort(msg % (self.t.mapfile, inst.args[0]))
1215 raise util.Abort(msg % (self.t.mapfile, inst.args[0]))
1216 except SyntaxError, inst:
1216 except SyntaxError, inst:
1217 raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0]))
1217 raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0]))
1218
1218
1219 def gettemplate(ui, tmpl, style):
1219 def gettemplate(ui, tmpl, style):
1220 """
1220 """
1221 Find the template matching the given template spec or style.
1221 Find the template matching the given template spec or style.
1222 """
1222 """
1223
1223
1224 # ui settings
1224 # ui settings
1225 if not tmpl and not style: # template are stronger than style
1225 if not tmpl and not style: # template are stronger than style
1226 tmpl = ui.config('ui', 'logtemplate')
1226 tmpl = ui.config('ui', 'logtemplate')
1227 if tmpl:
1227 if tmpl:
1228 try:
1228 try:
1229 tmpl = templater.parsestring(tmpl)
1229 tmpl = templater.parsestring(tmpl)
1230 except SyntaxError:
1230 except SyntaxError:
1231 tmpl = templater.parsestring(tmpl, quoted=False)
1231 tmpl = templater.parsestring(tmpl, quoted=False)
1232 return tmpl, None
1232 return tmpl, None
1233 else:
1233 else:
1234 style = util.expandpath(ui.config('ui', 'style', ''))
1234 style = util.expandpath(ui.config('ui', 'style', ''))
1235
1235
1236 if not tmpl and style:
1236 if not tmpl and style:
1237 mapfile = style
1237 mapfile = style
1238 if not os.path.split(mapfile)[0]:
1238 if not os.path.split(mapfile)[0]:
1239 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1239 mapname = (templater.templatepath('map-cmdline.' + mapfile)
1240 or templater.templatepath(mapfile))
1240 or templater.templatepath(mapfile))
1241 if mapname:
1241 if mapname:
1242 mapfile = mapname
1242 mapfile = mapname
1243 return None, mapfile
1243 return None, mapfile
1244
1244
1245 if not tmpl:
1245 if not tmpl:
1246 return None, None
1246 return None, None
1247
1247
1248 # looks like a literal template?
1248 # looks like a literal template?
1249 if '{' in tmpl:
1249 if '{' in tmpl:
1250 return tmpl, None
1250 return tmpl, None
1251
1251
1252 # perhaps a stock style?
1252 # perhaps a stock style?
1253 if not os.path.split(tmpl)[0]:
1253 if not os.path.split(tmpl)[0]:
1254 mapname = (templater.templatepath('map-cmdline.' + tmpl)
1254 mapname = (templater.templatepath('map-cmdline.' + tmpl)
1255 or templater.templatepath(tmpl))
1255 or templater.templatepath(tmpl))
1256 if mapname and os.path.isfile(mapname):
1256 if mapname and os.path.isfile(mapname):
1257 return None, mapname
1257 return None, mapname
1258
1258
1259 # perhaps it's a reference to [templates]
1259 # perhaps it's a reference to [templates]
1260 t = ui.config('templates', tmpl)
1260 t = ui.config('templates', tmpl)
1261 if t:
1261 if t:
1262 try:
1262 try:
1263 tmpl = templater.parsestring(t)
1263 tmpl = templater.parsestring(t)
1264 except SyntaxError:
1264 except SyntaxError:
1265 tmpl = templater.parsestring(t, quoted=False)
1265 tmpl = templater.parsestring(t, quoted=False)
1266 return tmpl, None
1266 return tmpl, None
1267
1267
1268 if tmpl == 'list':
1268 if tmpl == 'list':
1269 ui.write(_("available styles: %s\n") % templater.stylelist())
1269 ui.write(_("available styles: %s\n") % templater.stylelist())
1270 raise util.Abort(_("specify a template"))
1270 raise util.Abort(_("specify a template"))
1271
1271
1272 # perhaps it's a path to a map or a template
1272 # perhaps it's a path to a map or a template
1273 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
1273 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
1274 # is it a mapfile for a style?
1274 # is it a mapfile for a style?
1275 if os.path.basename(tmpl).startswith("map-"):
1275 if os.path.basename(tmpl).startswith("map-"):
1276 return None, os.path.realpath(tmpl)
1276 return None, os.path.realpath(tmpl)
1277 tmpl = open(tmpl).read()
1277 tmpl = open(tmpl).read()
1278 return tmpl, None
1278 return tmpl, None
1279
1279
1280 # constant string?
1280 # constant string?
1281 return tmpl, None
1281 return tmpl, None
1282
1282
1283 def show_changeset(ui, repo, opts, buffered=False):
1283 def show_changeset(ui, repo, opts, buffered=False):
1284 """show one changeset using template or regular display.
1284 """show one changeset using template or regular display.
1285
1285
1286 Display format will be the first non-empty hit of:
1286 Display format will be the first non-empty hit of:
1287 1. option 'template'
1287 1. option 'template'
1288 2. option 'style'
1288 2. option 'style'
1289 3. [ui] setting 'logtemplate'
1289 3. [ui] setting 'logtemplate'
1290 4. [ui] setting 'style'
1290 4. [ui] setting 'style'
1291 If all of these values are either the unset or the empty string,
1291 If all of these values are either the unset or the empty string,
1292 regular display via changeset_printer() is done.
1292 regular display via changeset_printer() is done.
1293 """
1293 """
1294 # options
1294 # options
1295 matchfn = None
1295 matchfn = None
1296 if opts.get('patch') or opts.get('stat'):
1296 if opts.get('patch') or opts.get('stat'):
1297 matchfn = scmutil.matchall(repo)
1297 matchfn = scmutil.matchall(repo)
1298
1298
1299 if opts.get('template') == 'json':
1299 if opts.get('template') == 'json':
1300 return jsonchangeset(ui, repo, matchfn, opts, buffered)
1300 return jsonchangeset(ui, repo, matchfn, opts, buffered)
1301
1301
1302 tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style'))
1302 tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style'))
1303
1303
1304 if not tmpl and not mapfile:
1304 if not tmpl and not mapfile:
1305 return changeset_printer(ui, repo, matchfn, opts, buffered)
1305 return changeset_printer(ui, repo, matchfn, opts, buffered)
1306
1306
1307 try:
1307 try:
1308 t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile,
1308 t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile,
1309 buffered)
1309 buffered)
1310 except SyntaxError, inst:
1310 except SyntaxError, inst:
1311 raise util.Abort(inst.args[0])
1311 raise util.Abort(inst.args[0])
1312 return t
1312 return t
1313
1313
1314 def showmarker(ui, marker):
1314 def showmarker(ui, marker):
1315 """utility function to display obsolescence marker in a readable way
1315 """utility function to display obsolescence marker in a readable way
1316
1316
1317 To be used by debug function."""
1317 To be used by debug function."""
1318 ui.write(hex(marker.precnode()))
1318 ui.write(hex(marker.precnode()))
1319 for repl in marker.succnodes():
1319 for repl in marker.succnodes():
1320 ui.write(' ')
1320 ui.write(' ')
1321 ui.write(hex(repl))
1321 ui.write(hex(repl))
1322 ui.write(' %X ' % marker.flags())
1322 ui.write(' %X ' % marker.flags())
1323 parents = marker.parentnodes()
1323 parents = marker.parentnodes()
1324 if parents is not None:
1324 if parents is not None:
1325 ui.write('{%s} ' % ', '.join(hex(p) for p in parents))
1325 ui.write('{%s} ' % ', '.join(hex(p) for p in parents))
1326 ui.write('(%s) ' % util.datestr(marker.date()))
1326 ui.write('(%s) ' % util.datestr(marker.date()))
1327 ui.write('{%s}' % (', '.join('%r: %r' % t for t in
1327 ui.write('{%s}' % (', '.join('%r: %r' % t for t in
1328 sorted(marker.metadata().items())
1328 sorted(marker.metadata().items())
1329 if t[0] != 'date')))
1329 if t[0] != 'date')))
1330 ui.write('\n')
1330 ui.write('\n')
1331
1331
1332 def finddate(ui, repo, date):
1332 def finddate(ui, repo, date):
1333 """Find the tipmost changeset that matches the given date spec"""
1333 """Find the tipmost changeset that matches the given date spec"""
1334
1334
1335 df = util.matchdate(date)
1335 df = util.matchdate(date)
1336 m = scmutil.matchall(repo)
1336 m = scmutil.matchall(repo)
1337 results = {}
1337 results = {}
1338
1338
1339 def prep(ctx, fns):
1339 def prep(ctx, fns):
1340 d = ctx.date()
1340 d = ctx.date()
1341 if df(d[0]):
1341 if df(d[0]):
1342 results[ctx.rev()] = d
1342 results[ctx.rev()] = d
1343
1343
1344 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
1344 for ctx in walkchangerevs(repo, m, {'rev': None}, prep):
1345 rev = ctx.rev()
1345 rev = ctx.rev()
1346 if rev in results:
1346 if rev in results:
1347 ui.status(_("found revision %s from %s\n") %
1347 ui.status(_("found revision %s from %s\n") %
1348 (rev, util.datestr(results[rev])))
1348 (rev, util.datestr(results[rev])))
1349 return str(rev)
1349 return str(rev)
1350
1350
1351 raise util.Abort(_("revision matching date not found"))
1351 raise util.Abort(_("revision matching date not found"))
1352
1352
1353 def increasingwindows(windowsize=8, sizelimit=512):
1353 def increasingwindows(windowsize=8, sizelimit=512):
1354 while True:
1354 while True:
1355 yield windowsize
1355 yield windowsize
1356 if windowsize < sizelimit:
1356 if windowsize < sizelimit:
1357 windowsize *= 2
1357 windowsize *= 2
1358
1358
1359 class FileWalkError(Exception):
1359 class FileWalkError(Exception):
1360 pass
1360 pass
1361
1361
1362 def walkfilerevs(repo, match, follow, revs, fncache):
1362 def walkfilerevs(repo, match, follow, revs, fncache):
1363 '''Walks the file history for the matched files.
1363 '''Walks the file history for the matched files.
1364
1364
1365 Returns the changeset revs that are involved in the file history.
1365 Returns the changeset revs that are involved in the file history.
1366
1366
1367 Throws FileWalkError if the file history can't be walked using
1367 Throws FileWalkError if the file history can't be walked using
1368 filelogs alone.
1368 filelogs alone.
1369 '''
1369 '''
1370 wanted = set()
1370 wanted = set()
1371 copies = []
1371 copies = []
1372 minrev, maxrev = min(revs), max(revs)
1372 minrev, maxrev = min(revs), max(revs)
1373 def filerevgen(filelog, last):
1373 def filerevgen(filelog, last):
1374 """
1374 """
1375 Only files, no patterns. Check the history of each file.
1375 Only files, no patterns. Check the history of each file.
1376
1376
1377 Examines filelog entries within minrev, maxrev linkrev range
1377 Examines filelog entries within minrev, maxrev linkrev range
1378 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
1378 Returns an iterator yielding (linkrev, parentlinkrevs, copied)
1379 tuples in backwards order
1379 tuples in backwards order
1380 """
1380 """
1381 cl_count = len(repo)
1381 cl_count = len(repo)
1382 revs = []
1382 revs = []
1383 for j in xrange(0, last + 1):
1383 for j in xrange(0, last + 1):
1384 linkrev = filelog.linkrev(j)
1384 linkrev = filelog.linkrev(j)
1385 if linkrev < minrev:
1385 if linkrev < minrev:
1386 continue
1386 continue
1387 # only yield rev for which we have the changelog, it can
1387 # only yield rev for which we have the changelog, it can
1388 # happen while doing "hg log" during a pull or commit
1388 # happen while doing "hg log" during a pull or commit
1389 if linkrev >= cl_count:
1389 if linkrev >= cl_count:
1390 break
1390 break
1391
1391
1392 parentlinkrevs = []
1392 parentlinkrevs = []
1393 for p in filelog.parentrevs(j):
1393 for p in filelog.parentrevs(j):
1394 if p != nullrev:
1394 if p != nullrev:
1395 parentlinkrevs.append(filelog.linkrev(p))
1395 parentlinkrevs.append(filelog.linkrev(p))
1396 n = filelog.node(j)
1396 n = filelog.node(j)
1397 revs.append((linkrev, parentlinkrevs,
1397 revs.append((linkrev, parentlinkrevs,
1398 follow and filelog.renamed(n)))
1398 follow and filelog.renamed(n)))
1399
1399
1400 return reversed(revs)
1400 return reversed(revs)
1401 def iterfiles():
1401 def iterfiles():
1402 pctx = repo['.']
1402 pctx = repo['.']
1403 for filename in match.files():
1403 for filename in match.files():
1404 if follow:
1404 if follow:
1405 if filename not in pctx:
1405 if filename not in pctx:
1406 raise util.Abort(_('cannot follow file not in parent '
1406 raise util.Abort(_('cannot follow file not in parent '
1407 'revision: "%s"') % filename)
1407 'revision: "%s"') % filename)
1408 yield filename, pctx[filename].filenode()
1408 yield filename, pctx[filename].filenode()
1409 else:
1409 else:
1410 yield filename, None
1410 yield filename, None
1411 for filename_node in copies:
1411 for filename_node in copies:
1412 yield filename_node
1412 yield filename_node
1413
1413
1414 for file_, node in iterfiles():
1414 for file_, node in iterfiles():
1415 filelog = repo.file(file_)
1415 filelog = repo.file(file_)
1416 if not len(filelog):
1416 if not len(filelog):
1417 if node is None:
1417 if node is None:
1418 # A zero count may be a directory or deleted file, so
1418 # A zero count may be a directory or deleted file, so
1419 # try to find matching entries on the slow path.
1419 # try to find matching entries on the slow path.
1420 if follow:
1420 if follow:
1421 raise util.Abort(
1421 raise util.Abort(
1422 _('cannot follow nonexistent file: "%s"') % file_)
1422 _('cannot follow nonexistent file: "%s"') % file_)
1423 raise FileWalkError("Cannot walk via filelog")
1423 raise FileWalkError("Cannot walk via filelog")
1424 else:
1424 else:
1425 continue
1425 continue
1426
1426
1427 if node is None:
1427 if node is None:
1428 last = len(filelog) - 1
1428 last = len(filelog) - 1
1429 else:
1429 else:
1430 last = filelog.rev(node)
1430 last = filelog.rev(node)
1431
1431
1432
1432
1433 # keep track of all ancestors of the file
1433 # keep track of all ancestors of the file
1434 ancestors = set([filelog.linkrev(last)])
1434 ancestors = set([filelog.linkrev(last)])
1435
1435
1436 # iterate from latest to oldest revision
1436 # iterate from latest to oldest revision
1437 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
1437 for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
1438 if not follow:
1438 if not follow:
1439 if rev > maxrev:
1439 if rev > maxrev:
1440 continue
1440 continue
1441 else:
1441 else:
1442 # Note that last might not be the first interesting
1442 # Note that last might not be the first interesting
1443 # rev to us:
1443 # rev to us:
1444 # if the file has been changed after maxrev, we'll
1444 # if the file has been changed after maxrev, we'll
1445 # have linkrev(last) > maxrev, and we still need
1445 # have linkrev(last) > maxrev, and we still need
1446 # to explore the file graph
1446 # to explore the file graph
1447 if rev not in ancestors:
1447 if rev not in ancestors:
1448 continue
1448 continue
1449 # XXX insert 1327 fix here
1449 # XXX insert 1327 fix here
1450 if flparentlinkrevs:
1450 if flparentlinkrevs:
1451 ancestors.update(flparentlinkrevs)
1451 ancestors.update(flparentlinkrevs)
1452
1452
1453 fncache.setdefault(rev, []).append(file_)
1453 fncache.setdefault(rev, []).append(file_)
1454 wanted.add(rev)
1454 wanted.add(rev)
1455 if copied:
1455 if copied:
1456 copies.append(copied)
1456 copies.append(copied)
1457
1457
1458 return wanted
1458 return wanted
1459
1459
1460 def walkchangerevs(repo, match, opts, prepare):
1460 def walkchangerevs(repo, match, opts, prepare):
1461 '''Iterate over files and the revs in which they changed.
1461 '''Iterate over files and the revs in which they changed.
1462
1462
1463 Callers most commonly need to iterate backwards over the history
1463 Callers most commonly need to iterate backwards over the history
1464 in which they are interested. Doing so has awful (quadratic-looking)
1464 in which they are interested. Doing so has awful (quadratic-looking)
1465 performance, so we use iterators in a "windowed" way.
1465 performance, so we use iterators in a "windowed" way.
1466
1466
1467 We walk a window of revisions in the desired order. Within the
1467 We walk a window of revisions in the desired order. Within the
1468 window, we first walk forwards to gather data, then in the desired
1468 window, we first walk forwards to gather data, then in the desired
1469 order (usually backwards) to display it.
1469 order (usually backwards) to display it.
1470
1470
1471 This function returns an iterator yielding contexts. Before
1471 This function returns an iterator yielding contexts. Before
1472 yielding each context, the iterator will first call the prepare
1472 yielding each context, the iterator will first call the prepare
1473 function on each context in the window in forward order.'''
1473 function on each context in the window in forward order.'''
1474
1474
1475 follow = opts.get('follow') or opts.get('follow_first')
1475 follow = opts.get('follow') or opts.get('follow_first')
1476
1476
1477 if opts.get('rev'):
1477 if opts.get('rev'):
1478 revs = scmutil.revrange(repo, opts.get('rev'))
1478 revs = scmutil.revrange(repo, opts.get('rev'))
1479 elif follow:
1479 elif follow:
1480 revs = repo.revs('reverse(:.)')
1480 revs = repo.revs('reverse(:.)')
1481 else:
1481 else:
1482 revs = revset.spanset(repo)
1482 revs = revset.spanset(repo)
1483 revs.reverse()
1483 revs.reverse()
1484 if not revs:
1484 if not revs:
1485 return []
1485 return []
1486 wanted = set()
1486 wanted = set()
1487 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1487 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1488 fncache = {}
1488 fncache = {}
1489 change = repo.changectx
1489 change = repo.changectx
1490
1490
1491 # First step is to fill wanted, the set of revisions that we want to yield.
1491 # First step is to fill wanted, the set of revisions that we want to yield.
1492 # When it does not induce extra cost, we also fill fncache for revisions in
1492 # When it does not induce extra cost, we also fill fncache for revisions in
1493 # wanted: a cache of filenames that were changed (ctx.files()) and that
1493 # wanted: a cache of filenames that were changed (ctx.files()) and that
1494 # match the file filtering conditions.
1494 # match the file filtering conditions.
1495
1495
1496 if not slowpath and not match.files():
1496 if not slowpath and not match.files():
1497 # No files, no patterns. Display all revs.
1497 # No files, no patterns. Display all revs.
1498 wanted = revs
1498 wanted = revs
1499
1499
1500 if not slowpath and match.files():
1500 if not slowpath and match.files():
1501 # We only have to read through the filelog to find wanted revisions
1501 # We only have to read through the filelog to find wanted revisions
1502
1502
1503 try:
1503 try:
1504 wanted = walkfilerevs(repo, match, follow, revs, fncache)
1504 wanted = walkfilerevs(repo, match, follow, revs, fncache)
1505 except FileWalkError:
1505 except FileWalkError:
1506 slowpath = True
1506 slowpath = True
1507
1507
1508 # We decided to fall back to the slowpath because at least one
1508 # We decided to fall back to the slowpath because at least one
1509 # of the paths was not a file. Check to see if at least one of them
1509 # of the paths was not a file. Check to see if at least one of them
1510 # existed in history, otherwise simply return
1510 # existed in history, otherwise simply return
1511 for path in match.files():
1511 for path in match.files():
1512 if path == '.' or path in repo.store:
1512 if path == '.' or path in repo.store:
1513 break
1513 break
1514 else:
1514 else:
1515 return []
1515 return []
1516
1516
1517 if slowpath:
1517 if slowpath:
1518 # We have to read the changelog to match filenames against
1518 # We have to read the changelog to match filenames against
1519 # changed files
1519 # changed files
1520
1520
1521 if follow:
1521 if follow:
1522 raise util.Abort(_('can only follow copies/renames for explicit '
1522 raise util.Abort(_('can only follow copies/renames for explicit '
1523 'filenames'))
1523 'filenames'))
1524
1524
1525 # The slow path checks files modified in every changeset.
1525 # The slow path checks files modified in every changeset.
1526 # This is really slow on large repos, so compute the set lazily.
1526 # This is really slow on large repos, so compute the set lazily.
1527 class lazywantedset(object):
1527 class lazywantedset(object):
1528 def __init__(self):
1528 def __init__(self):
1529 self.set = set()
1529 self.set = set()
1530 self.revs = set(revs)
1530 self.revs = set(revs)
1531
1531
1532 # No need to worry about locality here because it will be accessed
1532 # No need to worry about locality here because it will be accessed
1533 # in the same order as the increasing window below.
1533 # in the same order as the increasing window below.
1534 def __contains__(self, value):
1534 def __contains__(self, value):
1535 if value in self.set:
1535 if value in self.set:
1536 return True
1536 return True
1537 elif not value in self.revs:
1537 elif not value in self.revs:
1538 return False
1538 return False
1539 else:
1539 else:
1540 self.revs.discard(value)
1540 self.revs.discard(value)
1541 ctx = change(value)
1541 ctx = change(value)
1542 matches = filter(match, ctx.files())
1542 matches = filter(match, ctx.files())
1543 if matches:
1543 if matches:
1544 fncache[value] = matches
1544 fncache[value] = matches
1545 self.set.add(value)
1545 self.set.add(value)
1546 return True
1546 return True
1547 return False
1547 return False
1548
1548
1549 def discard(self, value):
1549 def discard(self, value):
1550 self.revs.discard(value)
1550 self.revs.discard(value)
1551 self.set.discard(value)
1551 self.set.discard(value)
1552
1552
1553 wanted = lazywantedset()
1553 wanted = lazywantedset()
1554
1554
1555 class followfilter(object):
1555 class followfilter(object):
1556 def __init__(self, onlyfirst=False):
1556 def __init__(self, onlyfirst=False):
1557 self.startrev = nullrev
1557 self.startrev = nullrev
1558 self.roots = set()
1558 self.roots = set()
1559 self.onlyfirst = onlyfirst
1559 self.onlyfirst = onlyfirst
1560
1560
1561 def match(self, rev):
1561 def match(self, rev):
1562 def realparents(rev):
1562 def realparents(rev):
1563 if self.onlyfirst:
1563 if self.onlyfirst:
1564 return repo.changelog.parentrevs(rev)[0:1]
1564 return repo.changelog.parentrevs(rev)[0:1]
1565 else:
1565 else:
1566 return filter(lambda x: x != nullrev,
1566 return filter(lambda x: x != nullrev,
1567 repo.changelog.parentrevs(rev))
1567 repo.changelog.parentrevs(rev))
1568
1568
1569 if self.startrev == nullrev:
1569 if self.startrev == nullrev:
1570 self.startrev = rev
1570 self.startrev = rev
1571 return True
1571 return True
1572
1572
1573 if rev > self.startrev:
1573 if rev > self.startrev:
1574 # forward: all descendants
1574 # forward: all descendants
1575 if not self.roots:
1575 if not self.roots:
1576 self.roots.add(self.startrev)
1576 self.roots.add(self.startrev)
1577 for parent in realparents(rev):
1577 for parent in realparents(rev):
1578 if parent in self.roots:
1578 if parent in self.roots:
1579 self.roots.add(rev)
1579 self.roots.add(rev)
1580 return True
1580 return True
1581 else:
1581 else:
1582 # backwards: all parents
1582 # backwards: all parents
1583 if not self.roots:
1583 if not self.roots:
1584 self.roots.update(realparents(self.startrev))
1584 self.roots.update(realparents(self.startrev))
1585 if rev in self.roots:
1585 if rev in self.roots:
1586 self.roots.remove(rev)
1586 self.roots.remove(rev)
1587 self.roots.update(realparents(rev))
1587 self.roots.update(realparents(rev))
1588 return True
1588 return True
1589
1589
1590 return False
1590 return False
1591
1591
1592 # it might be worthwhile to do this in the iterator if the rev range
1592 # it might be worthwhile to do this in the iterator if the rev range
1593 # is descending and the prune args are all within that range
1593 # is descending and the prune args are all within that range
1594 for rev in opts.get('prune', ()):
1594 for rev in opts.get('prune', ()):
1595 rev = repo[rev].rev()
1595 rev = repo[rev].rev()
1596 ff = followfilter()
1596 ff = followfilter()
1597 stop = min(revs[0], revs[-1])
1597 stop = min(revs[0], revs[-1])
1598 for x in xrange(rev, stop - 1, -1):
1598 for x in xrange(rev, stop - 1, -1):
1599 if ff.match(x):
1599 if ff.match(x):
1600 wanted = wanted - [x]
1600 wanted = wanted - [x]
1601
1601
1602 # Now that wanted is correctly initialized, we can iterate over the
1602 # Now that wanted is correctly initialized, we can iterate over the
1603 # revision range, yielding only revisions in wanted.
1603 # revision range, yielding only revisions in wanted.
1604 def iterate():
1604 def iterate():
1605 if follow and not match.files():
1605 if follow and not match.files():
1606 ff = followfilter(onlyfirst=opts.get('follow_first'))
1606 ff = followfilter(onlyfirst=opts.get('follow_first'))
1607 def want(rev):
1607 def want(rev):
1608 return ff.match(rev) and rev in wanted
1608 return ff.match(rev) and rev in wanted
1609 else:
1609 else:
1610 def want(rev):
1610 def want(rev):
1611 return rev in wanted
1611 return rev in wanted
1612
1612
1613 it = iter(revs)
1613 it = iter(revs)
1614 stopiteration = False
1614 stopiteration = False
1615 for windowsize in increasingwindows():
1615 for windowsize in increasingwindows():
1616 nrevs = []
1616 nrevs = []
1617 for i in xrange(windowsize):
1617 for i in xrange(windowsize):
1618 try:
1618 try:
1619 rev = it.next()
1619 rev = it.next()
1620 if want(rev):
1620 if want(rev):
1621 nrevs.append(rev)
1621 nrevs.append(rev)
1622 except (StopIteration):
1622 except (StopIteration):
1623 stopiteration = True
1623 stopiteration = True
1624 break
1624 break
1625 for rev in sorted(nrevs):
1625 for rev in sorted(nrevs):
1626 fns = fncache.get(rev)
1626 fns = fncache.get(rev)
1627 ctx = change(rev)
1627 ctx = change(rev)
1628 if not fns:
1628 if not fns:
1629 def fns_generator():
1629 def fns_generator():
1630 for f in ctx.files():
1630 for f in ctx.files():
1631 if match(f):
1631 if match(f):
1632 yield f
1632 yield f
1633 fns = fns_generator()
1633 fns = fns_generator()
1634 prepare(ctx, fns)
1634 prepare(ctx, fns)
1635 for rev in nrevs:
1635 for rev in nrevs:
1636 yield change(rev)
1636 yield change(rev)
1637
1637
1638 if stopiteration:
1638 if stopiteration:
1639 break
1639 break
1640
1640
1641 return iterate()
1641 return iterate()
1642
1642
1643 def _makefollowlogfilematcher(repo, files, followfirst):
1643 def _makefollowlogfilematcher(repo, files, followfirst):
1644 # When displaying a revision with --patch --follow FILE, we have
1644 # When displaying a revision with --patch --follow FILE, we have
1645 # to know which file of the revision must be diffed. With
1645 # to know which file of the revision must be diffed. With
1646 # --follow, we want the names of the ancestors of FILE in the
1646 # --follow, we want the names of the ancestors of FILE in the
1647 # revision, stored in "fcache". "fcache" is populated by
1647 # revision, stored in "fcache". "fcache" is populated by
1648 # reproducing the graph traversal already done by --follow revset
1648 # reproducing the graph traversal already done by --follow revset
1649 # and relating linkrevs to file names (which is not "correct" but
1649 # and relating linkrevs to file names (which is not "correct" but
1650 # good enough).
1650 # good enough).
1651 fcache = {}
1651 fcache = {}
1652 fcacheready = [False]
1652 fcacheready = [False]
1653 pctx = repo['.']
1653 pctx = repo['.']
1654
1654
1655 def populate():
1655 def populate():
1656 for fn in files:
1656 for fn in files:
1657 for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
1657 for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)):
1658 for c in i:
1658 for c in i:
1659 fcache.setdefault(c.linkrev(), set()).add(c.path())
1659 fcache.setdefault(c.linkrev(), set()).add(c.path())
1660
1660
1661 def filematcher(rev):
1661 def filematcher(rev):
1662 if not fcacheready[0]:
1662 if not fcacheready[0]:
1663 # Lazy initialization
1663 # Lazy initialization
1664 fcacheready[0] = True
1664 fcacheready[0] = True
1665 populate()
1665 populate()
1666 return scmutil.matchfiles(repo, fcache.get(rev, []))
1666 return scmutil.matchfiles(repo, fcache.get(rev, []))
1667
1667
1668 return filematcher
1668 return filematcher
1669
1669
1670 def _makenofollowlogfilematcher(repo, pats, opts):
1670 def _makenofollowlogfilematcher(repo, pats, opts):
1671 '''hook for extensions to override the filematcher for non-follow cases'''
1671 '''hook for extensions to override the filematcher for non-follow cases'''
1672 return None
1672 return None
1673
1673
1674 def _makelogrevset(repo, pats, opts, revs):
1674 def _makelogrevset(repo, pats, opts, revs):
1675 """Return (expr, filematcher) where expr is a revset string built
1675 """Return (expr, filematcher) where expr is a revset string built
1676 from log options and file patterns or None. If --stat or --patch
1676 from log options and file patterns or None. If --stat or --patch
1677 are not passed filematcher is None. Otherwise it is a callable
1677 are not passed filematcher is None. Otherwise it is a callable
1678 taking a revision number and returning a match objects filtering
1678 taking a revision number and returning a match objects filtering
1679 the files to be detailed when displaying the revision.
1679 the files to be detailed when displaying the revision.
1680 """
1680 """
1681 opt2revset = {
1681 opt2revset = {
1682 'no_merges': ('not merge()', None),
1682 'no_merges': ('not merge()', None),
1683 'only_merges': ('merge()', None),
1683 'only_merges': ('merge()', None),
1684 '_ancestors': ('ancestors(%(val)s)', None),
1684 '_ancestors': ('ancestors(%(val)s)', None),
1685 '_fancestors': ('_firstancestors(%(val)s)', None),
1685 '_fancestors': ('_firstancestors(%(val)s)', None),
1686 '_descendants': ('descendants(%(val)s)', None),
1686 '_descendants': ('descendants(%(val)s)', None),
1687 '_fdescendants': ('_firstdescendants(%(val)s)', None),
1687 '_fdescendants': ('_firstdescendants(%(val)s)', None),
1688 '_matchfiles': ('_matchfiles(%(val)s)', None),
1688 '_matchfiles': ('_matchfiles(%(val)s)', None),
1689 'date': ('date(%(val)r)', None),
1689 'date': ('date(%(val)r)', None),
1690 'branch': ('branch(%(val)r)', ' or '),
1690 'branch': ('branch(%(val)r)', ' or '),
1691 '_patslog': ('filelog(%(val)r)', ' or '),
1691 '_patslog': ('filelog(%(val)r)', ' or '),
1692 '_patsfollow': ('follow(%(val)r)', ' or '),
1692 '_patsfollow': ('follow(%(val)r)', ' or '),
1693 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
1693 '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '),
1694 'keyword': ('keyword(%(val)r)', ' or '),
1694 'keyword': ('keyword(%(val)r)', ' or '),
1695 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
1695 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '),
1696 'user': ('user(%(val)r)', ' or '),
1696 'user': ('user(%(val)r)', ' or '),
1697 }
1697 }
1698
1698
1699 opts = dict(opts)
1699 opts = dict(opts)
1700 # follow or not follow?
1700 # follow or not follow?
1701 follow = opts.get('follow') or opts.get('follow_first')
1701 follow = opts.get('follow') or opts.get('follow_first')
1702 followfirst = opts.get('follow_first') and 1 or 0
1702 followfirst = opts.get('follow_first') and 1 or 0
1703 # --follow with FILE behaviour depends on revs...
1703 # --follow with FILE behaviour depends on revs...
1704 it = iter(revs)
1704 it = iter(revs)
1705 startrev = it.next()
1705 startrev = it.next()
1706 try:
1706 try:
1707 followdescendants = startrev < it.next()
1707 followdescendants = startrev < it.next()
1708 except (StopIteration):
1708 except (StopIteration):
1709 followdescendants = False
1709 followdescendants = False
1710
1710
1711 # branch and only_branch are really aliases and must be handled at
1711 # branch and only_branch are really aliases and must be handled at
1712 # the same time
1712 # the same time
1713 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
1713 opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
1714 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
1714 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
1715 # pats/include/exclude are passed to match.match() directly in
1715 # pats/include/exclude are passed to match.match() directly in
1716 # _matchfiles() revset but walkchangerevs() builds its matcher with
1716 # _matchfiles() revset but walkchangerevs() builds its matcher with
1717 # scmutil.match(). The difference is input pats are globbed on
1717 # scmutil.match(). The difference is input pats are globbed on
1718 # platforms without shell expansion (windows).
1718 # platforms without shell expansion (windows).
1719 pctx = repo[None]
1719 pctx = repo[None]
1720 match, pats = scmutil.matchandpats(pctx, pats, opts)
1720 match, pats = scmutil.matchandpats(pctx, pats, opts)
1721 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1721 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1722 if not slowpath:
1722 if not slowpath:
1723 for f in match.files():
1723 for f in match.files():
1724 if follow and f not in pctx:
1724 if follow and f not in pctx:
1725 # If the file exists, it may be a directory, so let it
1725 # If the file exists, it may be a directory, so let it
1726 # take the slow path.
1726 # take the slow path.
1727 if os.path.exists(repo.wjoin(f)):
1727 if os.path.exists(repo.wjoin(f)):
1728 slowpath = True
1728 slowpath = True
1729 continue
1729 continue
1730 else:
1730 else:
1731 raise util.Abort(_('cannot follow file not in parent '
1731 raise util.Abort(_('cannot follow file not in parent '
1732 'revision: "%s"') % f)
1732 'revision: "%s"') % f)
1733 filelog = repo.file(f)
1733 filelog = repo.file(f)
1734 if not filelog:
1734 if not filelog:
1735 # A zero count may be a directory or deleted file, so
1735 # A zero count may be a directory or deleted file, so
1736 # try to find matching entries on the slow path.
1736 # try to find matching entries on the slow path.
1737 if follow:
1737 if follow:
1738 raise util.Abort(
1738 raise util.Abort(
1739 _('cannot follow nonexistent file: "%s"') % f)
1739 _('cannot follow nonexistent file: "%s"') % f)
1740 slowpath = True
1740 slowpath = True
1741
1741
1742 # We decided to fall back to the slowpath because at least one
1742 # We decided to fall back to the slowpath because at least one
1743 # of the paths was not a file. Check to see if at least one of them
1743 # of the paths was not a file. Check to see if at least one of them
1744 # existed in history - in that case, we'll continue down the
1744 # existed in history - in that case, we'll continue down the
1745 # slowpath; otherwise, we can turn off the slowpath
1745 # slowpath; otherwise, we can turn off the slowpath
1746 if slowpath:
1746 if slowpath:
1747 for path in match.files():
1747 for path in match.files():
1748 if path == '.' or path in repo.store:
1748 if path == '.' or path in repo.store:
1749 break
1749 break
1750 else:
1750 else:
1751 slowpath = False
1751 slowpath = False
1752
1752
1753 fpats = ('_patsfollow', '_patsfollowfirst')
1753 fpats = ('_patsfollow', '_patsfollowfirst')
1754 fnopats = (('_ancestors', '_fancestors'),
1754 fnopats = (('_ancestors', '_fancestors'),
1755 ('_descendants', '_fdescendants'))
1755 ('_descendants', '_fdescendants'))
1756 if slowpath:
1756 if slowpath:
1757 # See walkchangerevs() slow path.
1757 # See walkchangerevs() slow path.
1758 #
1758 #
1759 # pats/include/exclude cannot be represented as separate
1759 # pats/include/exclude cannot be represented as separate
1760 # revset expressions as their filtering logic applies at file
1760 # revset expressions as their filtering logic applies at file
1761 # level. For instance "-I a -X a" matches a revision touching
1761 # level. For instance "-I a -X a" matches a revision touching
1762 # "a" and "b" while "file(a) and not file(b)" does
1762 # "a" and "b" while "file(a) and not file(b)" does
1763 # not. Besides, filesets are evaluated against the working
1763 # not. Besides, filesets are evaluated against the working
1764 # directory.
1764 # directory.
1765 matchargs = ['r:', 'd:relpath']
1765 matchargs = ['r:', 'd:relpath']
1766 for p in pats:
1766 for p in pats:
1767 matchargs.append('p:' + p)
1767 matchargs.append('p:' + p)
1768 for p in opts.get('include', []):
1768 for p in opts.get('include', []):
1769 matchargs.append('i:' + p)
1769 matchargs.append('i:' + p)
1770 for p in opts.get('exclude', []):
1770 for p in opts.get('exclude', []):
1771 matchargs.append('x:' + p)
1771 matchargs.append('x:' + p)
1772 matchargs = ','.join(('%r' % p) for p in matchargs)
1772 matchargs = ','.join(('%r' % p) for p in matchargs)
1773 opts['_matchfiles'] = matchargs
1773 opts['_matchfiles'] = matchargs
1774 if follow:
1774 if follow:
1775 opts[fnopats[0][followfirst]] = '.'
1775 opts[fnopats[0][followfirst]] = '.'
1776 else:
1776 else:
1777 if follow:
1777 if follow:
1778 if pats:
1778 if pats:
1779 # follow() revset interprets its file argument as a
1779 # follow() revset interprets its file argument as a
1780 # manifest entry, so use match.files(), not pats.
1780 # manifest entry, so use match.files(), not pats.
1781 opts[fpats[followfirst]] = list(match.files())
1781 opts[fpats[followfirst]] = list(match.files())
1782 else:
1782 else:
1783 op = fnopats[followdescendants][followfirst]
1783 op = fnopats[followdescendants][followfirst]
1784 opts[op] = 'rev(%d)' % startrev
1784 opts[op] = 'rev(%d)' % startrev
1785 else:
1785 else:
1786 opts['_patslog'] = list(pats)
1786 opts['_patslog'] = list(pats)
1787
1787
1788 filematcher = None
1788 filematcher = None
1789 if opts.get('patch') or opts.get('stat'):
1789 if opts.get('patch') or opts.get('stat'):
1790 # When following files, track renames via a special matcher.
1790 # When following files, track renames via a special matcher.
1791 # If we're forced to take the slowpath it means we're following
1791 # If we're forced to take the slowpath it means we're following
1792 # at least one pattern/directory, so don't bother with rename tracking.
1792 # at least one pattern/directory, so don't bother with rename tracking.
1793 if follow and not match.always() and not slowpath:
1793 if follow and not match.always() and not slowpath:
1794 # _makefollowlogfilematcher expects its files argument to be
1794 # _makefollowlogfilematcher expects its files argument to be
1795 # relative to the repo root, so use match.files(), not pats.
1795 # relative to the repo root, so use match.files(), not pats.
1796 filematcher = _makefollowlogfilematcher(repo, match.files(),
1796 filematcher = _makefollowlogfilematcher(repo, match.files(),
1797 followfirst)
1797 followfirst)
1798 else:
1798 else:
1799 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
1799 filematcher = _makenofollowlogfilematcher(repo, pats, opts)
1800 if filematcher is None:
1800 if filematcher is None:
1801 filematcher = lambda rev: match
1801 filematcher = lambda rev: match
1802
1802
1803 expr = []
1803 expr = []
1804 for op, val in sorted(opts.iteritems()):
1804 for op, val in sorted(opts.iteritems()):
1805 if not val:
1805 if not val:
1806 continue
1806 continue
1807 if op not in opt2revset:
1807 if op not in opt2revset:
1808 continue
1808 continue
1809 revop, andor = opt2revset[op]
1809 revop, andor = opt2revset[op]
1810 if '%(val)' not in revop:
1810 if '%(val)' not in revop:
1811 expr.append(revop)
1811 expr.append(revop)
1812 else:
1812 else:
1813 if not isinstance(val, list):
1813 if not isinstance(val, list):
1814 e = revop % {'val': val}
1814 e = revop % {'val': val}
1815 else:
1815 else:
1816 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
1816 e = '(' + andor.join((revop % {'val': v}) for v in val) + ')'
1817 expr.append(e)
1817 expr.append(e)
1818
1818
1819 if expr:
1819 if expr:
1820 expr = '(' + ' and '.join(expr) + ')'
1820 expr = '(' + ' and '.join(expr) + ')'
1821 else:
1821 else:
1822 expr = None
1822 expr = None
1823 return expr, filematcher
1823 return expr, filematcher
1824
1824
1825 def getgraphlogrevs(repo, pats, opts):
1825 def getgraphlogrevs(repo, pats, opts):
1826 """Return (revs, expr, filematcher) where revs is an iterable of
1826 """Return (revs, expr, filematcher) where revs is an iterable of
1827 revision numbers, expr is a revset string built from log options
1827 revision numbers, expr is a revset string built from log options
1828 and file patterns or None, and used to filter 'revs'. If --stat or
1828 and file patterns or None, and used to filter 'revs'. If --stat or
1829 --patch are not passed filematcher is None. Otherwise it is a
1829 --patch are not passed filematcher is None. Otherwise it is a
1830 callable taking a revision number and returning a match objects
1830 callable taking a revision number and returning a match objects
1831 filtering the files to be detailed when displaying the revision.
1831 filtering the files to be detailed when displaying the revision.
1832 """
1832 """
1833 if not len(repo):
1834 return [], None, None
1835 limit = loglimit(opts)
1833 limit = loglimit(opts)
1836 # Default --rev value depends on --follow but --follow behaviour
1834 # Default --rev value depends on --follow but --follow behaviour
1837 # depends on revisions resolved from --rev...
1835 # depends on revisions resolved from --rev...
1838 follow = opts.get('follow') or opts.get('follow_first')
1836 follow = opts.get('follow') or opts.get('follow_first')
1839 possiblyunsorted = False # whether revs might need sorting
1837 possiblyunsorted = False # whether revs might need sorting
1840 if opts.get('rev'):
1838 if opts.get('rev'):
1841 revs = scmutil.revrange(repo, opts['rev'])
1839 revs = scmutil.revrange(repo, opts['rev'])
1842 # Don't sort here because _makelogrevset might depend on the
1840 # Don't sort here because _makelogrevset might depend on the
1843 # order of revs
1841 # order of revs
1844 possiblyunsorted = True
1842 possiblyunsorted = True
1845 else:
1843 else:
1846 if follow and len(repo) > 0:
1844 if follow and len(repo) > 0:
1847 revs = repo.revs('reverse(:.)')
1845 revs = repo.revs('reverse(:.)')
1848 else:
1846 else:
1849 revs = revset.spanset(repo)
1847 revs = revset.spanset(repo)
1850 revs.reverse()
1848 revs.reverse()
1851 if not revs:
1849 if not revs:
1852 return revset.baseset(), None, None
1850 return revset.baseset(), None, None
1853 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
1851 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
1854 if possiblyunsorted:
1852 if possiblyunsorted:
1855 revs.sort(reverse=True)
1853 revs.sort(reverse=True)
1856 if expr:
1854 if expr:
1857 # Revset matchers often operate faster on revisions in changelog
1855 # Revset matchers often operate faster on revisions in changelog
1858 # order, because most filters deal with the changelog.
1856 # order, because most filters deal with the changelog.
1859 revs.reverse()
1857 revs.reverse()
1860 matcher = revset.match(repo.ui, expr)
1858 matcher = revset.match(repo.ui, expr)
1861 # Revset matches can reorder revisions. "A or B" typically returns
1859 # Revset matches can reorder revisions. "A or B" typically returns
1862 # returns the revision matching A then the revision matching B. Sort
1860 # returns the revision matching A then the revision matching B. Sort
1863 # again to fix that.
1861 # again to fix that.
1864 revs = matcher(repo, revs)
1862 revs = matcher(repo, revs)
1865 revs.sort(reverse=True)
1863 revs.sort(reverse=True)
1866 if limit is not None:
1864 if limit is not None:
1867 limitedrevs = []
1865 limitedrevs = []
1868 for idx, rev in enumerate(revs):
1866 for idx, rev in enumerate(revs):
1869 if idx >= limit:
1867 if idx >= limit:
1870 break
1868 break
1871 limitedrevs.append(rev)
1869 limitedrevs.append(rev)
1872 revs = revset.baseset(limitedrevs)
1870 revs = revset.baseset(limitedrevs)
1873
1871
1874 return revs, expr, filematcher
1872 return revs, expr, filematcher
1875
1873
1876 def getlogrevs(repo, pats, opts):
1874 def getlogrevs(repo, pats, opts):
1877 """Return (revs, expr, filematcher) where revs is an iterable of
1875 """Return (revs, expr, filematcher) where revs is an iterable of
1878 revision numbers, expr is a revset string built from log options
1876 revision numbers, expr is a revset string built from log options
1879 and file patterns or None, and used to filter 'revs'. If --stat or
1877 and file patterns or None, and used to filter 'revs'. If --stat or
1880 --patch are not passed filematcher is None. Otherwise it is a
1878 --patch are not passed filematcher is None. Otherwise it is a
1881 callable taking a revision number and returning a match objects
1879 callable taking a revision number and returning a match objects
1882 filtering the files to be detailed when displaying the revision.
1880 filtering the files to be detailed when displaying the revision.
1883 """
1881 """
1884 limit = loglimit(opts)
1882 limit = loglimit(opts)
1885 # Default --rev value depends on --follow but --follow behaviour
1883 # Default --rev value depends on --follow but --follow behaviour
1886 # depends on revisions resolved from --rev...
1884 # depends on revisions resolved from --rev...
1887 follow = opts.get('follow') or opts.get('follow_first')
1885 follow = opts.get('follow') or opts.get('follow_first')
1888 if opts.get('rev'):
1886 if opts.get('rev'):
1889 revs = scmutil.revrange(repo, opts['rev'])
1887 revs = scmutil.revrange(repo, opts['rev'])
1890 elif follow:
1888 elif follow:
1891 revs = repo.revs('reverse(:.)')
1889 revs = repo.revs('reverse(:.)')
1892 else:
1890 else:
1893 revs = revset.spanset(repo)
1891 revs = revset.spanset(repo)
1894 revs.reverse()
1892 revs.reverse()
1895 if not revs:
1893 if not revs:
1896 return revset.baseset([]), None, None
1894 return revset.baseset([]), None, None
1897 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
1895 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
1898 if expr:
1896 if expr:
1899 # Revset matchers often operate faster on revisions in changelog
1897 # Revset matchers often operate faster on revisions in changelog
1900 # order, because most filters deal with the changelog.
1898 # order, because most filters deal with the changelog.
1901 if not opts.get('rev'):
1899 if not opts.get('rev'):
1902 revs.reverse()
1900 revs.reverse()
1903 matcher = revset.match(repo.ui, expr)
1901 matcher = revset.match(repo.ui, expr)
1904 # Revset matches can reorder revisions. "A or B" typically returns
1902 # Revset matches can reorder revisions. "A or B" typically returns
1905 # returns the revision matching A then the revision matching B. Sort
1903 # returns the revision matching A then the revision matching B. Sort
1906 # again to fix that.
1904 # again to fix that.
1907 revs = matcher(repo, revs)
1905 revs = matcher(repo, revs)
1908 if not opts.get('rev'):
1906 if not opts.get('rev'):
1909 revs.sort(reverse=True)
1907 revs.sort(reverse=True)
1910 if limit is not None:
1908 if limit is not None:
1911 count = 0
1909 count = 0
1912 limitedrevs = []
1910 limitedrevs = []
1913 it = iter(revs)
1911 it = iter(revs)
1914 while count < limit:
1912 while count < limit:
1915 try:
1913 try:
1916 limitedrevs.append(it.next())
1914 limitedrevs.append(it.next())
1917 except (StopIteration):
1915 except (StopIteration):
1918 break
1916 break
1919 count += 1
1917 count += 1
1920 revs = revset.baseset(limitedrevs)
1918 revs = revset.baseset(limitedrevs)
1921
1919
1922 return revs, expr, filematcher
1920 return revs, expr, filematcher
1923
1921
1924 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
1922 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
1925 filematcher=None):
1923 filematcher=None):
1926 seen, state = [], graphmod.asciistate()
1924 seen, state = [], graphmod.asciistate()
1927 for rev, type, ctx, parents in dag:
1925 for rev, type, ctx, parents in dag:
1928 char = 'o'
1926 char = 'o'
1929 if ctx.node() in showparents:
1927 if ctx.node() in showparents:
1930 char = '@'
1928 char = '@'
1931 elif ctx.obsolete():
1929 elif ctx.obsolete():
1932 char = 'x'
1930 char = 'x'
1933 copies = None
1931 copies = None
1934 if getrenamed and ctx.rev():
1932 if getrenamed and ctx.rev():
1935 copies = []
1933 copies = []
1936 for fn in ctx.files():
1934 for fn in ctx.files():
1937 rename = getrenamed(fn, ctx.rev())
1935 rename = getrenamed(fn, ctx.rev())
1938 if rename:
1936 if rename:
1939 copies.append((fn, rename[0]))
1937 copies.append((fn, rename[0]))
1940 revmatchfn = None
1938 revmatchfn = None
1941 if filematcher is not None:
1939 if filematcher is not None:
1942 revmatchfn = filematcher(ctx.rev())
1940 revmatchfn = filematcher(ctx.rev())
1943 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
1941 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
1944 lines = displayer.hunk.pop(rev).split('\n')
1942 lines = displayer.hunk.pop(rev).split('\n')
1945 if not lines[-1]:
1943 if not lines[-1]:
1946 del lines[-1]
1944 del lines[-1]
1947 displayer.flush(rev)
1945 displayer.flush(rev)
1948 edges = edgefn(type, char, lines, seen, rev, parents)
1946 edges = edgefn(type, char, lines, seen, rev, parents)
1949 for type, char, lines, coldata in edges:
1947 for type, char, lines, coldata in edges:
1950 graphmod.ascii(ui, state, type, char, lines, coldata)
1948 graphmod.ascii(ui, state, type, char, lines, coldata)
1951 displayer.close()
1949 displayer.close()
1952
1950
1953 def graphlog(ui, repo, *pats, **opts):
1951 def graphlog(ui, repo, *pats, **opts):
1954 # Parameters are identical to log command ones
1952 # Parameters are identical to log command ones
1955 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
1953 revs, expr, filematcher = getgraphlogrevs(repo, pats, opts)
1956 revdag = graphmod.dagwalker(repo, revs)
1954 revdag = graphmod.dagwalker(repo, revs)
1957
1955
1958 getrenamed = None
1956 getrenamed = None
1959 if opts.get('copies'):
1957 if opts.get('copies'):
1960 endrev = None
1958 endrev = None
1961 if opts.get('rev'):
1959 if opts.get('rev'):
1962 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
1960 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
1963 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
1961 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
1964 displayer = show_changeset(ui, repo, opts, buffered=True)
1962 displayer = show_changeset(ui, repo, opts, buffered=True)
1965 showparents = [ctx.node() for ctx in repo[None].parents()]
1963 showparents = [ctx.node() for ctx in repo[None].parents()]
1966 displaygraph(ui, revdag, displayer, showparents,
1964 displaygraph(ui, revdag, displayer, showparents,
1967 graphmod.asciiedges, getrenamed, filematcher)
1965 graphmod.asciiedges, getrenamed, filematcher)
1968
1966
1969 def checkunsupportedgraphflags(pats, opts):
1967 def checkunsupportedgraphflags(pats, opts):
1970 for op in ["newest_first"]:
1968 for op in ["newest_first"]:
1971 if op in opts and opts[op]:
1969 if op in opts and opts[op]:
1972 raise util.Abort(_("-G/--graph option is incompatible with --%s")
1970 raise util.Abort(_("-G/--graph option is incompatible with --%s")
1973 % op.replace("_", "-"))
1971 % op.replace("_", "-"))
1974
1972
1975 def graphrevs(repo, nodes, opts):
1973 def graphrevs(repo, nodes, opts):
1976 limit = loglimit(opts)
1974 limit = loglimit(opts)
1977 nodes.reverse()
1975 nodes.reverse()
1978 if limit is not None:
1976 if limit is not None:
1979 nodes = nodes[:limit]
1977 nodes = nodes[:limit]
1980 return graphmod.nodes(repo, nodes)
1978 return graphmod.nodes(repo, nodes)
1981
1979
1982 def add(ui, repo, match, prefix, explicitonly, **opts):
1980 def add(ui, repo, match, prefix, explicitonly, **opts):
1983 join = lambda f: os.path.join(prefix, f)
1981 join = lambda f: os.path.join(prefix, f)
1984 bad = []
1982 bad = []
1985 oldbad = match.bad
1983 oldbad = match.bad
1986 match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
1984 match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
1987 names = []
1985 names = []
1988 wctx = repo[None]
1986 wctx = repo[None]
1989 cca = None
1987 cca = None
1990 abort, warn = scmutil.checkportabilityalert(ui)
1988 abort, warn = scmutil.checkportabilityalert(ui)
1991 if abort or warn:
1989 if abort or warn:
1992 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
1990 cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
1993 for f in wctx.walk(match):
1991 for f in wctx.walk(match):
1994 exact = match.exact(f)
1992 exact = match.exact(f)
1995 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
1993 if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
1996 if cca:
1994 if cca:
1997 cca(f)
1995 cca(f)
1998 names.append(f)
1996 names.append(f)
1999 if ui.verbose or not exact:
1997 if ui.verbose or not exact:
2000 ui.status(_('adding %s\n') % match.rel(f))
1998 ui.status(_('adding %s\n') % match.rel(f))
2001
1999
2002 for subpath in sorted(wctx.substate):
2000 for subpath in sorted(wctx.substate):
2003 sub = wctx.sub(subpath)
2001 sub = wctx.sub(subpath)
2004 try:
2002 try:
2005 submatch = matchmod.narrowmatcher(subpath, match)
2003 submatch = matchmod.narrowmatcher(subpath, match)
2006 if opts.get('subrepos'):
2004 if opts.get('subrepos'):
2007 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2005 bad.extend(sub.add(ui, submatch, prefix, False, **opts))
2008 else:
2006 else:
2009 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2007 bad.extend(sub.add(ui, submatch, prefix, True, **opts))
2010 except error.LookupError:
2008 except error.LookupError:
2011 ui.status(_("skipping missing subrepository: %s\n")
2009 ui.status(_("skipping missing subrepository: %s\n")
2012 % join(subpath))
2010 % join(subpath))
2013
2011
2014 if not opts.get('dry_run'):
2012 if not opts.get('dry_run'):
2015 rejected = wctx.add(names, prefix)
2013 rejected = wctx.add(names, prefix)
2016 bad.extend(f for f in rejected if f in match.files())
2014 bad.extend(f for f in rejected if f in match.files())
2017 return bad
2015 return bad
2018
2016
2019 def forget(ui, repo, match, prefix, explicitonly):
2017 def forget(ui, repo, match, prefix, explicitonly):
2020 join = lambda f: os.path.join(prefix, f)
2018 join = lambda f: os.path.join(prefix, f)
2021 bad = []
2019 bad = []
2022 oldbad = match.bad
2020 oldbad = match.bad
2023 match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
2021 match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
2024 wctx = repo[None]
2022 wctx = repo[None]
2025 forgot = []
2023 forgot = []
2026 s = repo.status(match=match, clean=True)
2024 s = repo.status(match=match, clean=True)
2027 forget = sorted(s[0] + s[1] + s[3] + s[6])
2025 forget = sorted(s[0] + s[1] + s[3] + s[6])
2028 if explicitonly:
2026 if explicitonly:
2029 forget = [f for f in forget if match.exact(f)]
2027 forget = [f for f in forget if match.exact(f)]
2030
2028
2031 for subpath in sorted(wctx.substate):
2029 for subpath in sorted(wctx.substate):
2032 sub = wctx.sub(subpath)
2030 sub = wctx.sub(subpath)
2033 try:
2031 try:
2034 submatch = matchmod.narrowmatcher(subpath, match)
2032 submatch = matchmod.narrowmatcher(subpath, match)
2035 subbad, subforgot = sub.forget(submatch, prefix)
2033 subbad, subforgot = sub.forget(submatch, prefix)
2036 bad.extend([subpath + '/' + f for f in subbad])
2034 bad.extend([subpath + '/' + f for f in subbad])
2037 forgot.extend([subpath + '/' + f for f in subforgot])
2035 forgot.extend([subpath + '/' + f for f in subforgot])
2038 except error.LookupError:
2036 except error.LookupError:
2039 ui.status(_("skipping missing subrepository: %s\n")
2037 ui.status(_("skipping missing subrepository: %s\n")
2040 % join(subpath))
2038 % join(subpath))
2041
2039
2042 if not explicitonly:
2040 if not explicitonly:
2043 for f in match.files():
2041 for f in match.files():
2044 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2042 if f not in repo.dirstate and not repo.wvfs.isdir(f):
2045 if f not in forgot:
2043 if f not in forgot:
2046 if repo.wvfs.exists(f):
2044 if repo.wvfs.exists(f):
2047 ui.warn(_('not removing %s: '
2045 ui.warn(_('not removing %s: '
2048 'file is already untracked\n')
2046 'file is already untracked\n')
2049 % match.rel(f))
2047 % match.rel(f))
2050 bad.append(f)
2048 bad.append(f)
2051
2049
2052 for f in forget:
2050 for f in forget:
2053 if ui.verbose or not match.exact(f):
2051 if ui.verbose or not match.exact(f):
2054 ui.status(_('removing %s\n') % match.rel(f))
2052 ui.status(_('removing %s\n') % match.rel(f))
2055
2053
2056 rejected = wctx.forget(forget, prefix)
2054 rejected = wctx.forget(forget, prefix)
2057 bad.extend(f for f in rejected if f in match.files())
2055 bad.extend(f for f in rejected if f in match.files())
2058 forgot.extend(f for f in forget if f not in rejected)
2056 forgot.extend(f for f in forget if f not in rejected)
2059 return bad, forgot
2057 return bad, forgot
2060
2058
2061 def remove(ui, repo, m, prefix, after, force, subrepos):
2059 def remove(ui, repo, m, prefix, after, force, subrepos):
2062 join = lambda f: os.path.join(prefix, f)
2060 join = lambda f: os.path.join(prefix, f)
2063 ret = 0
2061 ret = 0
2064 s = repo.status(match=m, clean=True)
2062 s = repo.status(match=m, clean=True)
2065 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2063 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2066
2064
2067 wctx = repo[None]
2065 wctx = repo[None]
2068
2066
2069 for subpath in sorted(wctx.substate):
2067 for subpath in sorted(wctx.substate):
2070 def matchessubrepo(matcher, subpath):
2068 def matchessubrepo(matcher, subpath):
2071 if matcher.exact(subpath):
2069 if matcher.exact(subpath):
2072 return True
2070 return True
2073 for f in matcher.files():
2071 for f in matcher.files():
2074 if f.startswith(subpath):
2072 if f.startswith(subpath):
2075 return True
2073 return True
2076 return False
2074 return False
2077
2075
2078 if subrepos or matchessubrepo(m, subpath):
2076 if subrepos or matchessubrepo(m, subpath):
2079 sub = wctx.sub(subpath)
2077 sub = wctx.sub(subpath)
2080 try:
2078 try:
2081 submatch = matchmod.narrowmatcher(subpath, m)
2079 submatch = matchmod.narrowmatcher(subpath, m)
2082 if sub.removefiles(submatch, prefix, after, force, subrepos):
2080 if sub.removefiles(submatch, prefix, after, force, subrepos):
2083 ret = 1
2081 ret = 1
2084 except error.LookupError:
2082 except error.LookupError:
2085 ui.status(_("skipping missing subrepository: %s\n")
2083 ui.status(_("skipping missing subrepository: %s\n")
2086 % join(subpath))
2084 % join(subpath))
2087
2085
2088 # warn about failure to delete explicit files/dirs
2086 # warn about failure to delete explicit files/dirs
2089 for f in m.files():
2087 for f in m.files():
2090 def insubrepo():
2088 def insubrepo():
2091 for subpath in wctx.substate:
2089 for subpath in wctx.substate:
2092 if f.startswith(subpath):
2090 if f.startswith(subpath):
2093 return True
2091 return True
2094 return False
2092 return False
2095
2093
2096 if f in repo.dirstate or f in wctx.dirs() or f == '.' or insubrepo():
2094 if f in repo.dirstate or f in wctx.dirs() or f == '.' or insubrepo():
2097 continue
2095 continue
2098
2096
2099 if repo.wvfs.exists(f):
2097 if repo.wvfs.exists(f):
2100 if repo.wvfs.isdir(f):
2098 if repo.wvfs.isdir(f):
2101 ui.warn(_('not removing %s: no tracked files\n')
2099 ui.warn(_('not removing %s: no tracked files\n')
2102 % m.rel(f))
2100 % m.rel(f))
2103 else:
2101 else:
2104 ui.warn(_('not removing %s: file is untracked\n')
2102 ui.warn(_('not removing %s: file is untracked\n')
2105 % m.rel(f))
2103 % m.rel(f))
2106 # missing files will generate a warning elsewhere
2104 # missing files will generate a warning elsewhere
2107 ret = 1
2105 ret = 1
2108
2106
2109 if force:
2107 if force:
2110 list = modified + deleted + clean + added
2108 list = modified + deleted + clean + added
2111 elif after:
2109 elif after:
2112 list = deleted
2110 list = deleted
2113 for f in modified + added + clean:
2111 for f in modified + added + clean:
2114 ui.warn(_('not removing %s: file still exists\n') % m.rel(f))
2112 ui.warn(_('not removing %s: file still exists\n') % m.rel(f))
2115 ret = 1
2113 ret = 1
2116 else:
2114 else:
2117 list = deleted + clean
2115 list = deleted + clean
2118 for f in modified:
2116 for f in modified:
2119 ui.warn(_('not removing %s: file is modified (use -f'
2117 ui.warn(_('not removing %s: file is modified (use -f'
2120 ' to force removal)\n') % m.rel(f))
2118 ' to force removal)\n') % m.rel(f))
2121 ret = 1
2119 ret = 1
2122 for f in added:
2120 for f in added:
2123 ui.warn(_('not removing %s: file has been marked for add'
2121 ui.warn(_('not removing %s: file has been marked for add'
2124 ' (use forget to undo)\n') % m.rel(f))
2122 ' (use forget to undo)\n') % m.rel(f))
2125 ret = 1
2123 ret = 1
2126
2124
2127 for f in sorted(list):
2125 for f in sorted(list):
2128 if ui.verbose or not m.exact(f):
2126 if ui.verbose or not m.exact(f):
2129 ui.status(_('removing %s\n') % m.rel(f))
2127 ui.status(_('removing %s\n') % m.rel(f))
2130
2128
2131 wlock = repo.wlock()
2129 wlock = repo.wlock()
2132 try:
2130 try:
2133 if not after:
2131 if not after:
2134 for f in list:
2132 for f in list:
2135 if f in added:
2133 if f in added:
2136 continue # we never unlink added files on remove
2134 continue # we never unlink added files on remove
2137 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
2135 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
2138 repo[None].forget(list)
2136 repo[None].forget(list)
2139 finally:
2137 finally:
2140 wlock.release()
2138 wlock.release()
2141
2139
2142 return ret
2140 return ret
2143
2141
2144 def cat(ui, repo, ctx, matcher, prefix, **opts):
2142 def cat(ui, repo, ctx, matcher, prefix, **opts):
2145 err = 1
2143 err = 1
2146
2144
2147 def write(path):
2145 def write(path):
2148 fp = makefileobj(repo, opts.get('output'), ctx.node(),
2146 fp = makefileobj(repo, opts.get('output'), ctx.node(),
2149 pathname=os.path.join(prefix, path))
2147 pathname=os.path.join(prefix, path))
2150 data = ctx[path].data()
2148 data = ctx[path].data()
2151 if opts.get('decode'):
2149 if opts.get('decode'):
2152 data = repo.wwritedata(path, data)
2150 data = repo.wwritedata(path, data)
2153 fp.write(data)
2151 fp.write(data)
2154 fp.close()
2152 fp.close()
2155
2153
2156 # Automation often uses hg cat on single files, so special case it
2154 # Automation often uses hg cat on single files, so special case it
2157 # for performance to avoid the cost of parsing the manifest.
2155 # for performance to avoid the cost of parsing the manifest.
2158 if len(matcher.files()) == 1 and not matcher.anypats():
2156 if len(matcher.files()) == 1 and not matcher.anypats():
2159 file = matcher.files()[0]
2157 file = matcher.files()[0]
2160 mf = repo.manifest
2158 mf = repo.manifest
2161 mfnode = ctx._changeset[0]
2159 mfnode = ctx._changeset[0]
2162 if mf.find(mfnode, file)[0]:
2160 if mf.find(mfnode, file)[0]:
2163 write(file)
2161 write(file)
2164 return 0
2162 return 0
2165
2163
2166 # Don't warn about "missing" files that are really in subrepos
2164 # Don't warn about "missing" files that are really in subrepos
2167 bad = matcher.bad
2165 bad = matcher.bad
2168
2166
2169 def badfn(path, msg):
2167 def badfn(path, msg):
2170 for subpath in ctx.substate:
2168 for subpath in ctx.substate:
2171 if path.startswith(subpath):
2169 if path.startswith(subpath):
2172 return
2170 return
2173 bad(path, msg)
2171 bad(path, msg)
2174
2172
2175 matcher.bad = badfn
2173 matcher.bad = badfn
2176
2174
2177 for abs in ctx.walk(matcher):
2175 for abs in ctx.walk(matcher):
2178 write(abs)
2176 write(abs)
2179 err = 0
2177 err = 0
2180
2178
2181 matcher.bad = bad
2179 matcher.bad = bad
2182
2180
2183 for subpath in sorted(ctx.substate):
2181 for subpath in sorted(ctx.substate):
2184 sub = ctx.sub(subpath)
2182 sub = ctx.sub(subpath)
2185 try:
2183 try:
2186 submatch = matchmod.narrowmatcher(subpath, matcher)
2184 submatch = matchmod.narrowmatcher(subpath, matcher)
2187
2185
2188 if not sub.cat(submatch, os.path.join(prefix, sub._path),
2186 if not sub.cat(submatch, os.path.join(prefix, sub._path),
2189 **opts):
2187 **opts):
2190 err = 0
2188 err = 0
2191 except error.RepoLookupError:
2189 except error.RepoLookupError:
2192 ui.status(_("skipping missing subrepository: %s\n")
2190 ui.status(_("skipping missing subrepository: %s\n")
2193 % os.path.join(prefix, subpath))
2191 % os.path.join(prefix, subpath))
2194
2192
2195 return err
2193 return err
2196
2194
2197 def commit(ui, repo, commitfunc, pats, opts):
2195 def commit(ui, repo, commitfunc, pats, opts):
2198 '''commit the specified files or all outstanding changes'''
2196 '''commit the specified files or all outstanding changes'''
2199 date = opts.get('date')
2197 date = opts.get('date')
2200 if date:
2198 if date:
2201 opts['date'] = util.parsedate(date)
2199 opts['date'] = util.parsedate(date)
2202 message = logmessage(ui, opts)
2200 message = logmessage(ui, opts)
2203 matcher = scmutil.match(repo[None], pats, opts)
2201 matcher = scmutil.match(repo[None], pats, opts)
2204
2202
2205 # extract addremove carefully -- this function can be called from a command
2203 # extract addremove carefully -- this function can be called from a command
2206 # that doesn't support addremove
2204 # that doesn't support addremove
2207 if opts.get('addremove'):
2205 if opts.get('addremove'):
2208 if scmutil.addremove(repo, matcher, "", opts) != 0:
2206 if scmutil.addremove(repo, matcher, "", opts) != 0:
2209 raise util.Abort(
2207 raise util.Abort(
2210 _("failed to mark all new/missing files as added/removed"))
2208 _("failed to mark all new/missing files as added/removed"))
2211
2209
2212 return commitfunc(ui, repo, message, matcher, opts)
2210 return commitfunc(ui, repo, message, matcher, opts)
2213
2211
2214 def amend(ui, repo, commitfunc, old, extra, pats, opts):
2212 def amend(ui, repo, commitfunc, old, extra, pats, opts):
2215 # amend will reuse the existing user if not specified, but the obsolete
2213 # amend will reuse the existing user if not specified, but the obsolete
2216 # marker creation requires that the current user's name is specified.
2214 # marker creation requires that the current user's name is specified.
2217 if obsolete._enabled:
2215 if obsolete._enabled:
2218 ui.username() # raise exception if username not set
2216 ui.username() # raise exception if username not set
2219
2217
2220 ui.note(_('amending changeset %s\n') % old)
2218 ui.note(_('amending changeset %s\n') % old)
2221 base = old.p1()
2219 base = old.p1()
2222
2220
2223 wlock = lock = newid = None
2221 wlock = lock = newid = None
2224 try:
2222 try:
2225 wlock = repo.wlock()
2223 wlock = repo.wlock()
2226 lock = repo.lock()
2224 lock = repo.lock()
2227 tr = repo.transaction('amend')
2225 tr = repo.transaction('amend')
2228 try:
2226 try:
2229 # See if we got a message from -m or -l, if not, open the editor
2227 # See if we got a message from -m or -l, if not, open the editor
2230 # with the message of the changeset to amend
2228 # with the message of the changeset to amend
2231 message = logmessage(ui, opts)
2229 message = logmessage(ui, opts)
2232 # ensure logfile does not conflict with later enforcement of the
2230 # ensure logfile does not conflict with later enforcement of the
2233 # message. potential logfile content has been processed by
2231 # message. potential logfile content has been processed by
2234 # `logmessage` anyway.
2232 # `logmessage` anyway.
2235 opts.pop('logfile')
2233 opts.pop('logfile')
2236 # First, do a regular commit to record all changes in the working
2234 # First, do a regular commit to record all changes in the working
2237 # directory (if there are any)
2235 # directory (if there are any)
2238 ui.callhooks = False
2236 ui.callhooks = False
2239 currentbookmark = repo._bookmarkcurrent
2237 currentbookmark = repo._bookmarkcurrent
2240 try:
2238 try:
2241 repo._bookmarkcurrent = None
2239 repo._bookmarkcurrent = None
2242 opts['message'] = 'temporary amend commit for %s' % old
2240 opts['message'] = 'temporary amend commit for %s' % old
2243 node = commit(ui, repo, commitfunc, pats, opts)
2241 node = commit(ui, repo, commitfunc, pats, opts)
2244 finally:
2242 finally:
2245 repo._bookmarkcurrent = currentbookmark
2243 repo._bookmarkcurrent = currentbookmark
2246 ui.callhooks = True
2244 ui.callhooks = True
2247 ctx = repo[node]
2245 ctx = repo[node]
2248
2246
2249 # Participating changesets:
2247 # Participating changesets:
2250 #
2248 #
2251 # node/ctx o - new (intermediate) commit that contains changes
2249 # node/ctx o - new (intermediate) commit that contains changes
2252 # | from working dir to go into amending commit
2250 # | from working dir to go into amending commit
2253 # | (or a workingctx if there were no changes)
2251 # | (or a workingctx if there were no changes)
2254 # |
2252 # |
2255 # old o - changeset to amend
2253 # old o - changeset to amend
2256 # |
2254 # |
2257 # base o - parent of amending changeset
2255 # base o - parent of amending changeset
2258
2256
2259 # Update extra dict from amended commit (e.g. to preserve graft
2257 # Update extra dict from amended commit (e.g. to preserve graft
2260 # source)
2258 # source)
2261 extra.update(old.extra())
2259 extra.update(old.extra())
2262
2260
2263 # Also update it from the intermediate commit or from the wctx
2261 # Also update it from the intermediate commit or from the wctx
2264 extra.update(ctx.extra())
2262 extra.update(ctx.extra())
2265
2263
2266 if len(old.parents()) > 1:
2264 if len(old.parents()) > 1:
2267 # ctx.files() isn't reliable for merges, so fall back to the
2265 # ctx.files() isn't reliable for merges, so fall back to the
2268 # slower repo.status() method
2266 # slower repo.status() method
2269 files = set([fn for st in repo.status(base, old)[:3]
2267 files = set([fn for st in repo.status(base, old)[:3]
2270 for fn in st])
2268 for fn in st])
2271 else:
2269 else:
2272 files = set(old.files())
2270 files = set(old.files())
2273
2271
2274 # Second, we use either the commit we just did, or if there were no
2272 # Second, we use either the commit we just did, or if there were no
2275 # changes the parent of the working directory as the version of the
2273 # changes the parent of the working directory as the version of the
2276 # files in the final amend commit
2274 # files in the final amend commit
2277 if node:
2275 if node:
2278 ui.note(_('copying changeset %s to %s\n') % (ctx, base))
2276 ui.note(_('copying changeset %s to %s\n') % (ctx, base))
2279
2277
2280 user = ctx.user()
2278 user = ctx.user()
2281 date = ctx.date()
2279 date = ctx.date()
2282 # Recompute copies (avoid recording a -> b -> a)
2280 # Recompute copies (avoid recording a -> b -> a)
2283 copied = copies.pathcopies(base, ctx)
2281 copied = copies.pathcopies(base, ctx)
2284
2282
2285 # Prune files which were reverted by the updates: if old
2283 # Prune files which were reverted by the updates: if old
2286 # introduced file X and our intermediate commit, node,
2284 # introduced file X and our intermediate commit, node,
2287 # renamed that file, then those two files are the same and
2285 # renamed that file, then those two files are the same and
2288 # we can discard X from our list of files. Likewise if X
2286 # we can discard X from our list of files. Likewise if X
2289 # was deleted, it's no longer relevant
2287 # was deleted, it's no longer relevant
2290 files.update(ctx.files())
2288 files.update(ctx.files())
2291
2289
2292 def samefile(f):
2290 def samefile(f):
2293 if f in ctx.manifest():
2291 if f in ctx.manifest():
2294 a = ctx.filectx(f)
2292 a = ctx.filectx(f)
2295 if f in base.manifest():
2293 if f in base.manifest():
2296 b = base.filectx(f)
2294 b = base.filectx(f)
2297 return (not a.cmp(b)
2295 return (not a.cmp(b)
2298 and a.flags() == b.flags())
2296 and a.flags() == b.flags())
2299 else:
2297 else:
2300 return False
2298 return False
2301 else:
2299 else:
2302 return f not in base.manifest()
2300 return f not in base.manifest()
2303 files = [f for f in files if not samefile(f)]
2301 files = [f for f in files if not samefile(f)]
2304
2302
2305 def filectxfn(repo, ctx_, path):
2303 def filectxfn(repo, ctx_, path):
2306 try:
2304 try:
2307 fctx = ctx[path]
2305 fctx = ctx[path]
2308 flags = fctx.flags()
2306 flags = fctx.flags()
2309 mctx = context.memfilectx(repo,
2307 mctx = context.memfilectx(repo,
2310 fctx.path(), fctx.data(),
2308 fctx.path(), fctx.data(),
2311 islink='l' in flags,
2309 islink='l' in flags,
2312 isexec='x' in flags,
2310 isexec='x' in flags,
2313 copied=copied.get(path))
2311 copied=copied.get(path))
2314 return mctx
2312 return mctx
2315 except KeyError:
2313 except KeyError:
2316 return None
2314 return None
2317 else:
2315 else:
2318 ui.note(_('copying changeset %s to %s\n') % (old, base))
2316 ui.note(_('copying changeset %s to %s\n') % (old, base))
2319
2317
2320 # Use version of files as in the old cset
2318 # Use version of files as in the old cset
2321 def filectxfn(repo, ctx_, path):
2319 def filectxfn(repo, ctx_, path):
2322 try:
2320 try:
2323 return old.filectx(path)
2321 return old.filectx(path)
2324 except KeyError:
2322 except KeyError:
2325 return None
2323 return None
2326
2324
2327 user = opts.get('user') or old.user()
2325 user = opts.get('user') or old.user()
2328 date = opts.get('date') or old.date()
2326 date = opts.get('date') or old.date()
2329 editform = mergeeditform(old, 'commit.amend')
2327 editform = mergeeditform(old, 'commit.amend')
2330 editor = getcommiteditor(editform=editform, **opts)
2328 editor = getcommiteditor(editform=editform, **opts)
2331 if not message:
2329 if not message:
2332 editor = getcommiteditor(edit=True, editform=editform)
2330 editor = getcommiteditor(edit=True, editform=editform)
2333 message = old.description()
2331 message = old.description()
2334
2332
2335 pureextra = extra.copy()
2333 pureextra = extra.copy()
2336 extra['amend_source'] = old.hex()
2334 extra['amend_source'] = old.hex()
2337
2335
2338 new = context.memctx(repo,
2336 new = context.memctx(repo,
2339 parents=[base.node(), old.p2().node()],
2337 parents=[base.node(), old.p2().node()],
2340 text=message,
2338 text=message,
2341 files=files,
2339 files=files,
2342 filectxfn=filectxfn,
2340 filectxfn=filectxfn,
2343 user=user,
2341 user=user,
2344 date=date,
2342 date=date,
2345 extra=extra,
2343 extra=extra,
2346 editor=editor)
2344 editor=editor)
2347
2345
2348 newdesc = changelog.stripdesc(new.description())
2346 newdesc = changelog.stripdesc(new.description())
2349 if ((not node)
2347 if ((not node)
2350 and newdesc == old.description()
2348 and newdesc == old.description()
2351 and user == old.user()
2349 and user == old.user()
2352 and date == old.date()
2350 and date == old.date()
2353 and pureextra == old.extra()):
2351 and pureextra == old.extra()):
2354 # nothing changed. continuing here would create a new node
2352 # nothing changed. continuing here would create a new node
2355 # anyway because of the amend_source noise.
2353 # anyway because of the amend_source noise.
2356 #
2354 #
2357 # This not what we expect from amend.
2355 # This not what we expect from amend.
2358 return old.node()
2356 return old.node()
2359
2357
2360 ph = repo.ui.config('phases', 'new-commit', phases.draft)
2358 ph = repo.ui.config('phases', 'new-commit', phases.draft)
2361 try:
2359 try:
2362 if opts.get('secret'):
2360 if opts.get('secret'):
2363 commitphase = 'secret'
2361 commitphase = 'secret'
2364 else:
2362 else:
2365 commitphase = old.phase()
2363 commitphase = old.phase()
2366 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')
2364 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')
2367 newid = repo.commitctx(new)
2365 newid = repo.commitctx(new)
2368 finally:
2366 finally:
2369 repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
2367 repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
2370 if newid != old.node():
2368 if newid != old.node():
2371 # Reroute the working copy parent to the new changeset
2369 # Reroute the working copy parent to the new changeset
2372 repo.setparents(newid, nullid)
2370 repo.setparents(newid, nullid)
2373
2371
2374 # Move bookmarks from old parent to amend commit
2372 # Move bookmarks from old parent to amend commit
2375 bms = repo.nodebookmarks(old.node())
2373 bms = repo.nodebookmarks(old.node())
2376 if bms:
2374 if bms:
2377 marks = repo._bookmarks
2375 marks = repo._bookmarks
2378 for bm in bms:
2376 for bm in bms:
2379 marks[bm] = newid
2377 marks[bm] = newid
2380 marks.write()
2378 marks.write()
2381 #commit the whole amend process
2379 #commit the whole amend process
2382 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
2380 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
2383 if createmarkers and newid != old.node():
2381 if createmarkers and newid != old.node():
2384 # mark the new changeset as successor of the rewritten one
2382 # mark the new changeset as successor of the rewritten one
2385 new = repo[newid]
2383 new = repo[newid]
2386 obs = [(old, (new,))]
2384 obs = [(old, (new,))]
2387 if node:
2385 if node:
2388 obs.append((ctx, ()))
2386 obs.append((ctx, ()))
2389
2387
2390 obsolete.createmarkers(repo, obs)
2388 obsolete.createmarkers(repo, obs)
2391 tr.close()
2389 tr.close()
2392 finally:
2390 finally:
2393 tr.release()
2391 tr.release()
2394 if not createmarkers and newid != old.node():
2392 if not createmarkers and newid != old.node():
2395 # Strip the intermediate commit (if there was one) and the amended
2393 # Strip the intermediate commit (if there was one) and the amended
2396 # commit
2394 # commit
2397 if node:
2395 if node:
2398 ui.note(_('stripping intermediate changeset %s\n') % ctx)
2396 ui.note(_('stripping intermediate changeset %s\n') % ctx)
2399 ui.note(_('stripping amended changeset %s\n') % old)
2397 ui.note(_('stripping amended changeset %s\n') % old)
2400 repair.strip(ui, repo, old.node(), topic='amend-backup')
2398 repair.strip(ui, repo, old.node(), topic='amend-backup')
2401 finally:
2399 finally:
2402 if newid is None:
2400 if newid is None:
2403 repo.dirstate.invalidate()
2401 repo.dirstate.invalidate()
2404 lockmod.release(lock, wlock)
2402 lockmod.release(lock, wlock)
2405 return newid
2403 return newid
2406
2404
2407 def commiteditor(repo, ctx, subs, editform=''):
2405 def commiteditor(repo, ctx, subs, editform=''):
2408 if ctx.description():
2406 if ctx.description():
2409 return ctx.description()
2407 return ctx.description()
2410 return commitforceeditor(repo, ctx, subs, editform=editform)
2408 return commitforceeditor(repo, ctx, subs, editform=editform)
2411
2409
2412 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
2410 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
2413 editform=''):
2411 editform=''):
2414 if not extramsg:
2412 if not extramsg:
2415 extramsg = _("Leave message empty to abort commit.")
2413 extramsg = _("Leave message empty to abort commit.")
2416
2414
2417 forms = [e for e in editform.split('.') if e]
2415 forms = [e for e in editform.split('.') if e]
2418 forms.insert(0, 'changeset')
2416 forms.insert(0, 'changeset')
2419 while forms:
2417 while forms:
2420 tmpl = repo.ui.config('committemplate', '.'.join(forms))
2418 tmpl = repo.ui.config('committemplate', '.'.join(forms))
2421 if tmpl:
2419 if tmpl:
2422 committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl)
2420 committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl)
2423 break
2421 break
2424 forms.pop()
2422 forms.pop()
2425 else:
2423 else:
2426 committext = buildcommittext(repo, ctx, subs, extramsg)
2424 committext = buildcommittext(repo, ctx, subs, extramsg)
2427
2425
2428 # run editor in the repository root
2426 # run editor in the repository root
2429 olddir = os.getcwd()
2427 olddir = os.getcwd()
2430 os.chdir(repo.root)
2428 os.chdir(repo.root)
2431 text = repo.ui.edit(committext, ctx.user(), ctx.extra(), editform=editform)
2429 text = repo.ui.edit(committext, ctx.user(), ctx.extra(), editform=editform)
2432 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
2430 text = re.sub("(?m)^HG:.*(\n|$)", "", text)
2433 os.chdir(olddir)
2431 os.chdir(olddir)
2434
2432
2435 if finishdesc:
2433 if finishdesc:
2436 text = finishdesc(text)
2434 text = finishdesc(text)
2437 if not text.strip():
2435 if not text.strip():
2438 raise util.Abort(_("empty commit message"))
2436 raise util.Abort(_("empty commit message"))
2439
2437
2440 return text
2438 return text
2441
2439
2442 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl):
2440 def buildcommittemplate(repo, ctx, subs, extramsg, tmpl):
2443 ui = repo.ui
2441 ui = repo.ui
2444 tmpl, mapfile = gettemplate(ui, tmpl, None)
2442 tmpl, mapfile = gettemplate(ui, tmpl, None)
2445
2443
2446 try:
2444 try:
2447 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False)
2445 t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False)
2448 except SyntaxError, inst:
2446 except SyntaxError, inst:
2449 raise util.Abort(inst.args[0])
2447 raise util.Abort(inst.args[0])
2450
2448
2451 for k, v in repo.ui.configitems('committemplate'):
2449 for k, v in repo.ui.configitems('committemplate'):
2452 if k != 'changeset':
2450 if k != 'changeset':
2453 t.t.cache[k] = v
2451 t.t.cache[k] = v
2454
2452
2455 if not extramsg:
2453 if not extramsg:
2456 extramsg = '' # ensure that extramsg is string
2454 extramsg = '' # ensure that extramsg is string
2457
2455
2458 ui.pushbuffer()
2456 ui.pushbuffer()
2459 t.show(ctx, extramsg=extramsg)
2457 t.show(ctx, extramsg=extramsg)
2460 return ui.popbuffer()
2458 return ui.popbuffer()
2461
2459
2462 def buildcommittext(repo, ctx, subs, extramsg):
2460 def buildcommittext(repo, ctx, subs, extramsg):
2463 edittext = []
2461 edittext = []
2464 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
2462 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
2465 if ctx.description():
2463 if ctx.description():
2466 edittext.append(ctx.description())
2464 edittext.append(ctx.description())
2467 edittext.append("")
2465 edittext.append("")
2468 edittext.append("") # Empty line between message and comments.
2466 edittext.append("") # Empty line between message and comments.
2469 edittext.append(_("HG: Enter commit message."
2467 edittext.append(_("HG: Enter commit message."
2470 " Lines beginning with 'HG:' are removed."))
2468 " Lines beginning with 'HG:' are removed."))
2471 edittext.append("HG: %s" % extramsg)
2469 edittext.append("HG: %s" % extramsg)
2472 edittext.append("HG: --")
2470 edittext.append("HG: --")
2473 edittext.append(_("HG: user: %s") % ctx.user())
2471 edittext.append(_("HG: user: %s") % ctx.user())
2474 if ctx.p2():
2472 if ctx.p2():
2475 edittext.append(_("HG: branch merge"))
2473 edittext.append(_("HG: branch merge"))
2476 if ctx.branch():
2474 if ctx.branch():
2477 edittext.append(_("HG: branch '%s'") % ctx.branch())
2475 edittext.append(_("HG: branch '%s'") % ctx.branch())
2478 if bookmarks.iscurrent(repo):
2476 if bookmarks.iscurrent(repo):
2479 edittext.append(_("HG: bookmark '%s'") % repo._bookmarkcurrent)
2477 edittext.append(_("HG: bookmark '%s'") % repo._bookmarkcurrent)
2480 edittext.extend([_("HG: subrepo %s") % s for s in subs])
2478 edittext.extend([_("HG: subrepo %s") % s for s in subs])
2481 edittext.extend([_("HG: added %s") % f for f in added])
2479 edittext.extend([_("HG: added %s") % f for f in added])
2482 edittext.extend([_("HG: changed %s") % f for f in modified])
2480 edittext.extend([_("HG: changed %s") % f for f in modified])
2483 edittext.extend([_("HG: removed %s") % f for f in removed])
2481 edittext.extend([_("HG: removed %s") % f for f in removed])
2484 if not added and not modified and not removed:
2482 if not added and not modified and not removed:
2485 edittext.append(_("HG: no files changed"))
2483 edittext.append(_("HG: no files changed"))
2486 edittext.append("")
2484 edittext.append("")
2487
2485
2488 return "\n".join(edittext)
2486 return "\n".join(edittext)
2489
2487
2490 def commitstatus(repo, node, branch, bheads=None, opts={}):
2488 def commitstatus(repo, node, branch, bheads=None, opts={}):
2491 ctx = repo[node]
2489 ctx = repo[node]
2492 parents = ctx.parents()
2490 parents = ctx.parents()
2493
2491
2494 if (not opts.get('amend') and bheads and node not in bheads and not
2492 if (not opts.get('amend') and bheads and node not in bheads and not
2495 [x for x in parents if x.node() in bheads and x.branch() == branch]):
2493 [x for x in parents if x.node() in bheads and x.branch() == branch]):
2496 repo.ui.status(_('created new head\n'))
2494 repo.ui.status(_('created new head\n'))
2497 # The message is not printed for initial roots. For the other
2495 # The message is not printed for initial roots. For the other
2498 # changesets, it is printed in the following situations:
2496 # changesets, it is printed in the following situations:
2499 #
2497 #
2500 # Par column: for the 2 parents with ...
2498 # Par column: for the 2 parents with ...
2501 # N: null or no parent
2499 # N: null or no parent
2502 # B: parent is on another named branch
2500 # B: parent is on another named branch
2503 # C: parent is a regular non head changeset
2501 # C: parent is a regular non head changeset
2504 # H: parent was a branch head of the current branch
2502 # H: parent was a branch head of the current branch
2505 # Msg column: whether we print "created new head" message
2503 # Msg column: whether we print "created new head" message
2506 # In the following, it is assumed that there already exists some
2504 # In the following, it is assumed that there already exists some
2507 # initial branch heads of the current branch, otherwise nothing is
2505 # initial branch heads of the current branch, otherwise nothing is
2508 # printed anyway.
2506 # printed anyway.
2509 #
2507 #
2510 # Par Msg Comment
2508 # Par Msg Comment
2511 # N N y additional topo root
2509 # N N y additional topo root
2512 #
2510 #
2513 # B N y additional branch root
2511 # B N y additional branch root
2514 # C N y additional topo head
2512 # C N y additional topo head
2515 # H N n usual case
2513 # H N n usual case
2516 #
2514 #
2517 # B B y weird additional branch root
2515 # B B y weird additional branch root
2518 # C B y branch merge
2516 # C B y branch merge
2519 # H B n merge with named branch
2517 # H B n merge with named branch
2520 #
2518 #
2521 # C C y additional head from merge
2519 # C C y additional head from merge
2522 # C H n merge with a head
2520 # C H n merge with a head
2523 #
2521 #
2524 # H H n head merge: head count decreases
2522 # H H n head merge: head count decreases
2525
2523
2526 if not opts.get('close_branch'):
2524 if not opts.get('close_branch'):
2527 for r in parents:
2525 for r in parents:
2528 if r.closesbranch() and r.branch() == branch:
2526 if r.closesbranch() and r.branch() == branch:
2529 repo.ui.status(_('reopening closed branch head %d\n') % r)
2527 repo.ui.status(_('reopening closed branch head %d\n') % r)
2530
2528
2531 if repo.ui.debugflag:
2529 if repo.ui.debugflag:
2532 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
2530 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
2533 elif repo.ui.verbose:
2531 elif repo.ui.verbose:
2534 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
2532 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
2535
2533
2536 def revert(ui, repo, ctx, parents, *pats, **opts):
2534 def revert(ui, repo, ctx, parents, *pats, **opts):
2537 parent, p2 = parents
2535 parent, p2 = parents
2538 node = ctx.node()
2536 node = ctx.node()
2539
2537
2540 mf = ctx.manifest()
2538 mf = ctx.manifest()
2541 if node == p2:
2539 if node == p2:
2542 parent = p2
2540 parent = p2
2543 if node == parent:
2541 if node == parent:
2544 pmf = mf
2542 pmf = mf
2545 else:
2543 else:
2546 pmf = None
2544 pmf = None
2547
2545
2548 # need all matching names in dirstate and manifest of target rev,
2546 # need all matching names in dirstate and manifest of target rev,
2549 # so have to walk both. do not print errors if files exist in one
2547 # so have to walk both. do not print errors if files exist in one
2550 # but not other.
2548 # but not other.
2551
2549
2552 # `names` is a mapping for all elements in working copy and target revision
2550 # `names` is a mapping for all elements in working copy and target revision
2553 # The mapping is in the form:
2551 # The mapping is in the form:
2554 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
2552 # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>)
2555 names = {}
2553 names = {}
2556
2554
2557 wlock = repo.wlock()
2555 wlock = repo.wlock()
2558 try:
2556 try:
2559 ## filling of the `names` mapping
2557 ## filling of the `names` mapping
2560 # walk dirstate to fill `names`
2558 # walk dirstate to fill `names`
2561
2559
2562 m = scmutil.match(repo[None], pats, opts)
2560 m = scmutil.match(repo[None], pats, opts)
2563 if not m.always() or node != parent:
2561 if not m.always() or node != parent:
2564 m.bad = lambda x, y: False
2562 m.bad = lambda x, y: False
2565 for abs in repo.walk(m):
2563 for abs in repo.walk(m):
2566 names[abs] = m.rel(abs), m.exact(abs)
2564 names[abs] = m.rel(abs), m.exact(abs)
2567
2565
2568 # walk target manifest to fill `names`
2566 # walk target manifest to fill `names`
2569
2567
2570 def badfn(path, msg):
2568 def badfn(path, msg):
2571 if path in names:
2569 if path in names:
2572 return
2570 return
2573 if path in ctx.substate:
2571 if path in ctx.substate:
2574 return
2572 return
2575 path_ = path + '/'
2573 path_ = path + '/'
2576 for f in names:
2574 for f in names:
2577 if f.startswith(path_):
2575 if f.startswith(path_):
2578 return
2576 return
2579 ui.warn("%s: %s\n" % (m.rel(path), msg))
2577 ui.warn("%s: %s\n" % (m.rel(path), msg))
2580
2578
2581 m = scmutil.match(ctx, pats, opts)
2579 m = scmutil.match(ctx, pats, opts)
2582 m.bad = badfn
2580 m.bad = badfn
2583 for abs in ctx.walk(m):
2581 for abs in ctx.walk(m):
2584 if abs not in names:
2582 if abs not in names:
2585 names[abs] = m.rel(abs), m.exact(abs)
2583 names[abs] = m.rel(abs), m.exact(abs)
2586
2584
2587 # Find status of all file in `names`.
2585 # Find status of all file in `names`.
2588 m = scmutil.matchfiles(repo, names)
2586 m = scmutil.matchfiles(repo, names)
2589
2587
2590 changes = repo.status(node1=node, match=m,
2588 changes = repo.status(node1=node, match=m,
2591 unknown=True, ignored=True, clean=True)
2589 unknown=True, ignored=True, clean=True)
2592 else:
2590 else:
2593 changes = repo.status(match=m)
2591 changes = repo.status(match=m)
2594 for kind in changes:
2592 for kind in changes:
2595 for abs in kind:
2593 for abs in kind:
2596 names[abs] = m.rel(abs), m.exact(abs)
2594 names[abs] = m.rel(abs), m.exact(abs)
2597
2595
2598 m = scmutil.matchfiles(repo, names)
2596 m = scmutil.matchfiles(repo, names)
2599
2597
2600 modified = set(changes.modified)
2598 modified = set(changes.modified)
2601 added = set(changes.added)
2599 added = set(changes.added)
2602 removed = set(changes.removed)
2600 removed = set(changes.removed)
2603 _deleted = set(changes.deleted)
2601 _deleted = set(changes.deleted)
2604 unknown = set(changes.unknown)
2602 unknown = set(changes.unknown)
2605 unknown.update(changes.ignored)
2603 unknown.update(changes.ignored)
2606 clean = set(changes.clean)
2604 clean = set(changes.clean)
2607 modadded = set()
2605 modadded = set()
2608
2606
2609 # split between files known in target manifest and the others
2607 # split between files known in target manifest and the others
2610 smf = set(mf)
2608 smf = set(mf)
2611
2609
2612 # determine the exact nature of the deleted changesets
2610 # determine the exact nature of the deleted changesets
2613 deladded = _deleted - smf
2611 deladded = _deleted - smf
2614 deleted = _deleted - deladded
2612 deleted = _deleted - deladded
2615
2613
2616 # We need to account for the state of file in the dirstate.
2614 # We need to account for the state of file in the dirstate.
2617 #
2615 #
2618 # Even, when we revert against something else than parent. This will
2616 # Even, when we revert against something else than parent. This will
2619 # slightly alter the behavior of revert (doing back up or not, delete
2617 # slightly alter the behavior of revert (doing back up or not, delete
2620 # or just forget etc).
2618 # or just forget etc).
2621 if parent == node:
2619 if parent == node:
2622 dsmodified = modified
2620 dsmodified = modified
2623 dsadded = added
2621 dsadded = added
2624 dsremoved = removed
2622 dsremoved = removed
2625 # store all local modifications, useful later for rename detection
2623 # store all local modifications, useful later for rename detection
2626 localchanges = dsmodified | dsadded
2624 localchanges = dsmodified | dsadded
2627 modified, added, removed = set(), set(), set()
2625 modified, added, removed = set(), set(), set()
2628 else:
2626 else:
2629 changes = repo.status(node1=parent, match=m)
2627 changes = repo.status(node1=parent, match=m)
2630 dsmodified = set(changes.modified)
2628 dsmodified = set(changes.modified)
2631 dsadded = set(changes.added)
2629 dsadded = set(changes.added)
2632 dsremoved = set(changes.removed)
2630 dsremoved = set(changes.removed)
2633 # store all local modifications, useful later for rename detection
2631 # store all local modifications, useful later for rename detection
2634 localchanges = dsmodified | dsadded
2632 localchanges = dsmodified | dsadded
2635
2633
2636 # only take into account for removes between wc and target
2634 # only take into account for removes between wc and target
2637 clean |= dsremoved - removed
2635 clean |= dsremoved - removed
2638 dsremoved &= removed
2636 dsremoved &= removed
2639 # distinct between dirstate remove and other
2637 # distinct between dirstate remove and other
2640 removed -= dsremoved
2638 removed -= dsremoved
2641
2639
2642 modadded = added & dsmodified
2640 modadded = added & dsmodified
2643 added -= modadded
2641 added -= modadded
2644
2642
2645 # tell newly modified apart.
2643 # tell newly modified apart.
2646 dsmodified &= modified
2644 dsmodified &= modified
2647 dsmodified |= modified & dsadded # dirstate added may needs backup
2645 dsmodified |= modified & dsadded # dirstate added may needs backup
2648 modified -= dsmodified
2646 modified -= dsmodified
2649
2647
2650 # We need to wait for some post-processing to update this set
2648 # We need to wait for some post-processing to update this set
2651 # before making the distinction. The dirstate will be used for
2649 # before making the distinction. The dirstate will be used for
2652 # that purpose.
2650 # that purpose.
2653 dsadded = added
2651 dsadded = added
2654
2652
2655 # in case of merge, files that are actually added can be reported as
2653 # in case of merge, files that are actually added can be reported as
2656 # modified, we need to post process the result
2654 # modified, we need to post process the result
2657 if p2 != nullid:
2655 if p2 != nullid:
2658 if pmf is None:
2656 if pmf is None:
2659 # only need parent manifest in the merge case,
2657 # only need parent manifest in the merge case,
2660 # so do not read by default
2658 # so do not read by default
2661 pmf = repo[parent].manifest()
2659 pmf = repo[parent].manifest()
2662 mergeadd = dsmodified - set(pmf)
2660 mergeadd = dsmodified - set(pmf)
2663 dsadded |= mergeadd
2661 dsadded |= mergeadd
2664 dsmodified -= mergeadd
2662 dsmodified -= mergeadd
2665
2663
2666 # if f is a rename, update `names` to also revert the source
2664 # if f is a rename, update `names` to also revert the source
2667 cwd = repo.getcwd()
2665 cwd = repo.getcwd()
2668 for f in localchanges:
2666 for f in localchanges:
2669 src = repo.dirstate.copied(f)
2667 src = repo.dirstate.copied(f)
2670 # XXX should we check for rename down to target node?
2668 # XXX should we check for rename down to target node?
2671 if src and src not in names and repo.dirstate[src] == 'r':
2669 if src and src not in names and repo.dirstate[src] == 'r':
2672 dsremoved.add(src)
2670 dsremoved.add(src)
2673 names[src] = (repo.pathto(src, cwd), True)
2671 names[src] = (repo.pathto(src, cwd), True)
2674
2672
2675 # distinguish between file to forget and the other
2673 # distinguish between file to forget and the other
2676 added = set()
2674 added = set()
2677 for abs in dsadded:
2675 for abs in dsadded:
2678 if repo.dirstate[abs] != 'a':
2676 if repo.dirstate[abs] != 'a':
2679 added.add(abs)
2677 added.add(abs)
2680 dsadded -= added
2678 dsadded -= added
2681
2679
2682 for abs in deladded:
2680 for abs in deladded:
2683 if repo.dirstate[abs] == 'a':
2681 if repo.dirstate[abs] == 'a':
2684 dsadded.add(abs)
2682 dsadded.add(abs)
2685 deladded -= dsadded
2683 deladded -= dsadded
2686
2684
2687 # For files marked as removed, we check if an unknown file is present at
2685 # For files marked as removed, we check if an unknown file is present at
2688 # the same path. If a such file exists it may need to be backed up.
2686 # the same path. If a such file exists it may need to be backed up.
2689 # Making the distinction at this stage helps have simpler backup
2687 # Making the distinction at this stage helps have simpler backup
2690 # logic.
2688 # logic.
2691 removunk = set()
2689 removunk = set()
2692 for abs in removed:
2690 for abs in removed:
2693 target = repo.wjoin(abs)
2691 target = repo.wjoin(abs)
2694 if os.path.lexists(target):
2692 if os.path.lexists(target):
2695 removunk.add(abs)
2693 removunk.add(abs)
2696 removed -= removunk
2694 removed -= removunk
2697
2695
2698 dsremovunk = set()
2696 dsremovunk = set()
2699 for abs in dsremoved:
2697 for abs in dsremoved:
2700 target = repo.wjoin(abs)
2698 target = repo.wjoin(abs)
2701 if os.path.lexists(target):
2699 if os.path.lexists(target):
2702 dsremovunk.add(abs)
2700 dsremovunk.add(abs)
2703 dsremoved -= dsremovunk
2701 dsremoved -= dsremovunk
2704
2702
2705 # action to be actually performed by revert
2703 # action to be actually performed by revert
2706 # (<list of file>, message>) tuple
2704 # (<list of file>, message>) tuple
2707 actions = {'revert': ([], _('reverting %s\n')),
2705 actions = {'revert': ([], _('reverting %s\n')),
2708 'add': ([], _('adding %s\n')),
2706 'add': ([], _('adding %s\n')),
2709 'remove': ([], _('removing %s\n')),
2707 'remove': ([], _('removing %s\n')),
2710 'drop': ([], _('removing %s\n')),
2708 'drop': ([], _('removing %s\n')),
2711 'forget': ([], _('forgetting %s\n')),
2709 'forget': ([], _('forgetting %s\n')),
2712 'undelete': ([], _('undeleting %s\n')),
2710 'undelete': ([], _('undeleting %s\n')),
2713 'noop': (None, _('no changes needed to %s\n')),
2711 'noop': (None, _('no changes needed to %s\n')),
2714 'unknown': (None, _('file not managed: %s\n')),
2712 'unknown': (None, _('file not managed: %s\n')),
2715 }
2713 }
2716
2714
2717 # "constant" that convey the backup strategy.
2715 # "constant" that convey the backup strategy.
2718 # All set to `discard` if `no-backup` is set do avoid checking
2716 # All set to `discard` if `no-backup` is set do avoid checking
2719 # no_backup lower in the code.
2717 # no_backup lower in the code.
2720 # These values are ordered for comparison purposes
2718 # These values are ordered for comparison purposes
2721 backup = 2 # unconditionally do backup
2719 backup = 2 # unconditionally do backup
2722 check = 1 # check if the existing file differs from target
2720 check = 1 # check if the existing file differs from target
2723 discard = 0 # never do backup
2721 discard = 0 # never do backup
2724 if opts.get('no_backup'):
2722 if opts.get('no_backup'):
2725 backup = check = discard
2723 backup = check = discard
2726
2724
2727 backupanddel = actions['remove']
2725 backupanddel = actions['remove']
2728 if not opts.get('no_backup'):
2726 if not opts.get('no_backup'):
2729 backupanddel = actions['drop']
2727 backupanddel = actions['drop']
2730
2728
2731 disptable = (
2729 disptable = (
2732 # dispatch table:
2730 # dispatch table:
2733 # file state
2731 # file state
2734 # action
2732 # action
2735 # make backup
2733 # make backup
2736
2734
2737 ## Sets that results that will change file on disk
2735 ## Sets that results that will change file on disk
2738 # Modified compared to target, no local change
2736 # Modified compared to target, no local change
2739 (modified, actions['revert'], discard),
2737 (modified, actions['revert'], discard),
2740 # Modified compared to target, but local file is deleted
2738 # Modified compared to target, but local file is deleted
2741 (deleted, actions['revert'], discard),
2739 (deleted, actions['revert'], discard),
2742 # Modified compared to target, local change
2740 # Modified compared to target, local change
2743 (dsmodified, actions['revert'], backup),
2741 (dsmodified, actions['revert'], backup),
2744 # Added since target
2742 # Added since target
2745 (added, actions['remove'], discard),
2743 (added, actions['remove'], discard),
2746 # Added in working directory
2744 # Added in working directory
2747 (dsadded, actions['forget'], discard),
2745 (dsadded, actions['forget'], discard),
2748 # Added since target, have local modification
2746 # Added since target, have local modification
2749 (modadded, backupanddel, backup),
2747 (modadded, backupanddel, backup),
2750 # Added since target but file is missing in working directory
2748 # Added since target but file is missing in working directory
2751 (deladded, actions['drop'], discard),
2749 (deladded, actions['drop'], discard),
2752 # Removed since target, before working copy parent
2750 # Removed since target, before working copy parent
2753 (removed, actions['add'], discard),
2751 (removed, actions['add'], discard),
2754 # Same as `removed` but an unknown file exists at the same path
2752 # Same as `removed` but an unknown file exists at the same path
2755 (removunk, actions['add'], check),
2753 (removunk, actions['add'], check),
2756 # Removed since targe, marked as such in working copy parent
2754 # Removed since targe, marked as such in working copy parent
2757 (dsremoved, actions['undelete'], discard),
2755 (dsremoved, actions['undelete'], discard),
2758 # Same as `dsremoved` but an unknown file exists at the same path
2756 # Same as `dsremoved` but an unknown file exists at the same path
2759 (dsremovunk, actions['undelete'], check),
2757 (dsremovunk, actions['undelete'], check),
2760 ## the following sets does not result in any file changes
2758 ## the following sets does not result in any file changes
2761 # File with no modification
2759 # File with no modification
2762 (clean, actions['noop'], discard),
2760 (clean, actions['noop'], discard),
2763 # Existing file, not tracked anywhere
2761 # Existing file, not tracked anywhere
2764 (unknown, actions['unknown'], discard),
2762 (unknown, actions['unknown'], discard),
2765 )
2763 )
2766
2764
2767 wctx = repo[None]
2765 wctx = repo[None]
2768 for abs, (rel, exact) in sorted(names.items()):
2766 for abs, (rel, exact) in sorted(names.items()):
2769 # target file to be touch on disk (relative to cwd)
2767 # target file to be touch on disk (relative to cwd)
2770 target = repo.wjoin(abs)
2768 target = repo.wjoin(abs)
2771 # search the entry in the dispatch table.
2769 # search the entry in the dispatch table.
2772 # if the file is in any of these sets, it was touched in the working
2770 # if the file is in any of these sets, it was touched in the working
2773 # directory parent and we are sure it needs to be reverted.
2771 # directory parent and we are sure it needs to be reverted.
2774 for table, (xlist, msg), dobackup in disptable:
2772 for table, (xlist, msg), dobackup in disptable:
2775 if abs not in table:
2773 if abs not in table:
2776 continue
2774 continue
2777 if xlist is not None:
2775 if xlist is not None:
2778 xlist.append(abs)
2776 xlist.append(abs)
2779 if dobackup and (backup <= dobackup
2777 if dobackup and (backup <= dobackup
2780 or wctx[abs].cmp(ctx[abs])):
2778 or wctx[abs].cmp(ctx[abs])):
2781 bakname = "%s.orig" % rel
2779 bakname = "%s.orig" % rel
2782 ui.note(_('saving current version of %s as %s\n') %
2780 ui.note(_('saving current version of %s as %s\n') %
2783 (rel, bakname))
2781 (rel, bakname))
2784 if not opts.get('dry_run'):
2782 if not opts.get('dry_run'):
2785 util.rename(target, bakname)
2783 util.rename(target, bakname)
2786 if ui.verbose or not exact:
2784 if ui.verbose or not exact:
2787 if not isinstance(msg, basestring):
2785 if not isinstance(msg, basestring):
2788 msg = msg(abs)
2786 msg = msg(abs)
2789 ui.status(msg % rel)
2787 ui.status(msg % rel)
2790 elif exact:
2788 elif exact:
2791 ui.warn(msg % rel)
2789 ui.warn(msg % rel)
2792 break
2790 break
2793
2791
2794
2792
2795 if not opts.get('dry_run'):
2793 if not opts.get('dry_run'):
2796 needdata = ('revert', 'add', 'undelete')
2794 needdata = ('revert', 'add', 'undelete')
2797 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
2795 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
2798
2796
2799 _performrevert(repo, parents, ctx, actions)
2797 _performrevert(repo, parents, ctx, actions)
2800
2798
2801 # get the list of subrepos that must be reverted
2799 # get the list of subrepos that must be reverted
2802 subrepomatch = scmutil.match(ctx, pats, opts)
2800 subrepomatch = scmutil.match(ctx, pats, opts)
2803 targetsubs = sorted(s for s in ctx.substate if subrepomatch(s))
2801 targetsubs = sorted(s for s in ctx.substate if subrepomatch(s))
2804
2802
2805 if targetsubs:
2803 if targetsubs:
2806 # Revert the subrepos on the revert list
2804 # Revert the subrepos on the revert list
2807 for sub in targetsubs:
2805 for sub in targetsubs:
2808 ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
2806 ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts)
2809 finally:
2807 finally:
2810 wlock.release()
2808 wlock.release()
2811
2809
2812 def _revertprefetch(repo, ctx, *files):
2810 def _revertprefetch(repo, ctx, *files):
2813 """Let extension changing the storage layer prefetch content"""
2811 """Let extension changing the storage layer prefetch content"""
2814 pass
2812 pass
2815
2813
2816 def _performrevert(repo, parents, ctx, actions):
2814 def _performrevert(repo, parents, ctx, actions):
2817 """function that actually perform all the actions computed for revert
2815 """function that actually perform all the actions computed for revert
2818
2816
2819 This is an independent function to let extension to plug in and react to
2817 This is an independent function to let extension to plug in and react to
2820 the imminent revert.
2818 the imminent revert.
2821
2819
2822 Make sure you have the working directory locked when calling this function.
2820 Make sure you have the working directory locked when calling this function.
2823 """
2821 """
2824 parent, p2 = parents
2822 parent, p2 = parents
2825 node = ctx.node()
2823 node = ctx.node()
2826 def checkout(f):
2824 def checkout(f):
2827 fc = ctx[f]
2825 fc = ctx[f]
2828 repo.wwrite(f, fc.data(), fc.flags())
2826 repo.wwrite(f, fc.data(), fc.flags())
2829
2827
2830 audit_path = pathutil.pathauditor(repo.root)
2828 audit_path = pathutil.pathauditor(repo.root)
2831 for f in actions['forget'][0]:
2829 for f in actions['forget'][0]:
2832 repo.dirstate.drop(f)
2830 repo.dirstate.drop(f)
2833 for f in actions['remove'][0]:
2831 for f in actions['remove'][0]:
2834 audit_path(f)
2832 audit_path(f)
2835 util.unlinkpath(repo.wjoin(f))
2833 util.unlinkpath(repo.wjoin(f))
2836 repo.dirstate.remove(f)
2834 repo.dirstate.remove(f)
2837 for f in actions['drop'][0]:
2835 for f in actions['drop'][0]:
2838 audit_path(f)
2836 audit_path(f)
2839 repo.dirstate.remove(f)
2837 repo.dirstate.remove(f)
2840
2838
2841 normal = None
2839 normal = None
2842 if node == parent:
2840 if node == parent:
2843 # We're reverting to our parent. If possible, we'd like status
2841 # We're reverting to our parent. If possible, we'd like status
2844 # to report the file as clean. We have to use normallookup for
2842 # to report the file as clean. We have to use normallookup for
2845 # merges to avoid losing information about merged/dirty files.
2843 # merges to avoid losing information about merged/dirty files.
2846 if p2 != nullid:
2844 if p2 != nullid:
2847 normal = repo.dirstate.normallookup
2845 normal = repo.dirstate.normallookup
2848 else:
2846 else:
2849 normal = repo.dirstate.normal
2847 normal = repo.dirstate.normal
2850 for f in actions['revert'][0]:
2848 for f in actions['revert'][0]:
2851 checkout(f)
2849 checkout(f)
2852 if normal:
2850 if normal:
2853 normal(f)
2851 normal(f)
2854
2852
2855 for f in actions['add'][0]:
2853 for f in actions['add'][0]:
2856 checkout(f)
2854 checkout(f)
2857 repo.dirstate.add(f)
2855 repo.dirstate.add(f)
2858
2856
2859 normal = repo.dirstate.normallookup
2857 normal = repo.dirstate.normallookup
2860 if node == parent and p2 == nullid:
2858 if node == parent and p2 == nullid:
2861 normal = repo.dirstate.normal
2859 normal = repo.dirstate.normal
2862 for f in actions['undelete'][0]:
2860 for f in actions['undelete'][0]:
2863 checkout(f)
2861 checkout(f)
2864 normal(f)
2862 normal(f)
2865
2863
2866 copied = copies.pathcopies(repo[parent], ctx)
2864 copied = copies.pathcopies(repo[parent], ctx)
2867
2865
2868 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
2866 for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]:
2869 if f in copied:
2867 if f in copied:
2870 repo.dirstate.copy(copied[f], f)
2868 repo.dirstate.copy(copied[f], f)
2871
2869
2872 def command(table):
2870 def command(table):
2873 """Returns a function object to be used as a decorator for making commands.
2871 """Returns a function object to be used as a decorator for making commands.
2874
2872
2875 This function receives a command table as its argument. The table should
2873 This function receives a command table as its argument. The table should
2876 be a dict.
2874 be a dict.
2877
2875
2878 The returned function can be used as a decorator for adding commands
2876 The returned function can be used as a decorator for adding commands
2879 to that command table. This function accepts multiple arguments to define
2877 to that command table. This function accepts multiple arguments to define
2880 a command.
2878 a command.
2881
2879
2882 The first argument is the command name.
2880 The first argument is the command name.
2883
2881
2884 The options argument is an iterable of tuples defining command arguments.
2882 The options argument is an iterable of tuples defining command arguments.
2885 See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
2883 See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
2886
2884
2887 The synopsis argument defines a short, one line summary of how to use the
2885 The synopsis argument defines a short, one line summary of how to use the
2888 command. This shows up in the help output.
2886 command. This shows up in the help output.
2889
2887
2890 The norepo argument defines whether the command does not require a
2888 The norepo argument defines whether the command does not require a
2891 local repository. Most commands operate against a repository, thus the
2889 local repository. Most commands operate against a repository, thus the
2892 default is False.
2890 default is False.
2893
2891
2894 The optionalrepo argument defines whether the command optionally requires
2892 The optionalrepo argument defines whether the command optionally requires
2895 a local repository.
2893 a local repository.
2896
2894
2897 The inferrepo argument defines whether to try to find a repository from the
2895 The inferrepo argument defines whether to try to find a repository from the
2898 command line arguments. If True, arguments will be examined for potential
2896 command line arguments. If True, arguments will be examined for potential
2899 repository locations. See ``findrepo()``. If a repository is found, it
2897 repository locations. See ``findrepo()``. If a repository is found, it
2900 will be used.
2898 will be used.
2901 """
2899 """
2902 def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False,
2900 def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False,
2903 inferrepo=False):
2901 inferrepo=False):
2904 def decorator(func):
2902 def decorator(func):
2905 if synopsis:
2903 if synopsis:
2906 table[name] = func, list(options), synopsis
2904 table[name] = func, list(options), synopsis
2907 else:
2905 else:
2908 table[name] = func, list(options)
2906 table[name] = func, list(options)
2909
2907
2910 if norepo:
2908 if norepo:
2911 # Avoid import cycle.
2909 # Avoid import cycle.
2912 import commands
2910 import commands
2913 commands.norepo += ' %s' % ' '.join(parsealiases(name))
2911 commands.norepo += ' %s' % ' '.join(parsealiases(name))
2914
2912
2915 if optionalrepo:
2913 if optionalrepo:
2916 import commands
2914 import commands
2917 commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
2915 commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
2918
2916
2919 if inferrepo:
2917 if inferrepo:
2920 import commands
2918 import commands
2921 commands.inferrepo += ' %s' % ' '.join(parsealiases(name))
2919 commands.inferrepo += ' %s' % ' '.join(parsealiases(name))
2922
2920
2923 return func
2921 return func
2924 return decorator
2922 return decorator
2925
2923
2926 return cmd
2924 return cmd
2927
2925
2928 # a list of (ui, repo, otherpeer, opts, missing) functions called by
2926 # a list of (ui, repo, otherpeer, opts, missing) functions called by
2929 # commands.outgoing. "missing" is "missing" of the result of
2927 # commands.outgoing. "missing" is "missing" of the result of
2930 # "findcommonoutgoing()"
2928 # "findcommonoutgoing()"
2931 outgoinghooks = util.hooks()
2929 outgoinghooks = util.hooks()
2932
2930
2933 # a list of (ui, repo) functions called by commands.summary
2931 # a list of (ui, repo) functions called by commands.summary
2934 summaryhooks = util.hooks()
2932 summaryhooks = util.hooks()
2935
2933
2936 # a list of (ui, repo, opts, changes) functions called by commands.summary.
2934 # a list of (ui, repo, opts, changes) functions called by commands.summary.
2937 #
2935 #
2938 # functions should return tuple of booleans below, if 'changes' is None:
2936 # functions should return tuple of booleans below, if 'changes' is None:
2939 # (whether-incomings-are-needed, whether-outgoings-are-needed)
2937 # (whether-incomings-are-needed, whether-outgoings-are-needed)
2940 #
2938 #
2941 # otherwise, 'changes' is a tuple of tuples below:
2939 # otherwise, 'changes' is a tuple of tuples below:
2942 # - (sourceurl, sourcebranch, sourcepeer, incoming)
2940 # - (sourceurl, sourcebranch, sourcepeer, incoming)
2943 # - (desturl, destbranch, destpeer, outgoing)
2941 # - (desturl, destbranch, destpeer, outgoing)
2944 summaryremotehooks = util.hooks()
2942 summaryremotehooks = util.hooks()
2945
2943
2946 # A list of state files kept by multistep operations like graft.
2944 # A list of state files kept by multistep operations like graft.
2947 # Since graft cannot be aborted, it is considered 'clearable' by update.
2945 # Since graft cannot be aborted, it is considered 'clearable' by update.
2948 # note: bisect is intentionally excluded
2946 # note: bisect is intentionally excluded
2949 # (state file, clearable, allowcommit, error, hint)
2947 # (state file, clearable, allowcommit, error, hint)
2950 unfinishedstates = [
2948 unfinishedstates = [
2951 ('graftstate', True, False, _('graft in progress'),
2949 ('graftstate', True, False, _('graft in progress'),
2952 _("use 'hg graft --continue' or 'hg update' to abort")),
2950 _("use 'hg graft --continue' or 'hg update' to abort")),
2953 ('updatestate', True, False, _('last update was interrupted'),
2951 ('updatestate', True, False, _('last update was interrupted'),
2954 _("use 'hg update' to get a consistent checkout"))
2952 _("use 'hg update' to get a consistent checkout"))
2955 ]
2953 ]
2956
2954
2957 def checkunfinished(repo, commit=False):
2955 def checkunfinished(repo, commit=False):
2958 '''Look for an unfinished multistep operation, like graft, and abort
2956 '''Look for an unfinished multistep operation, like graft, and abort
2959 if found. It's probably good to check this right before
2957 if found. It's probably good to check this right before
2960 bailifchanged().
2958 bailifchanged().
2961 '''
2959 '''
2962 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2960 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2963 if commit and allowcommit:
2961 if commit and allowcommit:
2964 continue
2962 continue
2965 if repo.vfs.exists(f):
2963 if repo.vfs.exists(f):
2966 raise util.Abort(msg, hint=hint)
2964 raise util.Abort(msg, hint=hint)
2967
2965
2968 def clearunfinished(repo):
2966 def clearunfinished(repo):
2969 '''Check for unfinished operations (as above), and clear the ones
2967 '''Check for unfinished operations (as above), and clear the ones
2970 that are clearable.
2968 that are clearable.
2971 '''
2969 '''
2972 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2970 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2973 if not clearable and repo.vfs.exists(f):
2971 if not clearable and repo.vfs.exists(f):
2974 raise util.Abort(msg, hint=hint)
2972 raise util.Abort(msg, hint=hint)
2975 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2973 for f, clearable, allowcommit, msg, hint in unfinishedstates:
2976 if clearable and repo.vfs.exists(f):
2974 if clearable and repo.vfs.exists(f):
2977 util.unlink(repo.join(f))
2975 util.unlink(repo.join(f))
@@ -1,2357 +1,2360 b''
1 @ (34) head
1 @ (34) head
2 |
2 |
3 | o (33) head
3 | o (33) head
4 | |
4 | |
5 o | (32) expand
5 o | (32) expand
6 |\ \
6 |\ \
7 | o \ (31) expand
7 | o \ (31) expand
8 | |\ \
8 | |\ \
9 | | o \ (30) expand
9 | | o \ (30) expand
10 | | |\ \
10 | | |\ \
11 | | | o | (29) regular commit
11 | | | o | (29) regular commit
12 | | | | |
12 | | | | |
13 | | o | | (28) merge zero known
13 | | o | | (28) merge zero known
14 | | |\ \ \
14 | | |\ \ \
15 o | | | | | (27) collapse
15 o | | | | | (27) collapse
16 |/ / / / /
16 |/ / / / /
17 | | o---+ (26) merge one known; far right
17 | | o---+ (26) merge one known; far right
18 | | | | |
18 | | | | |
19 +---o | | (25) merge one known; far left
19 +---o | | (25) merge one known; far left
20 | | | | |
20 | | | | |
21 | | o | | (24) merge one known; immediate right
21 | | o | | (24) merge one known; immediate right
22 | | |\| |
22 | | |\| |
23 | | o | | (23) merge one known; immediate left
23 | | o | | (23) merge one known; immediate left
24 | |/| | |
24 | |/| | |
25 +---o---+ (22) merge two known; one far left, one far right
25 +---o---+ (22) merge two known; one far left, one far right
26 | | / /
26 | | / /
27 o | | | (21) expand
27 o | | | (21) expand
28 |\ \ \ \
28 |\ \ \ \
29 | o---+-+ (20) merge two known; two far right
29 | o---+-+ (20) merge two known; two far right
30 | / / /
30 | / / /
31 o | | | (19) expand
31 o | | | (19) expand
32 |\ \ \ \
32 |\ \ \ \
33 +---+---o (18) merge two known; two far left
33 +---+---o (18) merge two known; two far left
34 | | | |
34 | | | |
35 | o | | (17) expand
35 | o | | (17) expand
36 | |\ \ \
36 | |\ \ \
37 | | o---+ (16) merge two known; one immediate right, one near right
37 | | o---+ (16) merge two known; one immediate right, one near right
38 | | |/ /
38 | | |/ /
39 o | | | (15) expand
39 o | | | (15) expand
40 |\ \ \ \
40 |\ \ \ \
41 | o-----+ (14) merge two known; one immediate right, one far right
41 | o-----+ (14) merge two known; one immediate right, one far right
42 | |/ / /
42 | |/ / /
43 o | | | (13) expand
43 o | | | (13) expand
44 |\ \ \ \
44 |\ \ \ \
45 +---o | | (12) merge two known; one immediate right, one far left
45 +---o | | (12) merge two known; one immediate right, one far left
46 | | |/ /
46 | | |/ /
47 | o | | (11) expand
47 | o | | (11) expand
48 | |\ \ \
48 | |\ \ \
49 | | o---+ (10) merge two known; one immediate left, one near right
49 | | o---+ (10) merge two known; one immediate left, one near right
50 | |/ / /
50 | |/ / /
51 o | | | (9) expand
51 o | | | (9) expand
52 |\ \ \ \
52 |\ \ \ \
53 | o-----+ (8) merge two known; one immediate left, one far right
53 | o-----+ (8) merge two known; one immediate left, one far right
54 |/ / / /
54 |/ / / /
55 o | | | (7) expand
55 o | | | (7) expand
56 |\ \ \ \
56 |\ \ \ \
57 +---o | | (6) merge two known; one immediate left, one far left
57 +---o | | (6) merge two known; one immediate left, one far left
58 | |/ / /
58 | |/ / /
59 | o | | (5) expand
59 | o | | (5) expand
60 | |\ \ \
60 | |\ \ \
61 | | o | | (4) merge two known; one immediate left, one immediate right
61 | | o | | (4) merge two known; one immediate left, one immediate right
62 | |/|/ /
62 | |/|/ /
63 | o / / (3) collapse
63 | o / / (3) collapse
64 |/ / /
64 |/ / /
65 o / / (2) collapse
65 o / / (2) collapse
66 |/ /
66 |/ /
67 o / (1) collapse
67 o / (1) collapse
68 |/
68 |/
69 o (0) root
69 o (0) root
70
70
71
71
72 $ commit()
72 $ commit()
73 > {
73 > {
74 > rev=$1
74 > rev=$1
75 > msg=$2
75 > msg=$2
76 > shift 2
76 > shift 2
77 > if [ "$#" -gt 0 ]; then
77 > if [ "$#" -gt 0 ]; then
78 > hg debugsetparents "$@"
78 > hg debugsetparents "$@"
79 > fi
79 > fi
80 > echo $rev > a
80 > echo $rev > a
81 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
81 > hg commit -Aqd "$rev 0" -m "($rev) $msg"
82 > }
82 > }
83
83
84 $ cat > printrevset.py <<EOF
84 $ cat > printrevset.py <<EOF
85 > from mercurial import extensions, revset, commands, cmdutil
85 > from mercurial import extensions, revset, commands, cmdutil
86 >
86 >
87 > def uisetup(ui):
87 > def uisetup(ui):
88 > def printrevset(orig, ui, repo, *pats, **opts):
88 > def printrevset(orig, ui, repo, *pats, **opts):
89 > if opts.get('print_revset'):
89 > if opts.get('print_revset'):
90 > expr = cmdutil.getgraphlogrevs(repo, pats, opts)[1]
90 > expr = cmdutil.getgraphlogrevs(repo, pats, opts)[1]
91 > if expr:
91 > if expr:
92 > tree = revset.parse(expr)[0]
92 > tree = revset.parse(expr)[0]
93 > else:
93 > else:
94 > tree = []
94 > tree = []
95 > ui.write('%r\n' % (opts.get('rev', []),))
95 > ui.write('%r\n' % (opts.get('rev', []),))
96 > ui.write(revset.prettyformat(tree) + '\n')
96 > ui.write(revset.prettyformat(tree) + '\n')
97 > return 0
97 > return 0
98 > return orig(ui, repo, *pats, **opts)
98 > return orig(ui, repo, *pats, **opts)
99 > entry = extensions.wrapcommand(commands.table, 'log', printrevset)
99 > entry = extensions.wrapcommand(commands.table, 'log', printrevset)
100 > entry[1].append(('', 'print-revset', False,
100 > entry[1].append(('', 'print-revset', False,
101 > 'print generated revset and exit (DEPRECATED)'))
101 > 'print generated revset and exit (DEPRECATED)'))
102 > EOF
102 > EOF
103
103
104 $ echo "[extensions]" >> $HGRCPATH
104 $ echo "[extensions]" >> $HGRCPATH
105 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
105 $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
106
106
107 $ hg init repo
107 $ hg init repo
108 $ cd repo
108 $ cd repo
109
109
110 Empty repo:
110 Empty repo:
111
111
112 $ hg log -G
112 $ hg log -G
113
113
114
114
115 Building DAG:
115 Building DAG:
116
116
117 $ commit 0 "root"
117 $ commit 0 "root"
118 $ commit 1 "collapse" 0
118 $ commit 1 "collapse" 0
119 $ commit 2 "collapse" 1
119 $ commit 2 "collapse" 1
120 $ commit 3 "collapse" 2
120 $ commit 3 "collapse" 2
121 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
121 $ commit 4 "merge two known; one immediate left, one immediate right" 1 3
122 $ commit 5 "expand" 3 4
122 $ commit 5 "expand" 3 4
123 $ commit 6 "merge two known; one immediate left, one far left" 2 5
123 $ commit 6 "merge two known; one immediate left, one far left" 2 5
124 $ commit 7 "expand" 2 5
124 $ commit 7 "expand" 2 5
125 $ commit 8 "merge two known; one immediate left, one far right" 0 7
125 $ commit 8 "merge two known; one immediate left, one far right" 0 7
126 $ commit 9 "expand" 7 8
126 $ commit 9 "expand" 7 8
127 $ commit 10 "merge two known; one immediate left, one near right" 0 6
127 $ commit 10 "merge two known; one immediate left, one near right" 0 6
128 $ commit 11 "expand" 6 10
128 $ commit 11 "expand" 6 10
129 $ commit 12 "merge two known; one immediate right, one far left" 1 9
129 $ commit 12 "merge two known; one immediate right, one far left" 1 9
130 $ commit 13 "expand" 9 11
130 $ commit 13 "expand" 9 11
131 $ commit 14 "merge two known; one immediate right, one far right" 0 12
131 $ commit 14 "merge two known; one immediate right, one far right" 0 12
132 $ commit 15 "expand" 13 14
132 $ commit 15 "expand" 13 14
133 $ commit 16 "merge two known; one immediate right, one near right" 0 1
133 $ commit 16 "merge two known; one immediate right, one near right" 0 1
134 $ commit 17 "expand" 12 16
134 $ commit 17 "expand" 12 16
135 $ commit 18 "merge two known; two far left" 1 15
135 $ commit 18 "merge two known; two far left" 1 15
136 $ commit 19 "expand" 15 17
136 $ commit 19 "expand" 15 17
137 $ commit 20 "merge two known; two far right" 0 18
137 $ commit 20 "merge two known; two far right" 0 18
138 $ commit 21 "expand" 19 20
138 $ commit 21 "expand" 19 20
139 $ commit 22 "merge two known; one far left, one far right" 18 21
139 $ commit 22 "merge two known; one far left, one far right" 18 21
140 $ commit 23 "merge one known; immediate left" 1 22
140 $ commit 23 "merge one known; immediate left" 1 22
141 $ commit 24 "merge one known; immediate right" 0 23
141 $ commit 24 "merge one known; immediate right" 0 23
142 $ commit 25 "merge one known; far left" 21 24
142 $ commit 25 "merge one known; far left" 21 24
143 $ commit 26 "merge one known; far right" 18 25
143 $ commit 26 "merge one known; far right" 18 25
144 $ commit 27 "collapse" 21
144 $ commit 27 "collapse" 21
145 $ commit 28 "merge zero known" 1 26
145 $ commit 28 "merge zero known" 1 26
146 $ commit 29 "regular commit" 0
146 $ commit 29 "regular commit" 0
147 $ commit 30 "expand" 28 29
147 $ commit 30 "expand" 28 29
148 $ commit 31 "expand" 21 30
148 $ commit 31 "expand" 21 30
149 $ commit 32 "expand" 27 31
149 $ commit 32 "expand" 27 31
150 $ commit 33 "head" 18
150 $ commit 33 "head" 18
151 $ commit 34 "head" 32
151 $ commit 34 "head" 32
152
152
153
153
154 $ hg log -G -q
154 $ hg log -G -q
155 @ 34:fea3ac5810e0
155 @ 34:fea3ac5810e0
156 |
156 |
157 | o 33:68608f5145f9
157 | o 33:68608f5145f9
158 | |
158 | |
159 o | 32:d06dffa21a31
159 o | 32:d06dffa21a31
160 |\ \
160 |\ \
161 | o \ 31:621d83e11f67
161 | o \ 31:621d83e11f67
162 | |\ \
162 | |\ \
163 | | o \ 30:6e11cd4b648f
163 | | o \ 30:6e11cd4b648f
164 | | |\ \
164 | | |\ \
165 | | | o | 29:cd9bb2be7593
165 | | | o | 29:cd9bb2be7593
166 | | | | |
166 | | | | |
167 | | o | | 28:44ecd0b9ae99
167 | | o | | 28:44ecd0b9ae99
168 | | |\ \ \
168 | | |\ \ \
169 o | | | | | 27:886ed638191b
169 o | | | | | 27:886ed638191b
170 |/ / / / /
170 |/ / / / /
171 | | o---+ 26:7f25b6c2f0b9
171 | | o---+ 26:7f25b6c2f0b9
172 | | | | |
172 | | | | |
173 +---o | | 25:91da8ed57247
173 +---o | | 25:91da8ed57247
174 | | | | |
174 | | | | |
175 | | o | | 24:a9c19a3d96b7
175 | | o | | 24:a9c19a3d96b7
176 | | |\| |
176 | | |\| |
177 | | o | | 23:a01cddf0766d
177 | | o | | 23:a01cddf0766d
178 | |/| | |
178 | |/| | |
179 +---o---+ 22:e0d9cccacb5d
179 +---o---+ 22:e0d9cccacb5d
180 | | / /
180 | | / /
181 o | | | 21:d42a756af44d
181 o | | | 21:d42a756af44d
182 |\ \ \ \
182 |\ \ \ \
183 | o---+-+ 20:d30ed6450e32
183 | o---+-+ 20:d30ed6450e32
184 | / / /
184 | / / /
185 o | | | 19:31ddc2c1573b
185 o | | | 19:31ddc2c1573b
186 |\ \ \ \
186 |\ \ \ \
187 +---+---o 18:1aa84d96232a
187 +---+---o 18:1aa84d96232a
188 | | | |
188 | | | |
189 | o | | 17:44765d7c06e0
189 | o | | 17:44765d7c06e0
190 | |\ \ \
190 | |\ \ \
191 | | o---+ 16:3677d192927d
191 | | o---+ 16:3677d192927d
192 | | |/ /
192 | | |/ /
193 o | | | 15:1dda3f72782d
193 o | | | 15:1dda3f72782d
194 |\ \ \ \
194 |\ \ \ \
195 | o-----+ 14:8eac370358ef
195 | o-----+ 14:8eac370358ef
196 | |/ / /
196 | |/ / /
197 o | | | 13:22d8966a97e3
197 o | | | 13:22d8966a97e3
198 |\ \ \ \
198 |\ \ \ \
199 +---o | | 12:86b91144a6e9
199 +---o | | 12:86b91144a6e9
200 | | |/ /
200 | | |/ /
201 | o | | 11:832d76e6bdf2
201 | o | | 11:832d76e6bdf2
202 | |\ \ \
202 | |\ \ \
203 | | o---+ 10:74c64d036d72
203 | | o---+ 10:74c64d036d72
204 | |/ / /
204 | |/ / /
205 o | | | 9:7010c0af0a35
205 o | | | 9:7010c0af0a35
206 |\ \ \ \
206 |\ \ \ \
207 | o-----+ 8:7a0b11f71937
207 | o-----+ 8:7a0b11f71937
208 |/ / / /
208 |/ / / /
209 o | | | 7:b632bb1b1224
209 o | | | 7:b632bb1b1224
210 |\ \ \ \
210 |\ \ \ \
211 +---o | | 6:b105a072e251
211 +---o | | 6:b105a072e251
212 | |/ / /
212 | |/ / /
213 | o | | 5:4409d547b708
213 | o | | 5:4409d547b708
214 | |\ \ \
214 | |\ \ \
215 | | o | | 4:26a8bac39d9f
215 | | o | | 4:26a8bac39d9f
216 | |/|/ /
216 | |/|/ /
217 | o / / 3:27eef8ed80b4
217 | o / / 3:27eef8ed80b4
218 |/ / /
218 |/ / /
219 o / / 2:3d9a33b8d1e1
219 o / / 2:3d9a33b8d1e1
220 |/ /
220 |/ /
221 o / 1:6db2ef61d156
221 o / 1:6db2ef61d156
222 |/
222 |/
223 o 0:e6eb3150255d
223 o 0:e6eb3150255d
224
224
225
225
226 $ hg log -G
226 $ hg log -G
227 @ changeset: 34:fea3ac5810e0
227 @ changeset: 34:fea3ac5810e0
228 | tag: tip
228 | tag: tip
229 | parent: 32:d06dffa21a31
229 | parent: 32:d06dffa21a31
230 | user: test
230 | user: test
231 | date: Thu Jan 01 00:00:34 1970 +0000
231 | date: Thu Jan 01 00:00:34 1970 +0000
232 | summary: (34) head
232 | summary: (34) head
233 |
233 |
234 | o changeset: 33:68608f5145f9
234 | o changeset: 33:68608f5145f9
235 | | parent: 18:1aa84d96232a
235 | | parent: 18:1aa84d96232a
236 | | user: test
236 | | user: test
237 | | date: Thu Jan 01 00:00:33 1970 +0000
237 | | date: Thu Jan 01 00:00:33 1970 +0000
238 | | summary: (33) head
238 | | summary: (33) head
239 | |
239 | |
240 o | changeset: 32:d06dffa21a31
240 o | changeset: 32:d06dffa21a31
241 |\ \ parent: 27:886ed638191b
241 |\ \ parent: 27:886ed638191b
242 | | | parent: 31:621d83e11f67
242 | | | parent: 31:621d83e11f67
243 | | | user: test
243 | | | user: test
244 | | | date: Thu Jan 01 00:00:32 1970 +0000
244 | | | date: Thu Jan 01 00:00:32 1970 +0000
245 | | | summary: (32) expand
245 | | | summary: (32) expand
246 | | |
246 | | |
247 | o | changeset: 31:621d83e11f67
247 | o | changeset: 31:621d83e11f67
248 | |\ \ parent: 21:d42a756af44d
248 | |\ \ parent: 21:d42a756af44d
249 | | | | parent: 30:6e11cd4b648f
249 | | | | parent: 30:6e11cd4b648f
250 | | | | user: test
250 | | | | user: test
251 | | | | date: Thu Jan 01 00:00:31 1970 +0000
251 | | | | date: Thu Jan 01 00:00:31 1970 +0000
252 | | | | summary: (31) expand
252 | | | | summary: (31) expand
253 | | | |
253 | | | |
254 | | o | changeset: 30:6e11cd4b648f
254 | | o | changeset: 30:6e11cd4b648f
255 | | |\ \ parent: 28:44ecd0b9ae99
255 | | |\ \ parent: 28:44ecd0b9ae99
256 | | | | | parent: 29:cd9bb2be7593
256 | | | | | parent: 29:cd9bb2be7593
257 | | | | | user: test
257 | | | | | user: test
258 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
258 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
259 | | | | | summary: (30) expand
259 | | | | | summary: (30) expand
260 | | | | |
260 | | | | |
261 | | | o | changeset: 29:cd9bb2be7593
261 | | | o | changeset: 29:cd9bb2be7593
262 | | | | | parent: 0:e6eb3150255d
262 | | | | | parent: 0:e6eb3150255d
263 | | | | | user: test
263 | | | | | user: test
264 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
264 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
265 | | | | | summary: (29) regular commit
265 | | | | | summary: (29) regular commit
266 | | | | |
266 | | | | |
267 | | o | | changeset: 28:44ecd0b9ae99
267 | | o | | changeset: 28:44ecd0b9ae99
268 | | |\ \ \ parent: 1:6db2ef61d156
268 | | |\ \ \ parent: 1:6db2ef61d156
269 | | | | | | parent: 26:7f25b6c2f0b9
269 | | | | | | parent: 26:7f25b6c2f0b9
270 | | | | | | user: test
270 | | | | | | user: test
271 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
271 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
272 | | | | | | summary: (28) merge zero known
272 | | | | | | summary: (28) merge zero known
273 | | | | | |
273 | | | | | |
274 o | | | | | changeset: 27:886ed638191b
274 o | | | | | changeset: 27:886ed638191b
275 |/ / / / / parent: 21:d42a756af44d
275 |/ / / / / parent: 21:d42a756af44d
276 | | | | | user: test
276 | | | | | user: test
277 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
277 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
278 | | | | | summary: (27) collapse
278 | | | | | summary: (27) collapse
279 | | | | |
279 | | | | |
280 | | o---+ changeset: 26:7f25b6c2f0b9
280 | | o---+ changeset: 26:7f25b6c2f0b9
281 | | | | | parent: 18:1aa84d96232a
281 | | | | | parent: 18:1aa84d96232a
282 | | | | | parent: 25:91da8ed57247
282 | | | | | parent: 25:91da8ed57247
283 | | | | | user: test
283 | | | | | user: test
284 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
284 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
285 | | | | | summary: (26) merge one known; far right
285 | | | | | summary: (26) merge one known; far right
286 | | | | |
286 | | | | |
287 +---o | | changeset: 25:91da8ed57247
287 +---o | | changeset: 25:91da8ed57247
288 | | | | | parent: 21:d42a756af44d
288 | | | | | parent: 21:d42a756af44d
289 | | | | | parent: 24:a9c19a3d96b7
289 | | | | | parent: 24:a9c19a3d96b7
290 | | | | | user: test
290 | | | | | user: test
291 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
291 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
292 | | | | | summary: (25) merge one known; far left
292 | | | | | summary: (25) merge one known; far left
293 | | | | |
293 | | | | |
294 | | o | | changeset: 24:a9c19a3d96b7
294 | | o | | changeset: 24:a9c19a3d96b7
295 | | |\| | parent: 0:e6eb3150255d
295 | | |\| | parent: 0:e6eb3150255d
296 | | | | | parent: 23:a01cddf0766d
296 | | | | | parent: 23:a01cddf0766d
297 | | | | | user: test
297 | | | | | user: test
298 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
298 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
299 | | | | | summary: (24) merge one known; immediate right
299 | | | | | summary: (24) merge one known; immediate right
300 | | | | |
300 | | | | |
301 | | o | | changeset: 23:a01cddf0766d
301 | | o | | changeset: 23:a01cddf0766d
302 | |/| | | parent: 1:6db2ef61d156
302 | |/| | | parent: 1:6db2ef61d156
303 | | | | | parent: 22:e0d9cccacb5d
303 | | | | | parent: 22:e0d9cccacb5d
304 | | | | | user: test
304 | | | | | user: test
305 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
305 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
306 | | | | | summary: (23) merge one known; immediate left
306 | | | | | summary: (23) merge one known; immediate left
307 | | | | |
307 | | | | |
308 +---o---+ changeset: 22:e0d9cccacb5d
308 +---o---+ changeset: 22:e0d9cccacb5d
309 | | | | parent: 18:1aa84d96232a
309 | | | | parent: 18:1aa84d96232a
310 | | / / parent: 21:d42a756af44d
310 | | / / parent: 21:d42a756af44d
311 | | | | user: test
311 | | | | user: test
312 | | | | date: Thu Jan 01 00:00:22 1970 +0000
312 | | | | date: Thu Jan 01 00:00:22 1970 +0000
313 | | | | summary: (22) merge two known; one far left, one far right
313 | | | | summary: (22) merge two known; one far left, one far right
314 | | | |
314 | | | |
315 o | | | changeset: 21:d42a756af44d
315 o | | | changeset: 21:d42a756af44d
316 |\ \ \ \ parent: 19:31ddc2c1573b
316 |\ \ \ \ parent: 19:31ddc2c1573b
317 | | | | | parent: 20:d30ed6450e32
317 | | | | | parent: 20:d30ed6450e32
318 | | | | | user: test
318 | | | | | user: test
319 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
319 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
320 | | | | | summary: (21) expand
320 | | | | | summary: (21) expand
321 | | | | |
321 | | | | |
322 | o---+-+ changeset: 20:d30ed6450e32
322 | o---+-+ changeset: 20:d30ed6450e32
323 | | | | parent: 0:e6eb3150255d
323 | | | | parent: 0:e6eb3150255d
324 | / / / parent: 18:1aa84d96232a
324 | / / / parent: 18:1aa84d96232a
325 | | | | user: test
325 | | | | user: test
326 | | | | date: Thu Jan 01 00:00:20 1970 +0000
326 | | | | date: Thu Jan 01 00:00:20 1970 +0000
327 | | | | summary: (20) merge two known; two far right
327 | | | | summary: (20) merge two known; two far right
328 | | | |
328 | | | |
329 o | | | changeset: 19:31ddc2c1573b
329 o | | | changeset: 19:31ddc2c1573b
330 |\ \ \ \ parent: 15:1dda3f72782d
330 |\ \ \ \ parent: 15:1dda3f72782d
331 | | | | | parent: 17:44765d7c06e0
331 | | | | | parent: 17:44765d7c06e0
332 | | | | | user: test
332 | | | | | user: test
333 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
333 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
334 | | | | | summary: (19) expand
334 | | | | | summary: (19) expand
335 | | | | |
335 | | | | |
336 +---+---o changeset: 18:1aa84d96232a
336 +---+---o changeset: 18:1aa84d96232a
337 | | | | parent: 1:6db2ef61d156
337 | | | | parent: 1:6db2ef61d156
338 | | | | parent: 15:1dda3f72782d
338 | | | | parent: 15:1dda3f72782d
339 | | | | user: test
339 | | | | user: test
340 | | | | date: Thu Jan 01 00:00:18 1970 +0000
340 | | | | date: Thu Jan 01 00:00:18 1970 +0000
341 | | | | summary: (18) merge two known; two far left
341 | | | | summary: (18) merge two known; two far left
342 | | | |
342 | | | |
343 | o | | changeset: 17:44765d7c06e0
343 | o | | changeset: 17:44765d7c06e0
344 | |\ \ \ parent: 12:86b91144a6e9
344 | |\ \ \ parent: 12:86b91144a6e9
345 | | | | | parent: 16:3677d192927d
345 | | | | | parent: 16:3677d192927d
346 | | | | | user: test
346 | | | | | user: test
347 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
347 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
348 | | | | | summary: (17) expand
348 | | | | | summary: (17) expand
349 | | | | |
349 | | | | |
350 | | o---+ changeset: 16:3677d192927d
350 | | o---+ changeset: 16:3677d192927d
351 | | | | | parent: 0:e6eb3150255d
351 | | | | | parent: 0:e6eb3150255d
352 | | |/ / parent: 1:6db2ef61d156
352 | | |/ / parent: 1:6db2ef61d156
353 | | | | user: test
353 | | | | user: test
354 | | | | date: Thu Jan 01 00:00:16 1970 +0000
354 | | | | date: Thu Jan 01 00:00:16 1970 +0000
355 | | | | summary: (16) merge two known; one immediate right, one near right
355 | | | | summary: (16) merge two known; one immediate right, one near right
356 | | | |
356 | | | |
357 o | | | changeset: 15:1dda3f72782d
357 o | | | changeset: 15:1dda3f72782d
358 |\ \ \ \ parent: 13:22d8966a97e3
358 |\ \ \ \ parent: 13:22d8966a97e3
359 | | | | | parent: 14:8eac370358ef
359 | | | | | parent: 14:8eac370358ef
360 | | | | | user: test
360 | | | | | user: test
361 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
361 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
362 | | | | | summary: (15) expand
362 | | | | | summary: (15) expand
363 | | | | |
363 | | | | |
364 | o-----+ changeset: 14:8eac370358ef
364 | o-----+ changeset: 14:8eac370358ef
365 | | | | | parent: 0:e6eb3150255d
365 | | | | | parent: 0:e6eb3150255d
366 | |/ / / parent: 12:86b91144a6e9
366 | |/ / / parent: 12:86b91144a6e9
367 | | | | user: test
367 | | | | user: test
368 | | | | date: Thu Jan 01 00:00:14 1970 +0000
368 | | | | date: Thu Jan 01 00:00:14 1970 +0000
369 | | | | summary: (14) merge two known; one immediate right, one far right
369 | | | | summary: (14) merge two known; one immediate right, one far right
370 | | | |
370 | | | |
371 o | | | changeset: 13:22d8966a97e3
371 o | | | changeset: 13:22d8966a97e3
372 |\ \ \ \ parent: 9:7010c0af0a35
372 |\ \ \ \ parent: 9:7010c0af0a35
373 | | | | | parent: 11:832d76e6bdf2
373 | | | | | parent: 11:832d76e6bdf2
374 | | | | | user: test
374 | | | | | user: test
375 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
375 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
376 | | | | | summary: (13) expand
376 | | | | | summary: (13) expand
377 | | | | |
377 | | | | |
378 +---o | | changeset: 12:86b91144a6e9
378 +---o | | changeset: 12:86b91144a6e9
379 | | |/ / parent: 1:6db2ef61d156
379 | | |/ / parent: 1:6db2ef61d156
380 | | | | parent: 9:7010c0af0a35
380 | | | | parent: 9:7010c0af0a35
381 | | | | user: test
381 | | | | user: test
382 | | | | date: Thu Jan 01 00:00:12 1970 +0000
382 | | | | date: Thu Jan 01 00:00:12 1970 +0000
383 | | | | summary: (12) merge two known; one immediate right, one far left
383 | | | | summary: (12) merge two known; one immediate right, one far left
384 | | | |
384 | | | |
385 | o | | changeset: 11:832d76e6bdf2
385 | o | | changeset: 11:832d76e6bdf2
386 | |\ \ \ parent: 6:b105a072e251
386 | |\ \ \ parent: 6:b105a072e251
387 | | | | | parent: 10:74c64d036d72
387 | | | | | parent: 10:74c64d036d72
388 | | | | | user: test
388 | | | | | user: test
389 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
389 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
390 | | | | | summary: (11) expand
390 | | | | | summary: (11) expand
391 | | | | |
391 | | | | |
392 | | o---+ changeset: 10:74c64d036d72
392 | | o---+ changeset: 10:74c64d036d72
393 | | | | | parent: 0:e6eb3150255d
393 | | | | | parent: 0:e6eb3150255d
394 | |/ / / parent: 6:b105a072e251
394 | |/ / / parent: 6:b105a072e251
395 | | | | user: test
395 | | | | user: test
396 | | | | date: Thu Jan 01 00:00:10 1970 +0000
396 | | | | date: Thu Jan 01 00:00:10 1970 +0000
397 | | | | summary: (10) merge two known; one immediate left, one near right
397 | | | | summary: (10) merge two known; one immediate left, one near right
398 | | | |
398 | | | |
399 o | | | changeset: 9:7010c0af0a35
399 o | | | changeset: 9:7010c0af0a35
400 |\ \ \ \ parent: 7:b632bb1b1224
400 |\ \ \ \ parent: 7:b632bb1b1224
401 | | | | | parent: 8:7a0b11f71937
401 | | | | | parent: 8:7a0b11f71937
402 | | | | | user: test
402 | | | | | user: test
403 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
403 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
404 | | | | | summary: (9) expand
404 | | | | | summary: (9) expand
405 | | | | |
405 | | | | |
406 | o-----+ changeset: 8:7a0b11f71937
406 | o-----+ changeset: 8:7a0b11f71937
407 | | | | | parent: 0:e6eb3150255d
407 | | | | | parent: 0:e6eb3150255d
408 |/ / / / parent: 7:b632bb1b1224
408 |/ / / / parent: 7:b632bb1b1224
409 | | | | user: test
409 | | | | user: test
410 | | | | date: Thu Jan 01 00:00:08 1970 +0000
410 | | | | date: Thu Jan 01 00:00:08 1970 +0000
411 | | | | summary: (8) merge two known; one immediate left, one far right
411 | | | | summary: (8) merge two known; one immediate left, one far right
412 | | | |
412 | | | |
413 o | | | changeset: 7:b632bb1b1224
413 o | | | changeset: 7:b632bb1b1224
414 |\ \ \ \ parent: 2:3d9a33b8d1e1
414 |\ \ \ \ parent: 2:3d9a33b8d1e1
415 | | | | | parent: 5:4409d547b708
415 | | | | | parent: 5:4409d547b708
416 | | | | | user: test
416 | | | | | user: test
417 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
417 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
418 | | | | | summary: (7) expand
418 | | | | | summary: (7) expand
419 | | | | |
419 | | | | |
420 +---o | | changeset: 6:b105a072e251
420 +---o | | changeset: 6:b105a072e251
421 | |/ / / parent: 2:3d9a33b8d1e1
421 | |/ / / parent: 2:3d9a33b8d1e1
422 | | | | parent: 5:4409d547b708
422 | | | | parent: 5:4409d547b708
423 | | | | user: test
423 | | | | user: test
424 | | | | date: Thu Jan 01 00:00:06 1970 +0000
424 | | | | date: Thu Jan 01 00:00:06 1970 +0000
425 | | | | summary: (6) merge two known; one immediate left, one far left
425 | | | | summary: (6) merge two known; one immediate left, one far left
426 | | | |
426 | | | |
427 | o | | changeset: 5:4409d547b708
427 | o | | changeset: 5:4409d547b708
428 | |\ \ \ parent: 3:27eef8ed80b4
428 | |\ \ \ parent: 3:27eef8ed80b4
429 | | | | | parent: 4:26a8bac39d9f
429 | | | | | parent: 4:26a8bac39d9f
430 | | | | | user: test
430 | | | | | user: test
431 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
431 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
432 | | | | | summary: (5) expand
432 | | | | | summary: (5) expand
433 | | | | |
433 | | | | |
434 | | o | | changeset: 4:26a8bac39d9f
434 | | o | | changeset: 4:26a8bac39d9f
435 | |/|/ / parent: 1:6db2ef61d156
435 | |/|/ / parent: 1:6db2ef61d156
436 | | | | parent: 3:27eef8ed80b4
436 | | | | parent: 3:27eef8ed80b4
437 | | | | user: test
437 | | | | user: test
438 | | | | date: Thu Jan 01 00:00:04 1970 +0000
438 | | | | date: Thu Jan 01 00:00:04 1970 +0000
439 | | | | summary: (4) merge two known; one immediate left, one immediate right
439 | | | | summary: (4) merge two known; one immediate left, one immediate right
440 | | | |
440 | | | |
441 | o | | changeset: 3:27eef8ed80b4
441 | o | | changeset: 3:27eef8ed80b4
442 |/ / / user: test
442 |/ / / user: test
443 | | | date: Thu Jan 01 00:00:03 1970 +0000
443 | | | date: Thu Jan 01 00:00:03 1970 +0000
444 | | | summary: (3) collapse
444 | | | summary: (3) collapse
445 | | |
445 | | |
446 o | | changeset: 2:3d9a33b8d1e1
446 o | | changeset: 2:3d9a33b8d1e1
447 |/ / user: test
447 |/ / user: test
448 | | date: Thu Jan 01 00:00:02 1970 +0000
448 | | date: Thu Jan 01 00:00:02 1970 +0000
449 | | summary: (2) collapse
449 | | summary: (2) collapse
450 | |
450 | |
451 o | changeset: 1:6db2ef61d156
451 o | changeset: 1:6db2ef61d156
452 |/ user: test
452 |/ user: test
453 | date: Thu Jan 01 00:00:01 1970 +0000
453 | date: Thu Jan 01 00:00:01 1970 +0000
454 | summary: (1) collapse
454 | summary: (1) collapse
455 |
455 |
456 o changeset: 0:e6eb3150255d
456 o changeset: 0:e6eb3150255d
457 user: test
457 user: test
458 date: Thu Jan 01 00:00:00 1970 +0000
458 date: Thu Jan 01 00:00:00 1970 +0000
459 summary: (0) root
459 summary: (0) root
460
460
461
461
462 File glog:
462 File glog:
463 $ hg log -G a
463 $ hg log -G a
464 @ changeset: 34:fea3ac5810e0
464 @ changeset: 34:fea3ac5810e0
465 | tag: tip
465 | tag: tip
466 | parent: 32:d06dffa21a31
466 | parent: 32:d06dffa21a31
467 | user: test
467 | user: test
468 | date: Thu Jan 01 00:00:34 1970 +0000
468 | date: Thu Jan 01 00:00:34 1970 +0000
469 | summary: (34) head
469 | summary: (34) head
470 |
470 |
471 | o changeset: 33:68608f5145f9
471 | o changeset: 33:68608f5145f9
472 | | parent: 18:1aa84d96232a
472 | | parent: 18:1aa84d96232a
473 | | user: test
473 | | user: test
474 | | date: Thu Jan 01 00:00:33 1970 +0000
474 | | date: Thu Jan 01 00:00:33 1970 +0000
475 | | summary: (33) head
475 | | summary: (33) head
476 | |
476 | |
477 o | changeset: 32:d06dffa21a31
477 o | changeset: 32:d06dffa21a31
478 |\ \ parent: 27:886ed638191b
478 |\ \ parent: 27:886ed638191b
479 | | | parent: 31:621d83e11f67
479 | | | parent: 31:621d83e11f67
480 | | | user: test
480 | | | user: test
481 | | | date: Thu Jan 01 00:00:32 1970 +0000
481 | | | date: Thu Jan 01 00:00:32 1970 +0000
482 | | | summary: (32) expand
482 | | | summary: (32) expand
483 | | |
483 | | |
484 | o | changeset: 31:621d83e11f67
484 | o | changeset: 31:621d83e11f67
485 | |\ \ parent: 21:d42a756af44d
485 | |\ \ parent: 21:d42a756af44d
486 | | | | parent: 30:6e11cd4b648f
486 | | | | parent: 30:6e11cd4b648f
487 | | | | user: test
487 | | | | user: test
488 | | | | date: Thu Jan 01 00:00:31 1970 +0000
488 | | | | date: Thu Jan 01 00:00:31 1970 +0000
489 | | | | summary: (31) expand
489 | | | | summary: (31) expand
490 | | | |
490 | | | |
491 | | o | changeset: 30:6e11cd4b648f
491 | | o | changeset: 30:6e11cd4b648f
492 | | |\ \ parent: 28:44ecd0b9ae99
492 | | |\ \ parent: 28:44ecd0b9ae99
493 | | | | | parent: 29:cd9bb2be7593
493 | | | | | parent: 29:cd9bb2be7593
494 | | | | | user: test
494 | | | | | user: test
495 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
495 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
496 | | | | | summary: (30) expand
496 | | | | | summary: (30) expand
497 | | | | |
497 | | | | |
498 | | | o | changeset: 29:cd9bb2be7593
498 | | | o | changeset: 29:cd9bb2be7593
499 | | | | | parent: 0:e6eb3150255d
499 | | | | | parent: 0:e6eb3150255d
500 | | | | | user: test
500 | | | | | user: test
501 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
501 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
502 | | | | | summary: (29) regular commit
502 | | | | | summary: (29) regular commit
503 | | | | |
503 | | | | |
504 | | o | | changeset: 28:44ecd0b9ae99
504 | | o | | changeset: 28:44ecd0b9ae99
505 | | |\ \ \ parent: 1:6db2ef61d156
505 | | |\ \ \ parent: 1:6db2ef61d156
506 | | | | | | parent: 26:7f25b6c2f0b9
506 | | | | | | parent: 26:7f25b6c2f0b9
507 | | | | | | user: test
507 | | | | | | user: test
508 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
508 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
509 | | | | | | summary: (28) merge zero known
509 | | | | | | summary: (28) merge zero known
510 | | | | | |
510 | | | | | |
511 o | | | | | changeset: 27:886ed638191b
511 o | | | | | changeset: 27:886ed638191b
512 |/ / / / / parent: 21:d42a756af44d
512 |/ / / / / parent: 21:d42a756af44d
513 | | | | | user: test
513 | | | | | user: test
514 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
514 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
515 | | | | | summary: (27) collapse
515 | | | | | summary: (27) collapse
516 | | | | |
516 | | | | |
517 | | o---+ changeset: 26:7f25b6c2f0b9
517 | | o---+ changeset: 26:7f25b6c2f0b9
518 | | | | | parent: 18:1aa84d96232a
518 | | | | | parent: 18:1aa84d96232a
519 | | | | | parent: 25:91da8ed57247
519 | | | | | parent: 25:91da8ed57247
520 | | | | | user: test
520 | | | | | user: test
521 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
521 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
522 | | | | | summary: (26) merge one known; far right
522 | | | | | summary: (26) merge one known; far right
523 | | | | |
523 | | | | |
524 +---o | | changeset: 25:91da8ed57247
524 +---o | | changeset: 25:91da8ed57247
525 | | | | | parent: 21:d42a756af44d
525 | | | | | parent: 21:d42a756af44d
526 | | | | | parent: 24:a9c19a3d96b7
526 | | | | | parent: 24:a9c19a3d96b7
527 | | | | | user: test
527 | | | | | user: test
528 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
528 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
529 | | | | | summary: (25) merge one known; far left
529 | | | | | summary: (25) merge one known; far left
530 | | | | |
530 | | | | |
531 | | o | | changeset: 24:a9c19a3d96b7
531 | | o | | changeset: 24:a9c19a3d96b7
532 | | |\| | parent: 0:e6eb3150255d
532 | | |\| | parent: 0:e6eb3150255d
533 | | | | | parent: 23:a01cddf0766d
533 | | | | | parent: 23:a01cddf0766d
534 | | | | | user: test
534 | | | | | user: test
535 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
535 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
536 | | | | | summary: (24) merge one known; immediate right
536 | | | | | summary: (24) merge one known; immediate right
537 | | | | |
537 | | | | |
538 | | o | | changeset: 23:a01cddf0766d
538 | | o | | changeset: 23:a01cddf0766d
539 | |/| | | parent: 1:6db2ef61d156
539 | |/| | | parent: 1:6db2ef61d156
540 | | | | | parent: 22:e0d9cccacb5d
540 | | | | | parent: 22:e0d9cccacb5d
541 | | | | | user: test
541 | | | | | user: test
542 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
542 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
543 | | | | | summary: (23) merge one known; immediate left
543 | | | | | summary: (23) merge one known; immediate left
544 | | | | |
544 | | | | |
545 +---o---+ changeset: 22:e0d9cccacb5d
545 +---o---+ changeset: 22:e0d9cccacb5d
546 | | | | parent: 18:1aa84d96232a
546 | | | | parent: 18:1aa84d96232a
547 | | / / parent: 21:d42a756af44d
547 | | / / parent: 21:d42a756af44d
548 | | | | user: test
548 | | | | user: test
549 | | | | date: Thu Jan 01 00:00:22 1970 +0000
549 | | | | date: Thu Jan 01 00:00:22 1970 +0000
550 | | | | summary: (22) merge two known; one far left, one far right
550 | | | | summary: (22) merge two known; one far left, one far right
551 | | | |
551 | | | |
552 o | | | changeset: 21:d42a756af44d
552 o | | | changeset: 21:d42a756af44d
553 |\ \ \ \ parent: 19:31ddc2c1573b
553 |\ \ \ \ parent: 19:31ddc2c1573b
554 | | | | | parent: 20:d30ed6450e32
554 | | | | | parent: 20:d30ed6450e32
555 | | | | | user: test
555 | | | | | user: test
556 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
556 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
557 | | | | | summary: (21) expand
557 | | | | | summary: (21) expand
558 | | | | |
558 | | | | |
559 | o---+-+ changeset: 20:d30ed6450e32
559 | o---+-+ changeset: 20:d30ed6450e32
560 | | | | parent: 0:e6eb3150255d
560 | | | | parent: 0:e6eb3150255d
561 | / / / parent: 18:1aa84d96232a
561 | / / / parent: 18:1aa84d96232a
562 | | | | user: test
562 | | | | user: test
563 | | | | date: Thu Jan 01 00:00:20 1970 +0000
563 | | | | date: Thu Jan 01 00:00:20 1970 +0000
564 | | | | summary: (20) merge two known; two far right
564 | | | | summary: (20) merge two known; two far right
565 | | | |
565 | | | |
566 o | | | changeset: 19:31ddc2c1573b
566 o | | | changeset: 19:31ddc2c1573b
567 |\ \ \ \ parent: 15:1dda3f72782d
567 |\ \ \ \ parent: 15:1dda3f72782d
568 | | | | | parent: 17:44765d7c06e0
568 | | | | | parent: 17:44765d7c06e0
569 | | | | | user: test
569 | | | | | user: test
570 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
570 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
571 | | | | | summary: (19) expand
571 | | | | | summary: (19) expand
572 | | | | |
572 | | | | |
573 +---+---o changeset: 18:1aa84d96232a
573 +---+---o changeset: 18:1aa84d96232a
574 | | | | parent: 1:6db2ef61d156
574 | | | | parent: 1:6db2ef61d156
575 | | | | parent: 15:1dda3f72782d
575 | | | | parent: 15:1dda3f72782d
576 | | | | user: test
576 | | | | user: test
577 | | | | date: Thu Jan 01 00:00:18 1970 +0000
577 | | | | date: Thu Jan 01 00:00:18 1970 +0000
578 | | | | summary: (18) merge two known; two far left
578 | | | | summary: (18) merge two known; two far left
579 | | | |
579 | | | |
580 | o | | changeset: 17:44765d7c06e0
580 | o | | changeset: 17:44765d7c06e0
581 | |\ \ \ parent: 12:86b91144a6e9
581 | |\ \ \ parent: 12:86b91144a6e9
582 | | | | | parent: 16:3677d192927d
582 | | | | | parent: 16:3677d192927d
583 | | | | | user: test
583 | | | | | user: test
584 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
584 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
585 | | | | | summary: (17) expand
585 | | | | | summary: (17) expand
586 | | | | |
586 | | | | |
587 | | o---+ changeset: 16:3677d192927d
587 | | o---+ changeset: 16:3677d192927d
588 | | | | | parent: 0:e6eb3150255d
588 | | | | | parent: 0:e6eb3150255d
589 | | |/ / parent: 1:6db2ef61d156
589 | | |/ / parent: 1:6db2ef61d156
590 | | | | user: test
590 | | | | user: test
591 | | | | date: Thu Jan 01 00:00:16 1970 +0000
591 | | | | date: Thu Jan 01 00:00:16 1970 +0000
592 | | | | summary: (16) merge two known; one immediate right, one near right
592 | | | | summary: (16) merge two known; one immediate right, one near right
593 | | | |
593 | | | |
594 o | | | changeset: 15:1dda3f72782d
594 o | | | changeset: 15:1dda3f72782d
595 |\ \ \ \ parent: 13:22d8966a97e3
595 |\ \ \ \ parent: 13:22d8966a97e3
596 | | | | | parent: 14:8eac370358ef
596 | | | | | parent: 14:8eac370358ef
597 | | | | | user: test
597 | | | | | user: test
598 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
598 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
599 | | | | | summary: (15) expand
599 | | | | | summary: (15) expand
600 | | | | |
600 | | | | |
601 | o-----+ changeset: 14:8eac370358ef
601 | o-----+ changeset: 14:8eac370358ef
602 | | | | | parent: 0:e6eb3150255d
602 | | | | | parent: 0:e6eb3150255d
603 | |/ / / parent: 12:86b91144a6e9
603 | |/ / / parent: 12:86b91144a6e9
604 | | | | user: test
604 | | | | user: test
605 | | | | date: Thu Jan 01 00:00:14 1970 +0000
605 | | | | date: Thu Jan 01 00:00:14 1970 +0000
606 | | | | summary: (14) merge two known; one immediate right, one far right
606 | | | | summary: (14) merge two known; one immediate right, one far right
607 | | | |
607 | | | |
608 o | | | changeset: 13:22d8966a97e3
608 o | | | changeset: 13:22d8966a97e3
609 |\ \ \ \ parent: 9:7010c0af0a35
609 |\ \ \ \ parent: 9:7010c0af0a35
610 | | | | | parent: 11:832d76e6bdf2
610 | | | | | parent: 11:832d76e6bdf2
611 | | | | | user: test
611 | | | | | user: test
612 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
612 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
613 | | | | | summary: (13) expand
613 | | | | | summary: (13) expand
614 | | | | |
614 | | | | |
615 +---o | | changeset: 12:86b91144a6e9
615 +---o | | changeset: 12:86b91144a6e9
616 | | |/ / parent: 1:6db2ef61d156
616 | | |/ / parent: 1:6db2ef61d156
617 | | | | parent: 9:7010c0af0a35
617 | | | | parent: 9:7010c0af0a35
618 | | | | user: test
618 | | | | user: test
619 | | | | date: Thu Jan 01 00:00:12 1970 +0000
619 | | | | date: Thu Jan 01 00:00:12 1970 +0000
620 | | | | summary: (12) merge two known; one immediate right, one far left
620 | | | | summary: (12) merge two known; one immediate right, one far left
621 | | | |
621 | | | |
622 | o | | changeset: 11:832d76e6bdf2
622 | o | | changeset: 11:832d76e6bdf2
623 | |\ \ \ parent: 6:b105a072e251
623 | |\ \ \ parent: 6:b105a072e251
624 | | | | | parent: 10:74c64d036d72
624 | | | | | parent: 10:74c64d036d72
625 | | | | | user: test
625 | | | | | user: test
626 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
626 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
627 | | | | | summary: (11) expand
627 | | | | | summary: (11) expand
628 | | | | |
628 | | | | |
629 | | o---+ changeset: 10:74c64d036d72
629 | | o---+ changeset: 10:74c64d036d72
630 | | | | | parent: 0:e6eb3150255d
630 | | | | | parent: 0:e6eb3150255d
631 | |/ / / parent: 6:b105a072e251
631 | |/ / / parent: 6:b105a072e251
632 | | | | user: test
632 | | | | user: test
633 | | | | date: Thu Jan 01 00:00:10 1970 +0000
633 | | | | date: Thu Jan 01 00:00:10 1970 +0000
634 | | | | summary: (10) merge two known; one immediate left, one near right
634 | | | | summary: (10) merge two known; one immediate left, one near right
635 | | | |
635 | | | |
636 o | | | changeset: 9:7010c0af0a35
636 o | | | changeset: 9:7010c0af0a35
637 |\ \ \ \ parent: 7:b632bb1b1224
637 |\ \ \ \ parent: 7:b632bb1b1224
638 | | | | | parent: 8:7a0b11f71937
638 | | | | | parent: 8:7a0b11f71937
639 | | | | | user: test
639 | | | | | user: test
640 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
640 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
641 | | | | | summary: (9) expand
641 | | | | | summary: (9) expand
642 | | | | |
642 | | | | |
643 | o-----+ changeset: 8:7a0b11f71937
643 | o-----+ changeset: 8:7a0b11f71937
644 | | | | | parent: 0:e6eb3150255d
644 | | | | | parent: 0:e6eb3150255d
645 |/ / / / parent: 7:b632bb1b1224
645 |/ / / / parent: 7:b632bb1b1224
646 | | | | user: test
646 | | | | user: test
647 | | | | date: Thu Jan 01 00:00:08 1970 +0000
647 | | | | date: Thu Jan 01 00:00:08 1970 +0000
648 | | | | summary: (8) merge two known; one immediate left, one far right
648 | | | | summary: (8) merge two known; one immediate left, one far right
649 | | | |
649 | | | |
650 o | | | changeset: 7:b632bb1b1224
650 o | | | changeset: 7:b632bb1b1224
651 |\ \ \ \ parent: 2:3d9a33b8d1e1
651 |\ \ \ \ parent: 2:3d9a33b8d1e1
652 | | | | | parent: 5:4409d547b708
652 | | | | | parent: 5:4409d547b708
653 | | | | | user: test
653 | | | | | user: test
654 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
654 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
655 | | | | | summary: (7) expand
655 | | | | | summary: (7) expand
656 | | | | |
656 | | | | |
657 +---o | | changeset: 6:b105a072e251
657 +---o | | changeset: 6:b105a072e251
658 | |/ / / parent: 2:3d9a33b8d1e1
658 | |/ / / parent: 2:3d9a33b8d1e1
659 | | | | parent: 5:4409d547b708
659 | | | | parent: 5:4409d547b708
660 | | | | user: test
660 | | | | user: test
661 | | | | date: Thu Jan 01 00:00:06 1970 +0000
661 | | | | date: Thu Jan 01 00:00:06 1970 +0000
662 | | | | summary: (6) merge two known; one immediate left, one far left
662 | | | | summary: (6) merge two known; one immediate left, one far left
663 | | | |
663 | | | |
664 | o | | changeset: 5:4409d547b708
664 | o | | changeset: 5:4409d547b708
665 | |\ \ \ parent: 3:27eef8ed80b4
665 | |\ \ \ parent: 3:27eef8ed80b4
666 | | | | | parent: 4:26a8bac39d9f
666 | | | | | parent: 4:26a8bac39d9f
667 | | | | | user: test
667 | | | | | user: test
668 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
668 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
669 | | | | | summary: (5) expand
669 | | | | | summary: (5) expand
670 | | | | |
670 | | | | |
671 | | o | | changeset: 4:26a8bac39d9f
671 | | o | | changeset: 4:26a8bac39d9f
672 | |/|/ / parent: 1:6db2ef61d156
672 | |/|/ / parent: 1:6db2ef61d156
673 | | | | parent: 3:27eef8ed80b4
673 | | | | parent: 3:27eef8ed80b4
674 | | | | user: test
674 | | | | user: test
675 | | | | date: Thu Jan 01 00:00:04 1970 +0000
675 | | | | date: Thu Jan 01 00:00:04 1970 +0000
676 | | | | summary: (4) merge two known; one immediate left, one immediate right
676 | | | | summary: (4) merge two known; one immediate left, one immediate right
677 | | | |
677 | | | |
678 | o | | changeset: 3:27eef8ed80b4
678 | o | | changeset: 3:27eef8ed80b4
679 |/ / / user: test
679 |/ / / user: test
680 | | | date: Thu Jan 01 00:00:03 1970 +0000
680 | | | date: Thu Jan 01 00:00:03 1970 +0000
681 | | | summary: (3) collapse
681 | | | summary: (3) collapse
682 | | |
682 | | |
683 o | | changeset: 2:3d9a33b8d1e1
683 o | | changeset: 2:3d9a33b8d1e1
684 |/ / user: test
684 |/ / user: test
685 | | date: Thu Jan 01 00:00:02 1970 +0000
685 | | date: Thu Jan 01 00:00:02 1970 +0000
686 | | summary: (2) collapse
686 | | summary: (2) collapse
687 | |
687 | |
688 o | changeset: 1:6db2ef61d156
688 o | changeset: 1:6db2ef61d156
689 |/ user: test
689 |/ user: test
690 | date: Thu Jan 01 00:00:01 1970 +0000
690 | date: Thu Jan 01 00:00:01 1970 +0000
691 | summary: (1) collapse
691 | summary: (1) collapse
692 |
692 |
693 o changeset: 0:e6eb3150255d
693 o changeset: 0:e6eb3150255d
694 user: test
694 user: test
695 date: Thu Jan 01 00:00:00 1970 +0000
695 date: Thu Jan 01 00:00:00 1970 +0000
696 summary: (0) root
696 summary: (0) root
697
697
698
698
699 File glog per revset:
699 File glog per revset:
700
700
701 $ hg log -G -r 'file("a")'
701 $ hg log -G -r 'file("a")'
702 @ changeset: 34:fea3ac5810e0
702 @ changeset: 34:fea3ac5810e0
703 | tag: tip
703 | tag: tip
704 | parent: 32:d06dffa21a31
704 | parent: 32:d06dffa21a31
705 | user: test
705 | user: test
706 | date: Thu Jan 01 00:00:34 1970 +0000
706 | date: Thu Jan 01 00:00:34 1970 +0000
707 | summary: (34) head
707 | summary: (34) head
708 |
708 |
709 | o changeset: 33:68608f5145f9
709 | o changeset: 33:68608f5145f9
710 | | parent: 18:1aa84d96232a
710 | | parent: 18:1aa84d96232a
711 | | user: test
711 | | user: test
712 | | date: Thu Jan 01 00:00:33 1970 +0000
712 | | date: Thu Jan 01 00:00:33 1970 +0000
713 | | summary: (33) head
713 | | summary: (33) head
714 | |
714 | |
715 o | changeset: 32:d06dffa21a31
715 o | changeset: 32:d06dffa21a31
716 |\ \ parent: 27:886ed638191b
716 |\ \ parent: 27:886ed638191b
717 | | | parent: 31:621d83e11f67
717 | | | parent: 31:621d83e11f67
718 | | | user: test
718 | | | user: test
719 | | | date: Thu Jan 01 00:00:32 1970 +0000
719 | | | date: Thu Jan 01 00:00:32 1970 +0000
720 | | | summary: (32) expand
720 | | | summary: (32) expand
721 | | |
721 | | |
722 | o | changeset: 31:621d83e11f67
722 | o | changeset: 31:621d83e11f67
723 | |\ \ parent: 21:d42a756af44d
723 | |\ \ parent: 21:d42a756af44d
724 | | | | parent: 30:6e11cd4b648f
724 | | | | parent: 30:6e11cd4b648f
725 | | | | user: test
725 | | | | user: test
726 | | | | date: Thu Jan 01 00:00:31 1970 +0000
726 | | | | date: Thu Jan 01 00:00:31 1970 +0000
727 | | | | summary: (31) expand
727 | | | | summary: (31) expand
728 | | | |
728 | | | |
729 | | o | changeset: 30:6e11cd4b648f
729 | | o | changeset: 30:6e11cd4b648f
730 | | |\ \ parent: 28:44ecd0b9ae99
730 | | |\ \ parent: 28:44ecd0b9ae99
731 | | | | | parent: 29:cd9bb2be7593
731 | | | | | parent: 29:cd9bb2be7593
732 | | | | | user: test
732 | | | | | user: test
733 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
733 | | | | | date: Thu Jan 01 00:00:30 1970 +0000
734 | | | | | summary: (30) expand
734 | | | | | summary: (30) expand
735 | | | | |
735 | | | | |
736 | | | o | changeset: 29:cd9bb2be7593
736 | | | o | changeset: 29:cd9bb2be7593
737 | | | | | parent: 0:e6eb3150255d
737 | | | | | parent: 0:e6eb3150255d
738 | | | | | user: test
738 | | | | | user: test
739 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
739 | | | | | date: Thu Jan 01 00:00:29 1970 +0000
740 | | | | | summary: (29) regular commit
740 | | | | | summary: (29) regular commit
741 | | | | |
741 | | | | |
742 | | o | | changeset: 28:44ecd0b9ae99
742 | | o | | changeset: 28:44ecd0b9ae99
743 | | |\ \ \ parent: 1:6db2ef61d156
743 | | |\ \ \ parent: 1:6db2ef61d156
744 | | | | | | parent: 26:7f25b6c2f0b9
744 | | | | | | parent: 26:7f25b6c2f0b9
745 | | | | | | user: test
745 | | | | | | user: test
746 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
746 | | | | | | date: Thu Jan 01 00:00:28 1970 +0000
747 | | | | | | summary: (28) merge zero known
747 | | | | | | summary: (28) merge zero known
748 | | | | | |
748 | | | | | |
749 o | | | | | changeset: 27:886ed638191b
749 o | | | | | changeset: 27:886ed638191b
750 |/ / / / / parent: 21:d42a756af44d
750 |/ / / / / parent: 21:d42a756af44d
751 | | | | | user: test
751 | | | | | user: test
752 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
752 | | | | | date: Thu Jan 01 00:00:27 1970 +0000
753 | | | | | summary: (27) collapse
753 | | | | | summary: (27) collapse
754 | | | | |
754 | | | | |
755 | | o---+ changeset: 26:7f25b6c2f0b9
755 | | o---+ changeset: 26:7f25b6c2f0b9
756 | | | | | parent: 18:1aa84d96232a
756 | | | | | parent: 18:1aa84d96232a
757 | | | | | parent: 25:91da8ed57247
757 | | | | | parent: 25:91da8ed57247
758 | | | | | user: test
758 | | | | | user: test
759 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
759 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
760 | | | | | summary: (26) merge one known; far right
760 | | | | | summary: (26) merge one known; far right
761 | | | | |
761 | | | | |
762 +---o | | changeset: 25:91da8ed57247
762 +---o | | changeset: 25:91da8ed57247
763 | | | | | parent: 21:d42a756af44d
763 | | | | | parent: 21:d42a756af44d
764 | | | | | parent: 24:a9c19a3d96b7
764 | | | | | parent: 24:a9c19a3d96b7
765 | | | | | user: test
765 | | | | | user: test
766 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
766 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
767 | | | | | summary: (25) merge one known; far left
767 | | | | | summary: (25) merge one known; far left
768 | | | | |
768 | | | | |
769 | | o | | changeset: 24:a9c19a3d96b7
769 | | o | | changeset: 24:a9c19a3d96b7
770 | | |\| | parent: 0:e6eb3150255d
770 | | |\| | parent: 0:e6eb3150255d
771 | | | | | parent: 23:a01cddf0766d
771 | | | | | parent: 23:a01cddf0766d
772 | | | | | user: test
772 | | | | | user: test
773 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
773 | | | | | date: Thu Jan 01 00:00:24 1970 +0000
774 | | | | | summary: (24) merge one known; immediate right
774 | | | | | summary: (24) merge one known; immediate right
775 | | | | |
775 | | | | |
776 | | o | | changeset: 23:a01cddf0766d
776 | | o | | changeset: 23:a01cddf0766d
777 | |/| | | parent: 1:6db2ef61d156
777 | |/| | | parent: 1:6db2ef61d156
778 | | | | | parent: 22:e0d9cccacb5d
778 | | | | | parent: 22:e0d9cccacb5d
779 | | | | | user: test
779 | | | | | user: test
780 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
780 | | | | | date: Thu Jan 01 00:00:23 1970 +0000
781 | | | | | summary: (23) merge one known; immediate left
781 | | | | | summary: (23) merge one known; immediate left
782 | | | | |
782 | | | | |
783 +---o---+ changeset: 22:e0d9cccacb5d
783 +---o---+ changeset: 22:e0d9cccacb5d
784 | | | | parent: 18:1aa84d96232a
784 | | | | parent: 18:1aa84d96232a
785 | | / / parent: 21:d42a756af44d
785 | | / / parent: 21:d42a756af44d
786 | | | | user: test
786 | | | | user: test
787 | | | | date: Thu Jan 01 00:00:22 1970 +0000
787 | | | | date: Thu Jan 01 00:00:22 1970 +0000
788 | | | | summary: (22) merge two known; one far left, one far right
788 | | | | summary: (22) merge two known; one far left, one far right
789 | | | |
789 | | | |
790 o | | | changeset: 21:d42a756af44d
790 o | | | changeset: 21:d42a756af44d
791 |\ \ \ \ parent: 19:31ddc2c1573b
791 |\ \ \ \ parent: 19:31ddc2c1573b
792 | | | | | parent: 20:d30ed6450e32
792 | | | | | parent: 20:d30ed6450e32
793 | | | | | user: test
793 | | | | | user: test
794 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
794 | | | | | date: Thu Jan 01 00:00:21 1970 +0000
795 | | | | | summary: (21) expand
795 | | | | | summary: (21) expand
796 | | | | |
796 | | | | |
797 | o---+-+ changeset: 20:d30ed6450e32
797 | o---+-+ changeset: 20:d30ed6450e32
798 | | | | parent: 0:e6eb3150255d
798 | | | | parent: 0:e6eb3150255d
799 | / / / parent: 18:1aa84d96232a
799 | / / / parent: 18:1aa84d96232a
800 | | | | user: test
800 | | | | user: test
801 | | | | date: Thu Jan 01 00:00:20 1970 +0000
801 | | | | date: Thu Jan 01 00:00:20 1970 +0000
802 | | | | summary: (20) merge two known; two far right
802 | | | | summary: (20) merge two known; two far right
803 | | | |
803 | | | |
804 o | | | changeset: 19:31ddc2c1573b
804 o | | | changeset: 19:31ddc2c1573b
805 |\ \ \ \ parent: 15:1dda3f72782d
805 |\ \ \ \ parent: 15:1dda3f72782d
806 | | | | | parent: 17:44765d7c06e0
806 | | | | | parent: 17:44765d7c06e0
807 | | | | | user: test
807 | | | | | user: test
808 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
808 | | | | | date: Thu Jan 01 00:00:19 1970 +0000
809 | | | | | summary: (19) expand
809 | | | | | summary: (19) expand
810 | | | | |
810 | | | | |
811 +---+---o changeset: 18:1aa84d96232a
811 +---+---o changeset: 18:1aa84d96232a
812 | | | | parent: 1:6db2ef61d156
812 | | | | parent: 1:6db2ef61d156
813 | | | | parent: 15:1dda3f72782d
813 | | | | parent: 15:1dda3f72782d
814 | | | | user: test
814 | | | | user: test
815 | | | | date: Thu Jan 01 00:00:18 1970 +0000
815 | | | | date: Thu Jan 01 00:00:18 1970 +0000
816 | | | | summary: (18) merge two known; two far left
816 | | | | summary: (18) merge two known; two far left
817 | | | |
817 | | | |
818 | o | | changeset: 17:44765d7c06e0
818 | o | | changeset: 17:44765d7c06e0
819 | |\ \ \ parent: 12:86b91144a6e9
819 | |\ \ \ parent: 12:86b91144a6e9
820 | | | | | parent: 16:3677d192927d
820 | | | | | parent: 16:3677d192927d
821 | | | | | user: test
821 | | | | | user: test
822 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
822 | | | | | date: Thu Jan 01 00:00:17 1970 +0000
823 | | | | | summary: (17) expand
823 | | | | | summary: (17) expand
824 | | | | |
824 | | | | |
825 | | o---+ changeset: 16:3677d192927d
825 | | o---+ changeset: 16:3677d192927d
826 | | | | | parent: 0:e6eb3150255d
826 | | | | | parent: 0:e6eb3150255d
827 | | |/ / parent: 1:6db2ef61d156
827 | | |/ / parent: 1:6db2ef61d156
828 | | | | user: test
828 | | | | user: test
829 | | | | date: Thu Jan 01 00:00:16 1970 +0000
829 | | | | date: Thu Jan 01 00:00:16 1970 +0000
830 | | | | summary: (16) merge two known; one immediate right, one near right
830 | | | | summary: (16) merge two known; one immediate right, one near right
831 | | | |
831 | | | |
832 o | | | changeset: 15:1dda3f72782d
832 o | | | changeset: 15:1dda3f72782d
833 |\ \ \ \ parent: 13:22d8966a97e3
833 |\ \ \ \ parent: 13:22d8966a97e3
834 | | | | | parent: 14:8eac370358ef
834 | | | | | parent: 14:8eac370358ef
835 | | | | | user: test
835 | | | | | user: test
836 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
836 | | | | | date: Thu Jan 01 00:00:15 1970 +0000
837 | | | | | summary: (15) expand
837 | | | | | summary: (15) expand
838 | | | | |
838 | | | | |
839 | o-----+ changeset: 14:8eac370358ef
839 | o-----+ changeset: 14:8eac370358ef
840 | | | | | parent: 0:e6eb3150255d
840 | | | | | parent: 0:e6eb3150255d
841 | |/ / / parent: 12:86b91144a6e9
841 | |/ / / parent: 12:86b91144a6e9
842 | | | | user: test
842 | | | | user: test
843 | | | | date: Thu Jan 01 00:00:14 1970 +0000
843 | | | | date: Thu Jan 01 00:00:14 1970 +0000
844 | | | | summary: (14) merge two known; one immediate right, one far right
844 | | | | summary: (14) merge two known; one immediate right, one far right
845 | | | |
845 | | | |
846 o | | | changeset: 13:22d8966a97e3
846 o | | | changeset: 13:22d8966a97e3
847 |\ \ \ \ parent: 9:7010c0af0a35
847 |\ \ \ \ parent: 9:7010c0af0a35
848 | | | | | parent: 11:832d76e6bdf2
848 | | | | | parent: 11:832d76e6bdf2
849 | | | | | user: test
849 | | | | | user: test
850 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
850 | | | | | date: Thu Jan 01 00:00:13 1970 +0000
851 | | | | | summary: (13) expand
851 | | | | | summary: (13) expand
852 | | | | |
852 | | | | |
853 +---o | | changeset: 12:86b91144a6e9
853 +---o | | changeset: 12:86b91144a6e9
854 | | |/ / parent: 1:6db2ef61d156
854 | | |/ / parent: 1:6db2ef61d156
855 | | | | parent: 9:7010c0af0a35
855 | | | | parent: 9:7010c0af0a35
856 | | | | user: test
856 | | | | user: test
857 | | | | date: Thu Jan 01 00:00:12 1970 +0000
857 | | | | date: Thu Jan 01 00:00:12 1970 +0000
858 | | | | summary: (12) merge two known; one immediate right, one far left
858 | | | | summary: (12) merge two known; one immediate right, one far left
859 | | | |
859 | | | |
860 | o | | changeset: 11:832d76e6bdf2
860 | o | | changeset: 11:832d76e6bdf2
861 | |\ \ \ parent: 6:b105a072e251
861 | |\ \ \ parent: 6:b105a072e251
862 | | | | | parent: 10:74c64d036d72
862 | | | | | parent: 10:74c64d036d72
863 | | | | | user: test
863 | | | | | user: test
864 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
864 | | | | | date: Thu Jan 01 00:00:11 1970 +0000
865 | | | | | summary: (11) expand
865 | | | | | summary: (11) expand
866 | | | | |
866 | | | | |
867 | | o---+ changeset: 10:74c64d036d72
867 | | o---+ changeset: 10:74c64d036d72
868 | | | | | parent: 0:e6eb3150255d
868 | | | | | parent: 0:e6eb3150255d
869 | |/ / / parent: 6:b105a072e251
869 | |/ / / parent: 6:b105a072e251
870 | | | | user: test
870 | | | | user: test
871 | | | | date: Thu Jan 01 00:00:10 1970 +0000
871 | | | | date: Thu Jan 01 00:00:10 1970 +0000
872 | | | | summary: (10) merge two known; one immediate left, one near right
872 | | | | summary: (10) merge two known; one immediate left, one near right
873 | | | |
873 | | | |
874 o | | | changeset: 9:7010c0af0a35
874 o | | | changeset: 9:7010c0af0a35
875 |\ \ \ \ parent: 7:b632bb1b1224
875 |\ \ \ \ parent: 7:b632bb1b1224
876 | | | | | parent: 8:7a0b11f71937
876 | | | | | parent: 8:7a0b11f71937
877 | | | | | user: test
877 | | | | | user: test
878 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
878 | | | | | date: Thu Jan 01 00:00:09 1970 +0000
879 | | | | | summary: (9) expand
879 | | | | | summary: (9) expand
880 | | | | |
880 | | | | |
881 | o-----+ changeset: 8:7a0b11f71937
881 | o-----+ changeset: 8:7a0b11f71937
882 | | | | | parent: 0:e6eb3150255d
882 | | | | | parent: 0:e6eb3150255d
883 |/ / / / parent: 7:b632bb1b1224
883 |/ / / / parent: 7:b632bb1b1224
884 | | | | user: test
884 | | | | user: test
885 | | | | date: Thu Jan 01 00:00:08 1970 +0000
885 | | | | date: Thu Jan 01 00:00:08 1970 +0000
886 | | | | summary: (8) merge two known; one immediate left, one far right
886 | | | | summary: (8) merge two known; one immediate left, one far right
887 | | | |
887 | | | |
888 o | | | changeset: 7:b632bb1b1224
888 o | | | changeset: 7:b632bb1b1224
889 |\ \ \ \ parent: 2:3d9a33b8d1e1
889 |\ \ \ \ parent: 2:3d9a33b8d1e1
890 | | | | | parent: 5:4409d547b708
890 | | | | | parent: 5:4409d547b708
891 | | | | | user: test
891 | | | | | user: test
892 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
892 | | | | | date: Thu Jan 01 00:00:07 1970 +0000
893 | | | | | summary: (7) expand
893 | | | | | summary: (7) expand
894 | | | | |
894 | | | | |
895 +---o | | changeset: 6:b105a072e251
895 +---o | | changeset: 6:b105a072e251
896 | |/ / / parent: 2:3d9a33b8d1e1
896 | |/ / / parent: 2:3d9a33b8d1e1
897 | | | | parent: 5:4409d547b708
897 | | | | parent: 5:4409d547b708
898 | | | | user: test
898 | | | | user: test
899 | | | | date: Thu Jan 01 00:00:06 1970 +0000
899 | | | | date: Thu Jan 01 00:00:06 1970 +0000
900 | | | | summary: (6) merge two known; one immediate left, one far left
900 | | | | summary: (6) merge two known; one immediate left, one far left
901 | | | |
901 | | | |
902 | o | | changeset: 5:4409d547b708
902 | o | | changeset: 5:4409d547b708
903 | |\ \ \ parent: 3:27eef8ed80b4
903 | |\ \ \ parent: 3:27eef8ed80b4
904 | | | | | parent: 4:26a8bac39d9f
904 | | | | | parent: 4:26a8bac39d9f
905 | | | | | user: test
905 | | | | | user: test
906 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
906 | | | | | date: Thu Jan 01 00:00:05 1970 +0000
907 | | | | | summary: (5) expand
907 | | | | | summary: (5) expand
908 | | | | |
908 | | | | |
909 | | o | | changeset: 4:26a8bac39d9f
909 | | o | | changeset: 4:26a8bac39d9f
910 | |/|/ / parent: 1:6db2ef61d156
910 | |/|/ / parent: 1:6db2ef61d156
911 | | | | parent: 3:27eef8ed80b4
911 | | | | parent: 3:27eef8ed80b4
912 | | | | user: test
912 | | | | user: test
913 | | | | date: Thu Jan 01 00:00:04 1970 +0000
913 | | | | date: Thu Jan 01 00:00:04 1970 +0000
914 | | | | summary: (4) merge two known; one immediate left, one immediate right
914 | | | | summary: (4) merge two known; one immediate left, one immediate right
915 | | | |
915 | | | |
916 | o | | changeset: 3:27eef8ed80b4
916 | o | | changeset: 3:27eef8ed80b4
917 |/ / / user: test
917 |/ / / user: test
918 | | | date: Thu Jan 01 00:00:03 1970 +0000
918 | | | date: Thu Jan 01 00:00:03 1970 +0000
919 | | | summary: (3) collapse
919 | | | summary: (3) collapse
920 | | |
920 | | |
921 o | | changeset: 2:3d9a33b8d1e1
921 o | | changeset: 2:3d9a33b8d1e1
922 |/ / user: test
922 |/ / user: test
923 | | date: Thu Jan 01 00:00:02 1970 +0000
923 | | date: Thu Jan 01 00:00:02 1970 +0000
924 | | summary: (2) collapse
924 | | summary: (2) collapse
925 | |
925 | |
926 o | changeset: 1:6db2ef61d156
926 o | changeset: 1:6db2ef61d156
927 |/ user: test
927 |/ user: test
928 | date: Thu Jan 01 00:00:01 1970 +0000
928 | date: Thu Jan 01 00:00:01 1970 +0000
929 | summary: (1) collapse
929 | summary: (1) collapse
930 |
930 |
931 o changeset: 0:e6eb3150255d
931 o changeset: 0:e6eb3150255d
932 user: test
932 user: test
933 date: Thu Jan 01 00:00:00 1970 +0000
933 date: Thu Jan 01 00:00:00 1970 +0000
934 summary: (0) root
934 summary: (0) root
935
935
936
936
937
937
938 File glog per revset (only merges):
938 File glog per revset (only merges):
939
939
940 $ hg log -G -r 'file("a")' -m
940 $ hg log -G -r 'file("a")' -m
941 o changeset: 32:d06dffa21a31
941 o changeset: 32:d06dffa21a31
942 |\ parent: 27:886ed638191b
942 |\ parent: 27:886ed638191b
943 | | parent: 31:621d83e11f67
943 | | parent: 31:621d83e11f67
944 | | user: test
944 | | user: test
945 | | date: Thu Jan 01 00:00:32 1970 +0000
945 | | date: Thu Jan 01 00:00:32 1970 +0000
946 | | summary: (32) expand
946 | | summary: (32) expand
947 | |
947 | |
948 o | changeset: 31:621d83e11f67
948 o | changeset: 31:621d83e11f67
949 |\| parent: 21:d42a756af44d
949 |\| parent: 21:d42a756af44d
950 | | parent: 30:6e11cd4b648f
950 | | parent: 30:6e11cd4b648f
951 | | user: test
951 | | user: test
952 | | date: Thu Jan 01 00:00:31 1970 +0000
952 | | date: Thu Jan 01 00:00:31 1970 +0000
953 | | summary: (31) expand
953 | | summary: (31) expand
954 | |
954 | |
955 o | changeset: 30:6e11cd4b648f
955 o | changeset: 30:6e11cd4b648f
956 |\ \ parent: 28:44ecd0b9ae99
956 |\ \ parent: 28:44ecd0b9ae99
957 | | | parent: 29:cd9bb2be7593
957 | | | parent: 29:cd9bb2be7593
958 | | | user: test
958 | | | user: test
959 | | | date: Thu Jan 01 00:00:30 1970 +0000
959 | | | date: Thu Jan 01 00:00:30 1970 +0000
960 | | | summary: (30) expand
960 | | | summary: (30) expand
961 | | |
961 | | |
962 o | | changeset: 28:44ecd0b9ae99
962 o | | changeset: 28:44ecd0b9ae99
963 |\ \ \ parent: 1:6db2ef61d156
963 |\ \ \ parent: 1:6db2ef61d156
964 | | | | parent: 26:7f25b6c2f0b9
964 | | | | parent: 26:7f25b6c2f0b9
965 | | | | user: test
965 | | | | user: test
966 | | | | date: Thu Jan 01 00:00:28 1970 +0000
966 | | | | date: Thu Jan 01 00:00:28 1970 +0000
967 | | | | summary: (28) merge zero known
967 | | | | summary: (28) merge zero known
968 | | | |
968 | | | |
969 o | | | changeset: 26:7f25b6c2f0b9
969 o | | | changeset: 26:7f25b6c2f0b9
970 |\ \ \ \ parent: 18:1aa84d96232a
970 |\ \ \ \ parent: 18:1aa84d96232a
971 | | | | | parent: 25:91da8ed57247
971 | | | | | parent: 25:91da8ed57247
972 | | | | | user: test
972 | | | | | user: test
973 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
973 | | | | | date: Thu Jan 01 00:00:26 1970 +0000
974 | | | | | summary: (26) merge one known; far right
974 | | | | | summary: (26) merge one known; far right
975 | | | | |
975 | | | | |
976 | o-----+ changeset: 25:91da8ed57247
976 | o-----+ changeset: 25:91da8ed57247
977 | | | | | parent: 21:d42a756af44d
977 | | | | | parent: 21:d42a756af44d
978 | | | | | parent: 24:a9c19a3d96b7
978 | | | | | parent: 24:a9c19a3d96b7
979 | | | | | user: test
979 | | | | | user: test
980 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
980 | | | | | date: Thu Jan 01 00:00:25 1970 +0000
981 | | | | | summary: (25) merge one known; far left
981 | | | | | summary: (25) merge one known; far left
982 | | | | |
982 | | | | |
983 | o | | | changeset: 24:a9c19a3d96b7
983 | o | | | changeset: 24:a9c19a3d96b7
984 | |\ \ \ \ parent: 0:e6eb3150255d
984 | |\ \ \ \ parent: 0:e6eb3150255d
985 | | | | | | parent: 23:a01cddf0766d
985 | | | | | | parent: 23:a01cddf0766d
986 | | | | | | user: test
986 | | | | | | user: test
987 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
987 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000
988 | | | | | | summary: (24) merge one known; immediate right
988 | | | | | | summary: (24) merge one known; immediate right
989 | | | | | |
989 | | | | | |
990 | o---+ | | changeset: 23:a01cddf0766d
990 | o---+ | | changeset: 23:a01cddf0766d
991 | | | | | | parent: 1:6db2ef61d156
991 | | | | | | parent: 1:6db2ef61d156
992 | | | | | | parent: 22:e0d9cccacb5d
992 | | | | | | parent: 22:e0d9cccacb5d
993 | | | | | | user: test
993 | | | | | | user: test
994 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
994 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000
995 | | | | | | summary: (23) merge one known; immediate left
995 | | | | | | summary: (23) merge one known; immediate left
996 | | | | | |
996 | | | | | |
997 | o-------+ changeset: 22:e0d9cccacb5d
997 | o-------+ changeset: 22:e0d9cccacb5d
998 | | | | | | parent: 18:1aa84d96232a
998 | | | | | | parent: 18:1aa84d96232a
999 |/ / / / / parent: 21:d42a756af44d
999 |/ / / / / parent: 21:d42a756af44d
1000 | | | | | user: test
1000 | | | | | user: test
1001 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
1001 | | | | | date: Thu Jan 01 00:00:22 1970 +0000
1002 | | | | | summary: (22) merge two known; one far left, one far right
1002 | | | | | summary: (22) merge two known; one far left, one far right
1003 | | | | |
1003 | | | | |
1004 | | | | o changeset: 21:d42a756af44d
1004 | | | | o changeset: 21:d42a756af44d
1005 | | | | |\ parent: 19:31ddc2c1573b
1005 | | | | |\ parent: 19:31ddc2c1573b
1006 | | | | | | parent: 20:d30ed6450e32
1006 | | | | | | parent: 20:d30ed6450e32
1007 | | | | | | user: test
1007 | | | | | | user: test
1008 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
1008 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000
1009 | | | | | | summary: (21) expand
1009 | | | | | | summary: (21) expand
1010 | | | | | |
1010 | | | | | |
1011 +-+-------o changeset: 20:d30ed6450e32
1011 +-+-------o changeset: 20:d30ed6450e32
1012 | | | | | parent: 0:e6eb3150255d
1012 | | | | | parent: 0:e6eb3150255d
1013 | | | | | parent: 18:1aa84d96232a
1013 | | | | | parent: 18:1aa84d96232a
1014 | | | | | user: test
1014 | | | | | user: test
1015 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
1015 | | | | | date: Thu Jan 01 00:00:20 1970 +0000
1016 | | | | | summary: (20) merge two known; two far right
1016 | | | | | summary: (20) merge two known; two far right
1017 | | | | |
1017 | | | | |
1018 | | | | o changeset: 19:31ddc2c1573b
1018 | | | | o changeset: 19:31ddc2c1573b
1019 | | | | |\ parent: 15:1dda3f72782d
1019 | | | | |\ parent: 15:1dda3f72782d
1020 | | | | | | parent: 17:44765d7c06e0
1020 | | | | | | parent: 17:44765d7c06e0
1021 | | | | | | user: test
1021 | | | | | | user: test
1022 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
1022 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000
1023 | | | | | | summary: (19) expand
1023 | | | | | | summary: (19) expand
1024 | | | | | |
1024 | | | | | |
1025 o---+---+ | changeset: 18:1aa84d96232a
1025 o---+---+ | changeset: 18:1aa84d96232a
1026 | | | | | parent: 1:6db2ef61d156
1026 | | | | | parent: 1:6db2ef61d156
1027 / / / / / parent: 15:1dda3f72782d
1027 / / / / / parent: 15:1dda3f72782d
1028 | | | | | user: test
1028 | | | | | user: test
1029 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
1029 | | | | | date: Thu Jan 01 00:00:18 1970 +0000
1030 | | | | | summary: (18) merge two known; two far left
1030 | | | | | summary: (18) merge two known; two far left
1031 | | | | |
1031 | | | | |
1032 | | | | o changeset: 17:44765d7c06e0
1032 | | | | o changeset: 17:44765d7c06e0
1033 | | | | |\ parent: 12:86b91144a6e9
1033 | | | | |\ parent: 12:86b91144a6e9
1034 | | | | | | parent: 16:3677d192927d
1034 | | | | | | parent: 16:3677d192927d
1035 | | | | | | user: test
1035 | | | | | | user: test
1036 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
1036 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000
1037 | | | | | | summary: (17) expand
1037 | | | | | | summary: (17) expand
1038 | | | | | |
1038 | | | | | |
1039 +-+-------o changeset: 16:3677d192927d
1039 +-+-------o changeset: 16:3677d192927d
1040 | | | | | parent: 0:e6eb3150255d
1040 | | | | | parent: 0:e6eb3150255d
1041 | | | | | parent: 1:6db2ef61d156
1041 | | | | | parent: 1:6db2ef61d156
1042 | | | | | user: test
1042 | | | | | user: test
1043 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
1043 | | | | | date: Thu Jan 01 00:00:16 1970 +0000
1044 | | | | | summary: (16) merge two known; one immediate right, one near right
1044 | | | | | summary: (16) merge two known; one immediate right, one near right
1045 | | | | |
1045 | | | | |
1046 | | | o | changeset: 15:1dda3f72782d
1046 | | | o | changeset: 15:1dda3f72782d
1047 | | | |\ \ parent: 13:22d8966a97e3
1047 | | | |\ \ parent: 13:22d8966a97e3
1048 | | | | | | parent: 14:8eac370358ef
1048 | | | | | | parent: 14:8eac370358ef
1049 | | | | | | user: test
1049 | | | | | | user: test
1050 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
1050 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000
1051 | | | | | | summary: (15) expand
1051 | | | | | | summary: (15) expand
1052 | | | | | |
1052 | | | | | |
1053 +-------o | changeset: 14:8eac370358ef
1053 +-------o | changeset: 14:8eac370358ef
1054 | | | | |/ parent: 0:e6eb3150255d
1054 | | | | |/ parent: 0:e6eb3150255d
1055 | | | | | parent: 12:86b91144a6e9
1055 | | | | | parent: 12:86b91144a6e9
1056 | | | | | user: test
1056 | | | | | user: test
1057 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
1057 | | | | | date: Thu Jan 01 00:00:14 1970 +0000
1058 | | | | | summary: (14) merge two known; one immediate right, one far right
1058 | | | | | summary: (14) merge two known; one immediate right, one far right
1059 | | | | |
1059 | | | | |
1060 | | | o | changeset: 13:22d8966a97e3
1060 | | | o | changeset: 13:22d8966a97e3
1061 | | | |\ \ parent: 9:7010c0af0a35
1061 | | | |\ \ parent: 9:7010c0af0a35
1062 | | | | | | parent: 11:832d76e6bdf2
1062 | | | | | | parent: 11:832d76e6bdf2
1063 | | | | | | user: test
1063 | | | | | | user: test
1064 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
1064 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000
1065 | | | | | | summary: (13) expand
1065 | | | | | | summary: (13) expand
1066 | | | | | |
1066 | | | | | |
1067 | +---+---o changeset: 12:86b91144a6e9
1067 | +---+---o changeset: 12:86b91144a6e9
1068 | | | | | parent: 1:6db2ef61d156
1068 | | | | | parent: 1:6db2ef61d156
1069 | | | | | parent: 9:7010c0af0a35
1069 | | | | | parent: 9:7010c0af0a35
1070 | | | | | user: test
1070 | | | | | user: test
1071 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
1071 | | | | | date: Thu Jan 01 00:00:12 1970 +0000
1072 | | | | | summary: (12) merge two known; one immediate right, one far left
1072 | | | | | summary: (12) merge two known; one immediate right, one far left
1073 | | | | |
1073 | | | | |
1074 | | | | o changeset: 11:832d76e6bdf2
1074 | | | | o changeset: 11:832d76e6bdf2
1075 | | | | |\ parent: 6:b105a072e251
1075 | | | | |\ parent: 6:b105a072e251
1076 | | | | | | parent: 10:74c64d036d72
1076 | | | | | | parent: 10:74c64d036d72
1077 | | | | | | user: test
1077 | | | | | | user: test
1078 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
1078 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000
1079 | | | | | | summary: (11) expand
1079 | | | | | | summary: (11) expand
1080 | | | | | |
1080 | | | | | |
1081 +---------o changeset: 10:74c64d036d72
1081 +---------o changeset: 10:74c64d036d72
1082 | | | | |/ parent: 0:e6eb3150255d
1082 | | | | |/ parent: 0:e6eb3150255d
1083 | | | | | parent: 6:b105a072e251
1083 | | | | | parent: 6:b105a072e251
1084 | | | | | user: test
1084 | | | | | user: test
1085 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
1085 | | | | | date: Thu Jan 01 00:00:10 1970 +0000
1086 | | | | | summary: (10) merge two known; one immediate left, one near right
1086 | | | | | summary: (10) merge two known; one immediate left, one near right
1087 | | | | |
1087 | | | | |
1088 | | | o | changeset: 9:7010c0af0a35
1088 | | | o | changeset: 9:7010c0af0a35
1089 | | | |\ \ parent: 7:b632bb1b1224
1089 | | | |\ \ parent: 7:b632bb1b1224
1090 | | | | | | parent: 8:7a0b11f71937
1090 | | | | | | parent: 8:7a0b11f71937
1091 | | | | | | user: test
1091 | | | | | | user: test
1092 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
1092 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000
1093 | | | | | | summary: (9) expand
1093 | | | | | | summary: (9) expand
1094 | | | | | |
1094 | | | | | |
1095 +-------o | changeset: 8:7a0b11f71937
1095 +-------o | changeset: 8:7a0b11f71937
1096 | | | |/ / parent: 0:e6eb3150255d
1096 | | | |/ / parent: 0:e6eb3150255d
1097 | | | | | parent: 7:b632bb1b1224
1097 | | | | | parent: 7:b632bb1b1224
1098 | | | | | user: test
1098 | | | | | user: test
1099 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
1099 | | | | | date: Thu Jan 01 00:00:08 1970 +0000
1100 | | | | | summary: (8) merge two known; one immediate left, one far right
1100 | | | | | summary: (8) merge two known; one immediate left, one far right
1101 | | | | |
1101 | | | | |
1102 | | | o | changeset: 7:b632bb1b1224
1102 | | | o | changeset: 7:b632bb1b1224
1103 | | | |\ \ parent: 2:3d9a33b8d1e1
1103 | | | |\ \ parent: 2:3d9a33b8d1e1
1104 | | | | | | parent: 5:4409d547b708
1104 | | | | | | parent: 5:4409d547b708
1105 | | | | | | user: test
1105 | | | | | | user: test
1106 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
1106 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000
1107 | | | | | | summary: (7) expand
1107 | | | | | | summary: (7) expand
1108 | | | | | |
1108 | | | | | |
1109 | | | +---o changeset: 6:b105a072e251
1109 | | | +---o changeset: 6:b105a072e251
1110 | | | | |/ parent: 2:3d9a33b8d1e1
1110 | | | | |/ parent: 2:3d9a33b8d1e1
1111 | | | | | parent: 5:4409d547b708
1111 | | | | | parent: 5:4409d547b708
1112 | | | | | user: test
1112 | | | | | user: test
1113 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
1113 | | | | | date: Thu Jan 01 00:00:06 1970 +0000
1114 | | | | | summary: (6) merge two known; one immediate left, one far left
1114 | | | | | summary: (6) merge two known; one immediate left, one far left
1115 | | | | |
1115 | | | | |
1116 | | | o | changeset: 5:4409d547b708
1116 | | | o | changeset: 5:4409d547b708
1117 | | | |\ \ parent: 3:27eef8ed80b4
1117 | | | |\ \ parent: 3:27eef8ed80b4
1118 | | | | | | parent: 4:26a8bac39d9f
1118 | | | | | | parent: 4:26a8bac39d9f
1119 | | | | | | user: test
1119 | | | | | | user: test
1120 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
1120 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000
1121 | | | | | | summary: (5) expand
1121 | | | | | | summary: (5) expand
1122 | | | | | |
1122 | | | | | |
1123 | +---o | | changeset: 4:26a8bac39d9f
1123 | +---o | | changeset: 4:26a8bac39d9f
1124 | | | |/ / parent: 1:6db2ef61d156
1124 | | | |/ / parent: 1:6db2ef61d156
1125 | | | | | parent: 3:27eef8ed80b4
1125 | | | | | parent: 3:27eef8ed80b4
1126 | | | | | user: test
1126 | | | | | user: test
1127 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
1127 | | | | | date: Thu Jan 01 00:00:04 1970 +0000
1128 | | | | | summary: (4) merge two known; one immediate left, one immediate right
1128 | | | | | summary: (4) merge two known; one immediate left, one immediate right
1129 | | | | |
1129 | | | | |
1130
1130
1131
1131
1132 Empty revision range - display nothing:
1132 Empty revision range - display nothing:
1133 $ hg log -G -r 1..0
1133 $ hg log -G -r 1..0
1134
1134
1135 $ cd ..
1135 $ cd ..
1136
1136
1137 #if no-outer-repo
1137 #if no-outer-repo
1138
1138
1139 From outer space:
1139 From outer space:
1140 $ hg log -G -l1 repo
1140 $ hg log -G -l1 repo
1141 @ changeset: 34:fea3ac5810e0
1141 @ changeset: 34:fea3ac5810e0
1142 | tag: tip
1142 | tag: tip
1143 | parent: 32:d06dffa21a31
1143 | parent: 32:d06dffa21a31
1144 | user: test
1144 | user: test
1145 | date: Thu Jan 01 00:00:34 1970 +0000
1145 | date: Thu Jan 01 00:00:34 1970 +0000
1146 | summary: (34) head
1146 | summary: (34) head
1147 |
1147 |
1148 $ hg log -G -l1 repo/a
1148 $ hg log -G -l1 repo/a
1149 @ changeset: 34:fea3ac5810e0
1149 @ changeset: 34:fea3ac5810e0
1150 | tag: tip
1150 | tag: tip
1151 | parent: 32:d06dffa21a31
1151 | parent: 32:d06dffa21a31
1152 | user: test
1152 | user: test
1153 | date: Thu Jan 01 00:00:34 1970 +0000
1153 | date: Thu Jan 01 00:00:34 1970 +0000
1154 | summary: (34) head
1154 | summary: (34) head
1155 |
1155 |
1156 $ hg log -G -l1 repo/missing
1156 $ hg log -G -l1 repo/missing
1157
1157
1158 #endif
1158 #endif
1159
1159
1160 File log with revs != cset revs:
1160 File log with revs != cset revs:
1161 $ hg init flog
1161 $ hg init flog
1162 $ cd flog
1162 $ cd flog
1163 $ echo one >one
1163 $ echo one >one
1164 $ hg add one
1164 $ hg add one
1165 $ hg commit -mone
1165 $ hg commit -mone
1166 $ echo two >two
1166 $ echo two >two
1167 $ hg add two
1167 $ hg add two
1168 $ hg commit -mtwo
1168 $ hg commit -mtwo
1169 $ echo more >two
1169 $ echo more >two
1170 $ hg commit -mmore
1170 $ hg commit -mmore
1171 $ hg log -G two
1171 $ hg log -G two
1172 @ changeset: 2:12c28321755b
1172 @ changeset: 2:12c28321755b
1173 | tag: tip
1173 | tag: tip
1174 | user: test
1174 | user: test
1175 | date: Thu Jan 01 00:00:00 1970 +0000
1175 | date: Thu Jan 01 00:00:00 1970 +0000
1176 | summary: more
1176 | summary: more
1177 |
1177 |
1178 o changeset: 1:5ac72c0599bf
1178 o changeset: 1:5ac72c0599bf
1179 | user: test
1179 | user: test
1180 | date: Thu Jan 01 00:00:00 1970 +0000
1180 | date: Thu Jan 01 00:00:00 1970 +0000
1181 | summary: two
1181 | summary: two
1182 |
1182 |
1183
1183
1184 Issue1896: File log with explicit style
1184 Issue1896: File log with explicit style
1185 $ hg log -G --style=default one
1185 $ hg log -G --style=default one
1186 o changeset: 0:3d578b4a1f53
1186 o changeset: 0:3d578b4a1f53
1187 user: test
1187 user: test
1188 date: Thu Jan 01 00:00:00 1970 +0000
1188 date: Thu Jan 01 00:00:00 1970 +0000
1189 summary: one
1189 summary: one
1190
1190
1191 Issue2395: glog --style header and footer
1191 Issue2395: glog --style header and footer
1192 $ hg log -G --style=xml one
1192 $ hg log -G --style=xml one
1193 <?xml version="1.0"?>
1193 <?xml version="1.0"?>
1194 <log>
1194 <log>
1195 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1195 o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1">
1196 <author email="test">test</author>
1196 <author email="test">test</author>
1197 <date>1970-01-01T00:00:00+00:00</date>
1197 <date>1970-01-01T00:00:00+00:00</date>
1198 <msg xml:space="preserve">one</msg>
1198 <msg xml:space="preserve">one</msg>
1199 </logentry>
1199 </logentry>
1200 </log>
1200 </log>
1201
1201
1202 $ cd ..
1202 $ cd ..
1203
1203
1204 Incoming and outgoing:
1204 Incoming and outgoing:
1205
1205
1206 $ hg clone -U -r31 repo repo2
1206 $ hg clone -U -r31 repo repo2
1207 adding changesets
1207 adding changesets
1208 adding manifests
1208 adding manifests
1209 adding file changes
1209 adding file changes
1210 added 31 changesets with 31 changes to 1 files
1210 added 31 changesets with 31 changes to 1 files
1211 $ cd repo2
1211 $ cd repo2
1212
1212
1213 $ hg incoming --graph ../repo
1213 $ hg incoming --graph ../repo
1214 comparing with ../repo
1214 comparing with ../repo
1215 searching for changes
1215 searching for changes
1216 o changeset: 34:fea3ac5810e0
1216 o changeset: 34:fea3ac5810e0
1217 | tag: tip
1217 | tag: tip
1218 | parent: 32:d06dffa21a31
1218 | parent: 32:d06dffa21a31
1219 | user: test
1219 | user: test
1220 | date: Thu Jan 01 00:00:34 1970 +0000
1220 | date: Thu Jan 01 00:00:34 1970 +0000
1221 | summary: (34) head
1221 | summary: (34) head
1222 |
1222 |
1223 | o changeset: 33:68608f5145f9
1223 | o changeset: 33:68608f5145f9
1224 | parent: 18:1aa84d96232a
1224 | parent: 18:1aa84d96232a
1225 | user: test
1225 | user: test
1226 | date: Thu Jan 01 00:00:33 1970 +0000
1226 | date: Thu Jan 01 00:00:33 1970 +0000
1227 | summary: (33) head
1227 | summary: (33) head
1228 |
1228 |
1229 o changeset: 32:d06dffa21a31
1229 o changeset: 32:d06dffa21a31
1230 | parent: 27:886ed638191b
1230 | parent: 27:886ed638191b
1231 | parent: 31:621d83e11f67
1231 | parent: 31:621d83e11f67
1232 | user: test
1232 | user: test
1233 | date: Thu Jan 01 00:00:32 1970 +0000
1233 | date: Thu Jan 01 00:00:32 1970 +0000
1234 | summary: (32) expand
1234 | summary: (32) expand
1235 |
1235 |
1236 o changeset: 27:886ed638191b
1236 o changeset: 27:886ed638191b
1237 parent: 21:d42a756af44d
1237 parent: 21:d42a756af44d
1238 user: test
1238 user: test
1239 date: Thu Jan 01 00:00:27 1970 +0000
1239 date: Thu Jan 01 00:00:27 1970 +0000
1240 summary: (27) collapse
1240 summary: (27) collapse
1241
1241
1242 $ cd ..
1242 $ cd ..
1243
1243
1244 $ hg -R repo outgoing --graph repo2
1244 $ hg -R repo outgoing --graph repo2
1245 comparing with repo2
1245 comparing with repo2
1246 searching for changes
1246 searching for changes
1247 @ changeset: 34:fea3ac5810e0
1247 @ changeset: 34:fea3ac5810e0
1248 | tag: tip
1248 | tag: tip
1249 | parent: 32:d06dffa21a31
1249 | parent: 32:d06dffa21a31
1250 | user: test
1250 | user: test
1251 | date: Thu Jan 01 00:00:34 1970 +0000
1251 | date: Thu Jan 01 00:00:34 1970 +0000
1252 | summary: (34) head
1252 | summary: (34) head
1253 |
1253 |
1254 | o changeset: 33:68608f5145f9
1254 | o changeset: 33:68608f5145f9
1255 | parent: 18:1aa84d96232a
1255 | parent: 18:1aa84d96232a
1256 | user: test
1256 | user: test
1257 | date: Thu Jan 01 00:00:33 1970 +0000
1257 | date: Thu Jan 01 00:00:33 1970 +0000
1258 | summary: (33) head
1258 | summary: (33) head
1259 |
1259 |
1260 o changeset: 32:d06dffa21a31
1260 o changeset: 32:d06dffa21a31
1261 | parent: 27:886ed638191b
1261 | parent: 27:886ed638191b
1262 | parent: 31:621d83e11f67
1262 | parent: 31:621d83e11f67
1263 | user: test
1263 | user: test
1264 | date: Thu Jan 01 00:00:32 1970 +0000
1264 | date: Thu Jan 01 00:00:32 1970 +0000
1265 | summary: (32) expand
1265 | summary: (32) expand
1266 |
1266 |
1267 o changeset: 27:886ed638191b
1267 o changeset: 27:886ed638191b
1268 parent: 21:d42a756af44d
1268 parent: 21:d42a756af44d
1269 user: test
1269 user: test
1270 date: Thu Jan 01 00:00:27 1970 +0000
1270 date: Thu Jan 01 00:00:27 1970 +0000
1271 summary: (27) collapse
1271 summary: (27) collapse
1272
1272
1273
1273
1274 File + limit with revs != cset revs:
1274 File + limit with revs != cset revs:
1275 $ cd repo
1275 $ cd repo
1276 $ touch b
1276 $ touch b
1277 $ hg ci -Aqm0
1277 $ hg ci -Aqm0
1278 $ hg log -G -l2 a
1278 $ hg log -G -l2 a
1279 o changeset: 34:fea3ac5810e0
1279 o changeset: 34:fea3ac5810e0
1280 | parent: 32:d06dffa21a31
1280 | parent: 32:d06dffa21a31
1281 | user: test
1281 | user: test
1282 | date: Thu Jan 01 00:00:34 1970 +0000
1282 | date: Thu Jan 01 00:00:34 1970 +0000
1283 | summary: (34) head
1283 | summary: (34) head
1284 |
1284 |
1285 | o changeset: 33:68608f5145f9
1285 | o changeset: 33:68608f5145f9
1286 | | parent: 18:1aa84d96232a
1286 | | parent: 18:1aa84d96232a
1287 | | user: test
1287 | | user: test
1288 | | date: Thu Jan 01 00:00:33 1970 +0000
1288 | | date: Thu Jan 01 00:00:33 1970 +0000
1289 | | summary: (33) head
1289 | | summary: (33) head
1290 | |
1290 | |
1291
1291
1292 File + limit + -ra:b, (b - a) < limit:
1292 File + limit + -ra:b, (b - a) < limit:
1293 $ hg log -G -l3000 -r32:tip a
1293 $ hg log -G -l3000 -r32:tip a
1294 o changeset: 34:fea3ac5810e0
1294 o changeset: 34:fea3ac5810e0
1295 | parent: 32:d06dffa21a31
1295 | parent: 32:d06dffa21a31
1296 | user: test
1296 | user: test
1297 | date: Thu Jan 01 00:00:34 1970 +0000
1297 | date: Thu Jan 01 00:00:34 1970 +0000
1298 | summary: (34) head
1298 | summary: (34) head
1299 |
1299 |
1300 | o changeset: 33:68608f5145f9
1300 | o changeset: 33:68608f5145f9
1301 | | parent: 18:1aa84d96232a
1301 | | parent: 18:1aa84d96232a
1302 | | user: test
1302 | | user: test
1303 | | date: Thu Jan 01 00:00:33 1970 +0000
1303 | | date: Thu Jan 01 00:00:33 1970 +0000
1304 | | summary: (33) head
1304 | | summary: (33) head
1305 | |
1305 | |
1306 o | changeset: 32:d06dffa21a31
1306 o | changeset: 32:d06dffa21a31
1307 |\ \ parent: 27:886ed638191b
1307 |\ \ parent: 27:886ed638191b
1308 | | | parent: 31:621d83e11f67
1308 | | | parent: 31:621d83e11f67
1309 | | | user: test
1309 | | | user: test
1310 | | | date: Thu Jan 01 00:00:32 1970 +0000
1310 | | | date: Thu Jan 01 00:00:32 1970 +0000
1311 | | | summary: (32) expand
1311 | | | summary: (32) expand
1312 | | |
1312 | | |
1313
1313
1314 Point out a common and an uncommon unshown parent
1314 Point out a common and an uncommon unshown parent
1315
1315
1316 $ hg log -G -r 'rev(8) or rev(9)'
1316 $ hg log -G -r 'rev(8) or rev(9)'
1317 o changeset: 9:7010c0af0a35
1317 o changeset: 9:7010c0af0a35
1318 |\ parent: 7:b632bb1b1224
1318 |\ parent: 7:b632bb1b1224
1319 | | parent: 8:7a0b11f71937
1319 | | parent: 8:7a0b11f71937
1320 | | user: test
1320 | | user: test
1321 | | date: Thu Jan 01 00:00:09 1970 +0000
1321 | | date: Thu Jan 01 00:00:09 1970 +0000
1322 | | summary: (9) expand
1322 | | summary: (9) expand
1323 | |
1323 | |
1324 o | changeset: 8:7a0b11f71937
1324 o | changeset: 8:7a0b11f71937
1325 |\| parent: 0:e6eb3150255d
1325 |\| parent: 0:e6eb3150255d
1326 | | parent: 7:b632bb1b1224
1326 | | parent: 7:b632bb1b1224
1327 | | user: test
1327 | | user: test
1328 | | date: Thu Jan 01 00:00:08 1970 +0000
1328 | | date: Thu Jan 01 00:00:08 1970 +0000
1329 | | summary: (8) merge two known; one immediate left, one far right
1329 | | summary: (8) merge two known; one immediate left, one far right
1330 | |
1330 | |
1331
1331
1332 File + limit + -ra:b, b < tip:
1332 File + limit + -ra:b, b < tip:
1333
1333
1334 $ hg log -G -l1 -r32:34 a
1334 $ hg log -G -l1 -r32:34 a
1335 o changeset: 34:fea3ac5810e0
1335 o changeset: 34:fea3ac5810e0
1336 | parent: 32:d06dffa21a31
1336 | parent: 32:d06dffa21a31
1337 | user: test
1337 | user: test
1338 | date: Thu Jan 01 00:00:34 1970 +0000
1338 | date: Thu Jan 01 00:00:34 1970 +0000
1339 | summary: (34) head
1339 | summary: (34) head
1340 |
1340 |
1341
1341
1342 file(File) + limit + -ra:b, b < tip:
1342 file(File) + limit + -ra:b, b < tip:
1343
1343
1344 $ hg log -G -l1 -r32:34 -r 'file("a")'
1344 $ hg log -G -l1 -r32:34 -r 'file("a")'
1345 o changeset: 34:fea3ac5810e0
1345 o changeset: 34:fea3ac5810e0
1346 | parent: 32:d06dffa21a31
1346 | parent: 32:d06dffa21a31
1347 | user: test
1347 | user: test
1348 | date: Thu Jan 01 00:00:34 1970 +0000
1348 | date: Thu Jan 01 00:00:34 1970 +0000
1349 | summary: (34) head
1349 | summary: (34) head
1350 |
1350 |
1351
1351
1352 limit(file(File) and a::b), b < tip:
1352 limit(file(File) and a::b), b < tip:
1353
1353
1354 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1354 $ hg log -G -r 'limit(file("a") and 32::34, 1)'
1355 o changeset: 32:d06dffa21a31
1355 o changeset: 32:d06dffa21a31
1356 |\ parent: 27:886ed638191b
1356 |\ parent: 27:886ed638191b
1357 | | parent: 31:621d83e11f67
1357 | | parent: 31:621d83e11f67
1358 | | user: test
1358 | | user: test
1359 | | date: Thu Jan 01 00:00:32 1970 +0000
1359 | | date: Thu Jan 01 00:00:32 1970 +0000
1360 | | summary: (32) expand
1360 | | summary: (32) expand
1361 | |
1361 | |
1362
1362
1363 File + limit + -ra:b, b < tip:
1363 File + limit + -ra:b, b < tip:
1364
1364
1365 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1365 $ hg log -G -r 'limit(file("a") and 34::32, 1)'
1366
1366
1367 File + limit + -ra:b, b < tip, (b - a) < limit:
1367 File + limit + -ra:b, b < tip, (b - a) < limit:
1368
1368
1369 $ hg log -G -l10 -r33:34 a
1369 $ hg log -G -l10 -r33:34 a
1370 o changeset: 34:fea3ac5810e0
1370 o changeset: 34:fea3ac5810e0
1371 | parent: 32:d06dffa21a31
1371 | parent: 32:d06dffa21a31
1372 | user: test
1372 | user: test
1373 | date: Thu Jan 01 00:00:34 1970 +0000
1373 | date: Thu Jan 01 00:00:34 1970 +0000
1374 | summary: (34) head
1374 | summary: (34) head
1375 |
1375 |
1376 | o changeset: 33:68608f5145f9
1376 | o changeset: 33:68608f5145f9
1377 | | parent: 18:1aa84d96232a
1377 | | parent: 18:1aa84d96232a
1378 | | user: test
1378 | | user: test
1379 | | date: Thu Jan 01 00:00:33 1970 +0000
1379 | | date: Thu Jan 01 00:00:33 1970 +0000
1380 | | summary: (33) head
1380 | | summary: (33) head
1381 | |
1381 | |
1382
1382
1383 Do not crash or produce strange graphs if history is buggy
1383 Do not crash or produce strange graphs if history is buggy
1384
1384
1385 $ hg branch branch
1385 $ hg branch branch
1386 marked working directory as branch branch
1386 marked working directory as branch branch
1387 (branches are permanent and global, did you want a bookmark?)
1387 (branches are permanent and global, did you want a bookmark?)
1388 $ commit 36 "buggy merge: identical parents" 35 35
1388 $ commit 36 "buggy merge: identical parents" 35 35
1389 $ hg log -G -l5
1389 $ hg log -G -l5
1390 @ changeset: 36:08a19a744424
1390 @ changeset: 36:08a19a744424
1391 | branch: branch
1391 | branch: branch
1392 | tag: tip
1392 | tag: tip
1393 | parent: 35:9159c3644c5e
1393 | parent: 35:9159c3644c5e
1394 | parent: 35:9159c3644c5e
1394 | parent: 35:9159c3644c5e
1395 | user: test
1395 | user: test
1396 | date: Thu Jan 01 00:00:36 1970 +0000
1396 | date: Thu Jan 01 00:00:36 1970 +0000
1397 | summary: (36) buggy merge: identical parents
1397 | summary: (36) buggy merge: identical parents
1398 |
1398 |
1399 o changeset: 35:9159c3644c5e
1399 o changeset: 35:9159c3644c5e
1400 | user: test
1400 | user: test
1401 | date: Thu Jan 01 00:00:00 1970 +0000
1401 | date: Thu Jan 01 00:00:00 1970 +0000
1402 | summary: 0
1402 | summary: 0
1403 |
1403 |
1404 o changeset: 34:fea3ac5810e0
1404 o changeset: 34:fea3ac5810e0
1405 | parent: 32:d06dffa21a31
1405 | parent: 32:d06dffa21a31
1406 | user: test
1406 | user: test
1407 | date: Thu Jan 01 00:00:34 1970 +0000
1407 | date: Thu Jan 01 00:00:34 1970 +0000
1408 | summary: (34) head
1408 | summary: (34) head
1409 |
1409 |
1410 | o changeset: 33:68608f5145f9
1410 | o changeset: 33:68608f5145f9
1411 | | parent: 18:1aa84d96232a
1411 | | parent: 18:1aa84d96232a
1412 | | user: test
1412 | | user: test
1413 | | date: Thu Jan 01 00:00:33 1970 +0000
1413 | | date: Thu Jan 01 00:00:33 1970 +0000
1414 | | summary: (33) head
1414 | | summary: (33) head
1415 | |
1415 | |
1416 o | changeset: 32:d06dffa21a31
1416 o | changeset: 32:d06dffa21a31
1417 |\ \ parent: 27:886ed638191b
1417 |\ \ parent: 27:886ed638191b
1418 | | | parent: 31:621d83e11f67
1418 | | | parent: 31:621d83e11f67
1419 | | | user: test
1419 | | | user: test
1420 | | | date: Thu Jan 01 00:00:32 1970 +0000
1420 | | | date: Thu Jan 01 00:00:32 1970 +0000
1421 | | | summary: (32) expand
1421 | | | summary: (32) expand
1422 | | |
1422 | | |
1423
1423
1424 Test log -G options
1424 Test log -G options
1425
1425
1426 $ testlog() {
1426 $ testlog() {
1427 > hg log -G --print-revset "$@"
1427 > hg log -G --print-revset "$@"
1428 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1428 > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \
1429 > | sed 's/.*nodetag/nodetag/' > log.nodes
1429 > | sed 's/.*nodetag/nodetag/' > log.nodes
1430 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1430 > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
1431 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1431 > | sed 's/.*nodetag/nodetag/' > glog.nodes
1432 > diff -u log.nodes glog.nodes | grep '^[-+@ ]' || :
1432 > diff -u log.nodes glog.nodes | grep '^[-+@ ]' || :
1433 > }
1433 > }
1434
1434
1435 glog always reorders nodes which explains the difference with log
1435 glog always reorders nodes which explains the difference with log
1436
1436
1437 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1437 $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31
1438 ['27', '25', '21', '34', '32', '31']
1438 ['27', '25', '21', '34', '32', '31']
1439 []
1439 []
1440 --- log.nodes * (glob)
1440 --- log.nodes * (glob)
1441 +++ glog.nodes * (glob)
1441 +++ glog.nodes * (glob)
1442 @@ -1,6 +1,6 @@
1442 @@ -1,6 +1,6 @@
1443 -nodetag 27
1443 -nodetag 27
1444 -nodetag 25
1444 -nodetag 25
1445 -nodetag 21
1445 -nodetag 21
1446 nodetag 34
1446 nodetag 34
1447 nodetag 32
1447 nodetag 32
1448 nodetag 31
1448 nodetag 31
1449 +nodetag 27
1449 +nodetag 27
1450 +nodetag 25
1450 +nodetag 25
1451 +nodetag 21
1451 +nodetag 21
1452 $ testlog -u test -u not-a-user
1452 $ testlog -u test -u not-a-user
1453 []
1453 []
1454 (group
1454 (group
1455 (group
1455 (group
1456 (or
1456 (or
1457 (func
1457 (func
1458 ('symbol', 'user')
1458 ('symbol', 'user')
1459 ('string', 'test'))
1459 ('string', 'test'))
1460 (func
1460 (func
1461 ('symbol', 'user')
1461 ('symbol', 'user')
1462 ('string', 'not-a-user')))))
1462 ('string', 'not-a-user')))))
1463 $ testlog -b not-a-branch
1463 $ testlog -b not-a-branch
1464 abort: unknown revision 'not-a-branch'!
1464 abort: unknown revision 'not-a-branch'!
1465 abort: unknown revision 'not-a-branch'!
1465 abort: unknown revision 'not-a-branch'!
1466 abort: unknown revision 'not-a-branch'!
1466 abort: unknown revision 'not-a-branch'!
1467 $ testlog -b 35 -b 36 --only-branch branch
1467 $ testlog -b 35 -b 36 --only-branch branch
1468 []
1468 []
1469 (group
1469 (group
1470 (group
1470 (group
1471 (or
1471 (or
1472 (or
1472 (or
1473 (func
1473 (func
1474 ('symbol', 'branch')
1474 ('symbol', 'branch')
1475 ('string', 'default'))
1475 ('string', 'default'))
1476 (func
1476 (func
1477 ('symbol', 'branch')
1477 ('symbol', 'branch')
1478 ('string', 'branch')))
1478 ('string', 'branch')))
1479 (func
1479 (func
1480 ('symbol', 'branch')
1480 ('symbol', 'branch')
1481 ('string', 'branch')))))
1481 ('string', 'branch')))))
1482 $ testlog -k expand -k merge
1482 $ testlog -k expand -k merge
1483 []
1483 []
1484 (group
1484 (group
1485 (group
1485 (group
1486 (or
1486 (or
1487 (func
1487 (func
1488 ('symbol', 'keyword')
1488 ('symbol', 'keyword')
1489 ('string', 'expand'))
1489 ('string', 'expand'))
1490 (func
1490 (func
1491 ('symbol', 'keyword')
1491 ('symbol', 'keyword')
1492 ('string', 'merge')))))
1492 ('string', 'merge')))))
1493 $ testlog --only-merges
1493 $ testlog --only-merges
1494 []
1494 []
1495 (group
1495 (group
1496 (func
1496 (func
1497 ('symbol', 'merge')
1497 ('symbol', 'merge')
1498 None))
1498 None))
1499 $ testlog --no-merges
1499 $ testlog --no-merges
1500 []
1500 []
1501 (group
1501 (group
1502 (not
1502 (not
1503 (func
1503 (func
1504 ('symbol', 'merge')
1504 ('symbol', 'merge')
1505 None)))
1505 None)))
1506 $ testlog --date '2 0 to 4 0'
1506 $ testlog --date '2 0 to 4 0'
1507 []
1507 []
1508 (group
1508 (group
1509 (func
1509 (func
1510 ('symbol', 'date')
1510 ('symbol', 'date')
1511 ('string', '2 0 to 4 0')))
1511 ('string', '2 0 to 4 0')))
1512 $ hg log -G -d 'brace ) in a date'
1512 $ hg log -G -d 'brace ) in a date'
1513 abort: invalid date: 'brace ) in a date'
1513 abort: invalid date: 'brace ) in a date'
1514 [255]
1514 [255]
1515 $ testlog --prune 31 --prune 32
1515 $ testlog --prune 31 --prune 32
1516 []
1516 []
1517 (group
1517 (group
1518 (group
1518 (group
1519 (and
1519 (and
1520 (not
1520 (not
1521 (group
1521 (group
1522 (or
1522 (or
1523 ('string', '31')
1523 ('string', '31')
1524 (func
1524 (func
1525 ('symbol', 'ancestors')
1525 ('symbol', 'ancestors')
1526 ('string', '31')))))
1526 ('string', '31')))))
1527 (not
1527 (not
1528 (group
1528 (group
1529 (or
1529 (or
1530 ('string', '32')
1530 ('string', '32')
1531 (func
1531 (func
1532 ('symbol', 'ancestors')
1532 ('symbol', 'ancestors')
1533 ('string', '32'))))))))
1533 ('string', '32'))))))))
1534
1534
1535 Dedicated repo for --follow and paths filtering. The g is crafted to
1535 Dedicated repo for --follow and paths filtering. The g is crafted to
1536 have 2 filelog topological heads in a linear changeset graph.
1536 have 2 filelog topological heads in a linear changeset graph.
1537
1537
1538 $ cd ..
1538 $ cd ..
1539 $ hg init follow
1539 $ hg init follow
1540 $ cd follow
1540 $ cd follow
1541 $ testlog --follow
1541 $ testlog --follow
1542 []
1542 []
1543 []
1543 []
1544 $ testlog -rnull
1545 ['null']
1546 []
1544 $ echo a > a
1547 $ echo a > a
1545 $ echo aa > aa
1548 $ echo aa > aa
1546 $ echo f > f
1549 $ echo f > f
1547 $ hg ci -Am "add a" a aa f
1550 $ hg ci -Am "add a" a aa f
1548 $ hg cp a b
1551 $ hg cp a b
1549 $ hg cp f g
1552 $ hg cp f g
1550 $ hg ci -m "copy a b"
1553 $ hg ci -m "copy a b"
1551 $ mkdir dir
1554 $ mkdir dir
1552 $ hg mv b dir
1555 $ hg mv b dir
1553 $ echo g >> g
1556 $ echo g >> g
1554 $ echo f >> f
1557 $ echo f >> f
1555 $ hg ci -m "mv b dir/b"
1558 $ hg ci -m "mv b dir/b"
1556 $ hg mv a b
1559 $ hg mv a b
1557 $ hg cp -f f g
1560 $ hg cp -f f g
1558 $ echo a > d
1561 $ echo a > d
1559 $ hg add d
1562 $ hg add d
1560 $ hg ci -m "mv a b; add d"
1563 $ hg ci -m "mv a b; add d"
1561 $ hg mv dir/b e
1564 $ hg mv dir/b e
1562 $ hg ci -m "mv dir/b e"
1565 $ hg ci -m "mv dir/b e"
1563 $ hg log -G --template '({rev}) {desc|firstline}\n'
1566 $ hg log -G --template '({rev}) {desc|firstline}\n'
1564 @ (4) mv dir/b e
1567 @ (4) mv dir/b e
1565 |
1568 |
1566 o (3) mv a b; add d
1569 o (3) mv a b; add d
1567 |
1570 |
1568 o (2) mv b dir/b
1571 o (2) mv b dir/b
1569 |
1572 |
1570 o (1) copy a b
1573 o (1) copy a b
1571 |
1574 |
1572 o (0) add a
1575 o (0) add a
1573
1576
1574
1577
1575 $ testlog a
1578 $ testlog a
1576 []
1579 []
1577 (group
1580 (group
1578 (group
1581 (group
1579 (func
1582 (func
1580 ('symbol', 'filelog')
1583 ('symbol', 'filelog')
1581 ('string', 'a'))))
1584 ('string', 'a'))))
1582 $ testlog a b
1585 $ testlog a b
1583 []
1586 []
1584 (group
1587 (group
1585 (group
1588 (group
1586 (or
1589 (or
1587 (func
1590 (func
1588 ('symbol', 'filelog')
1591 ('symbol', 'filelog')
1589 ('string', 'a'))
1592 ('string', 'a'))
1590 (func
1593 (func
1591 ('symbol', 'filelog')
1594 ('symbol', 'filelog')
1592 ('string', 'b')))))
1595 ('string', 'b')))))
1593
1596
1594 Test falling back to slow path for non-existing files
1597 Test falling back to slow path for non-existing files
1595
1598
1596 $ testlog a c
1599 $ testlog a c
1597 []
1600 []
1598 (group
1601 (group
1599 (func
1602 (func
1600 ('symbol', '_matchfiles')
1603 ('symbol', '_matchfiles')
1601 (list
1604 (list
1602 (list
1605 (list
1603 (list
1606 (list
1604 ('string', 'r:')
1607 ('string', 'r:')
1605 ('string', 'd:relpath'))
1608 ('string', 'd:relpath'))
1606 ('string', 'p:a'))
1609 ('string', 'p:a'))
1607 ('string', 'p:c'))))
1610 ('string', 'p:c'))))
1608
1611
1609 Test multiple --include/--exclude/paths
1612 Test multiple --include/--exclude/paths
1610
1613
1611 $ testlog --include a --include e --exclude b --exclude e a e
1614 $ testlog --include a --include e --exclude b --exclude e a e
1612 []
1615 []
1613 (group
1616 (group
1614 (func
1617 (func
1615 ('symbol', '_matchfiles')
1618 ('symbol', '_matchfiles')
1616 (list
1619 (list
1617 (list
1620 (list
1618 (list
1621 (list
1619 (list
1622 (list
1620 (list
1623 (list
1621 (list
1624 (list
1622 (list
1625 (list
1623 ('string', 'r:')
1626 ('string', 'r:')
1624 ('string', 'd:relpath'))
1627 ('string', 'd:relpath'))
1625 ('string', 'p:a'))
1628 ('string', 'p:a'))
1626 ('string', 'p:e'))
1629 ('string', 'p:e'))
1627 ('string', 'i:a'))
1630 ('string', 'i:a'))
1628 ('string', 'i:e'))
1631 ('string', 'i:e'))
1629 ('string', 'x:b'))
1632 ('string', 'x:b'))
1630 ('string', 'x:e'))))
1633 ('string', 'x:e'))))
1631
1634
1632 Test glob expansion of pats
1635 Test glob expansion of pats
1633
1636
1634 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1637 $ expandglobs=`$PYTHON -c "import mercurial.util; \
1635 > print mercurial.util.expandglobs and 'true' or 'false'"`
1638 > print mercurial.util.expandglobs and 'true' or 'false'"`
1636 $ if [ $expandglobs = "true" ]; then
1639 $ if [ $expandglobs = "true" ]; then
1637 > testlog 'a*';
1640 > testlog 'a*';
1638 > else
1641 > else
1639 > testlog a*;
1642 > testlog a*;
1640 > fi;
1643 > fi;
1641 []
1644 []
1642 (group
1645 (group
1643 (group
1646 (group
1644 (func
1647 (func
1645 ('symbol', 'filelog')
1648 ('symbol', 'filelog')
1646 ('string', 'aa'))))
1649 ('string', 'aa'))))
1647
1650
1648 Test --follow on a non-existent directory
1651 Test --follow on a non-existent directory
1649
1652
1650 $ testlog -f dir
1653 $ testlog -f dir
1651 abort: cannot follow file not in parent revision: "dir"
1654 abort: cannot follow file not in parent revision: "dir"
1652 abort: cannot follow file not in parent revision: "dir"
1655 abort: cannot follow file not in parent revision: "dir"
1653 abort: cannot follow file not in parent revision: "dir"
1656 abort: cannot follow file not in parent revision: "dir"
1654
1657
1655 Test --follow on a directory
1658 Test --follow on a directory
1656
1659
1657 $ hg up -q '.^'
1660 $ hg up -q '.^'
1658 $ testlog -f dir
1661 $ testlog -f dir
1659 []
1662 []
1660 (group
1663 (group
1661 (and
1664 (and
1662 (func
1665 (func
1663 ('symbol', 'ancestors')
1666 ('symbol', 'ancestors')
1664 ('symbol', '.'))
1667 ('symbol', '.'))
1665 (func
1668 (func
1666 ('symbol', '_matchfiles')
1669 ('symbol', '_matchfiles')
1667 (list
1670 (list
1668 (list
1671 (list
1669 ('string', 'r:')
1672 ('string', 'r:')
1670 ('string', 'd:relpath'))
1673 ('string', 'd:relpath'))
1671 ('string', 'p:dir')))))
1674 ('string', 'p:dir')))))
1672 $ hg up -q tip
1675 $ hg up -q tip
1673
1676
1674 Test --follow on file not in parent revision
1677 Test --follow on file not in parent revision
1675
1678
1676 $ testlog -f a
1679 $ testlog -f a
1677 abort: cannot follow file not in parent revision: "a"
1680 abort: cannot follow file not in parent revision: "a"
1678 abort: cannot follow file not in parent revision: "a"
1681 abort: cannot follow file not in parent revision: "a"
1679 abort: cannot follow file not in parent revision: "a"
1682 abort: cannot follow file not in parent revision: "a"
1680
1683
1681 Test --follow and patterns
1684 Test --follow and patterns
1682
1685
1683 $ testlog -f 'glob:*'
1686 $ testlog -f 'glob:*'
1684 []
1687 []
1685 (group
1688 (group
1686 (and
1689 (and
1687 (func
1690 (func
1688 ('symbol', 'ancestors')
1691 ('symbol', 'ancestors')
1689 ('symbol', '.'))
1692 ('symbol', '.'))
1690 (func
1693 (func
1691 ('symbol', '_matchfiles')
1694 ('symbol', '_matchfiles')
1692 (list
1695 (list
1693 (list
1696 (list
1694 ('string', 'r:')
1697 ('string', 'r:')
1695 ('string', 'd:relpath'))
1698 ('string', 'd:relpath'))
1696 ('string', 'p:glob:*')))))
1699 ('string', 'p:glob:*')))))
1697
1700
1698 Test --follow on a single rename
1701 Test --follow on a single rename
1699
1702
1700 $ hg up -q 2
1703 $ hg up -q 2
1701 $ testlog -f a
1704 $ testlog -f a
1702 []
1705 []
1703 (group
1706 (group
1704 (group
1707 (group
1705 (func
1708 (func
1706 ('symbol', 'follow')
1709 ('symbol', 'follow')
1707 ('string', 'a'))))
1710 ('string', 'a'))))
1708
1711
1709 Test --follow and multiple renames
1712 Test --follow and multiple renames
1710
1713
1711 $ hg up -q tip
1714 $ hg up -q tip
1712 $ testlog -f e
1715 $ testlog -f e
1713 []
1716 []
1714 (group
1717 (group
1715 (group
1718 (group
1716 (func
1719 (func
1717 ('symbol', 'follow')
1720 ('symbol', 'follow')
1718 ('string', 'e'))))
1721 ('string', 'e'))))
1719
1722
1720 Test --follow and multiple filelog heads
1723 Test --follow and multiple filelog heads
1721
1724
1722 $ hg up -q 2
1725 $ hg up -q 2
1723 $ testlog -f g
1726 $ testlog -f g
1724 []
1727 []
1725 (group
1728 (group
1726 (group
1729 (group
1727 (func
1730 (func
1728 ('symbol', 'follow')
1731 ('symbol', 'follow')
1729 ('string', 'g'))))
1732 ('string', 'g'))))
1730 $ cat log.nodes
1733 $ cat log.nodes
1731 nodetag 2
1734 nodetag 2
1732 nodetag 1
1735 nodetag 1
1733 nodetag 0
1736 nodetag 0
1734 $ hg up -q tip
1737 $ hg up -q tip
1735 $ testlog -f g
1738 $ testlog -f g
1736 []
1739 []
1737 (group
1740 (group
1738 (group
1741 (group
1739 (func
1742 (func
1740 ('symbol', 'follow')
1743 ('symbol', 'follow')
1741 ('string', 'g'))))
1744 ('string', 'g'))))
1742 $ cat log.nodes
1745 $ cat log.nodes
1743 nodetag 3
1746 nodetag 3
1744 nodetag 2
1747 nodetag 2
1745 nodetag 0
1748 nodetag 0
1746
1749
1747 Test --follow and multiple files
1750 Test --follow and multiple files
1748
1751
1749 $ testlog -f g e
1752 $ testlog -f g e
1750 []
1753 []
1751 (group
1754 (group
1752 (group
1755 (group
1753 (or
1756 (or
1754 (func
1757 (func
1755 ('symbol', 'follow')
1758 ('symbol', 'follow')
1756 ('string', 'g'))
1759 ('string', 'g'))
1757 (func
1760 (func
1758 ('symbol', 'follow')
1761 ('symbol', 'follow')
1759 ('string', 'e')))))
1762 ('string', 'e')))))
1760 $ cat log.nodes
1763 $ cat log.nodes
1761 nodetag 4
1764 nodetag 4
1762 nodetag 3
1765 nodetag 3
1763 nodetag 2
1766 nodetag 2
1764 nodetag 1
1767 nodetag 1
1765 nodetag 0
1768 nodetag 0
1766
1769
1767 Test --follow-first
1770 Test --follow-first
1768
1771
1769 $ hg up -q 3
1772 $ hg up -q 3
1770 $ echo ee > e
1773 $ echo ee > e
1771 $ hg ci -Am "add another e" e
1774 $ hg ci -Am "add another e" e
1772 created new head
1775 created new head
1773 $ hg merge --tool internal:other 4
1776 $ hg merge --tool internal:other 4
1774 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1777 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
1775 (branch merge, don't forget to commit)
1778 (branch merge, don't forget to commit)
1776 $ echo merge > e
1779 $ echo merge > e
1777 $ hg ci -m "merge 5 and 4"
1780 $ hg ci -m "merge 5 and 4"
1778 $ testlog --follow-first
1781 $ testlog --follow-first
1779 []
1782 []
1780 (group
1783 (group
1781 (func
1784 (func
1782 ('symbol', '_firstancestors')
1785 ('symbol', '_firstancestors')
1783 (func
1786 (func
1784 ('symbol', 'rev')
1787 ('symbol', 'rev')
1785 ('symbol', '6'))))
1788 ('symbol', '6'))))
1786
1789
1787 Cannot compare with log --follow-first FILE as it never worked
1790 Cannot compare with log --follow-first FILE as it never worked
1788
1791
1789 $ hg log -G --print-revset --follow-first e
1792 $ hg log -G --print-revset --follow-first e
1790 []
1793 []
1791 (group
1794 (group
1792 (group
1795 (group
1793 (func
1796 (func
1794 ('symbol', '_followfirst')
1797 ('symbol', '_followfirst')
1795 ('string', 'e'))))
1798 ('string', 'e'))))
1796 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1799 $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n'
1797 @ 6 merge 5 and 4
1800 @ 6 merge 5 and 4
1798 |\
1801 |\
1799 o | 5 add another e
1802 o | 5 add another e
1800 | |
1803 | |
1801
1804
1802 Test --copies
1805 Test --copies
1803
1806
1804 $ hg log -G --copies --template "{rev} {desc|firstline} \
1807 $ hg log -G --copies --template "{rev} {desc|firstline} \
1805 > copies: {file_copies_switch}\n"
1808 > copies: {file_copies_switch}\n"
1806 @ 6 merge 5 and 4 copies:
1809 @ 6 merge 5 and 4 copies:
1807 |\
1810 |\
1808 | o 5 add another e copies:
1811 | o 5 add another e copies:
1809 | |
1812 | |
1810 o | 4 mv dir/b e copies: e (dir/b)
1813 o | 4 mv dir/b e copies: e (dir/b)
1811 |/
1814 |/
1812 o 3 mv a b; add d copies: b (a)g (f)
1815 o 3 mv a b; add d copies: b (a)g (f)
1813 |
1816 |
1814 o 2 mv b dir/b copies: dir/b (b)
1817 o 2 mv b dir/b copies: dir/b (b)
1815 |
1818 |
1816 o 1 copy a b copies: b (a)g (f)
1819 o 1 copy a b copies: b (a)g (f)
1817 |
1820 |
1818 o 0 add a copies:
1821 o 0 add a copies:
1819
1822
1820 Test "set:..." and parent revision
1823 Test "set:..." and parent revision
1821
1824
1822 $ hg up -q 4
1825 $ hg up -q 4
1823 $ testlog "set:copied()"
1826 $ testlog "set:copied()"
1824 []
1827 []
1825 (group
1828 (group
1826 (func
1829 (func
1827 ('symbol', '_matchfiles')
1830 ('symbol', '_matchfiles')
1828 (list
1831 (list
1829 (list
1832 (list
1830 ('string', 'r:')
1833 ('string', 'r:')
1831 ('string', 'd:relpath'))
1834 ('string', 'd:relpath'))
1832 ('string', 'p:set:copied()'))))
1835 ('string', 'p:set:copied()'))))
1833 $ testlog --include "set:copied()"
1836 $ testlog --include "set:copied()"
1834 []
1837 []
1835 (group
1838 (group
1836 (func
1839 (func
1837 ('symbol', '_matchfiles')
1840 ('symbol', '_matchfiles')
1838 (list
1841 (list
1839 (list
1842 (list
1840 ('string', 'r:')
1843 ('string', 'r:')
1841 ('string', 'd:relpath'))
1844 ('string', 'd:relpath'))
1842 ('string', 'i:set:copied()'))))
1845 ('string', 'i:set:copied()'))))
1843 $ testlog -r "sort(file('set:copied()'), -rev)"
1846 $ testlog -r "sort(file('set:copied()'), -rev)"
1844 ["sort(file('set:copied()'), -rev)"]
1847 ["sort(file('set:copied()'), -rev)"]
1845 []
1848 []
1846
1849
1847 Test --removed
1850 Test --removed
1848
1851
1849 $ testlog --removed
1852 $ testlog --removed
1850 []
1853 []
1851 []
1854 []
1852 $ testlog --removed a
1855 $ testlog --removed a
1853 []
1856 []
1854 (group
1857 (group
1855 (func
1858 (func
1856 ('symbol', '_matchfiles')
1859 ('symbol', '_matchfiles')
1857 (list
1860 (list
1858 (list
1861 (list
1859 ('string', 'r:')
1862 ('string', 'r:')
1860 ('string', 'd:relpath'))
1863 ('string', 'd:relpath'))
1861 ('string', 'p:a'))))
1864 ('string', 'p:a'))))
1862 $ testlog --removed --follow a
1865 $ testlog --removed --follow a
1863 []
1866 []
1864 (group
1867 (group
1865 (and
1868 (and
1866 (func
1869 (func
1867 ('symbol', 'ancestors')
1870 ('symbol', 'ancestors')
1868 ('symbol', '.'))
1871 ('symbol', '.'))
1869 (func
1872 (func
1870 ('symbol', '_matchfiles')
1873 ('symbol', '_matchfiles')
1871 (list
1874 (list
1872 (list
1875 (list
1873 ('string', 'r:')
1876 ('string', 'r:')
1874 ('string', 'd:relpath'))
1877 ('string', 'd:relpath'))
1875 ('string', 'p:a')))))
1878 ('string', 'p:a')))))
1876
1879
1877 Test --patch and --stat with --follow and --follow-first
1880 Test --patch and --stat with --follow and --follow-first
1878
1881
1879 $ hg up -q 3
1882 $ hg up -q 3
1880 $ hg log -G --git --patch b
1883 $ hg log -G --git --patch b
1881 o changeset: 1:216d4c92cf98
1884 o changeset: 1:216d4c92cf98
1882 | user: test
1885 | user: test
1883 | date: Thu Jan 01 00:00:00 1970 +0000
1886 | date: Thu Jan 01 00:00:00 1970 +0000
1884 | summary: copy a b
1887 | summary: copy a b
1885 |
1888 |
1886 | diff --git a/a b/b
1889 | diff --git a/a b/b
1887 | copy from a
1890 | copy from a
1888 | copy to b
1891 | copy to b
1889 |
1892 |
1890
1893
1891 $ hg log -G --git --stat b
1894 $ hg log -G --git --stat b
1892 o changeset: 1:216d4c92cf98
1895 o changeset: 1:216d4c92cf98
1893 | user: test
1896 | user: test
1894 | date: Thu Jan 01 00:00:00 1970 +0000
1897 | date: Thu Jan 01 00:00:00 1970 +0000
1895 | summary: copy a b
1898 | summary: copy a b
1896 |
1899 |
1897 | b | 0
1900 | b | 0
1898 | 1 files changed, 0 insertions(+), 0 deletions(-)
1901 | 1 files changed, 0 insertions(+), 0 deletions(-)
1899 |
1902 |
1900
1903
1901 $ hg log -G --git --patch --follow b
1904 $ hg log -G --git --patch --follow b
1902 o changeset: 1:216d4c92cf98
1905 o changeset: 1:216d4c92cf98
1903 | user: test
1906 | user: test
1904 | date: Thu Jan 01 00:00:00 1970 +0000
1907 | date: Thu Jan 01 00:00:00 1970 +0000
1905 | summary: copy a b
1908 | summary: copy a b
1906 |
1909 |
1907 | diff --git a/a b/b
1910 | diff --git a/a b/b
1908 | copy from a
1911 | copy from a
1909 | copy to b
1912 | copy to b
1910 |
1913 |
1911 o changeset: 0:f8035bb17114
1914 o changeset: 0:f8035bb17114
1912 user: test
1915 user: test
1913 date: Thu Jan 01 00:00:00 1970 +0000
1916 date: Thu Jan 01 00:00:00 1970 +0000
1914 summary: add a
1917 summary: add a
1915
1918
1916 diff --git a/a b/a
1919 diff --git a/a b/a
1917 new file mode 100644
1920 new file mode 100644
1918 --- /dev/null
1921 --- /dev/null
1919 +++ b/a
1922 +++ b/a
1920 @@ -0,0 +1,1 @@
1923 @@ -0,0 +1,1 @@
1921 +a
1924 +a
1922
1925
1923
1926
1924 $ hg log -G --git --stat --follow b
1927 $ hg log -G --git --stat --follow b
1925 o changeset: 1:216d4c92cf98
1928 o changeset: 1:216d4c92cf98
1926 | user: test
1929 | user: test
1927 | date: Thu Jan 01 00:00:00 1970 +0000
1930 | date: Thu Jan 01 00:00:00 1970 +0000
1928 | summary: copy a b
1931 | summary: copy a b
1929 |
1932 |
1930 | b | 0
1933 | b | 0
1931 | 1 files changed, 0 insertions(+), 0 deletions(-)
1934 | 1 files changed, 0 insertions(+), 0 deletions(-)
1932 |
1935 |
1933 o changeset: 0:f8035bb17114
1936 o changeset: 0:f8035bb17114
1934 user: test
1937 user: test
1935 date: Thu Jan 01 00:00:00 1970 +0000
1938 date: Thu Jan 01 00:00:00 1970 +0000
1936 summary: add a
1939 summary: add a
1937
1940
1938 a | 1 +
1941 a | 1 +
1939 1 files changed, 1 insertions(+), 0 deletions(-)
1942 1 files changed, 1 insertions(+), 0 deletions(-)
1940
1943
1941
1944
1942 $ hg up -q 6
1945 $ hg up -q 6
1943 $ hg log -G --git --patch --follow-first e
1946 $ hg log -G --git --patch --follow-first e
1944 @ changeset: 6:fc281d8ff18d
1947 @ changeset: 6:fc281d8ff18d
1945 |\ tag: tip
1948 |\ tag: tip
1946 | | parent: 5:99b31f1c2782
1949 | | parent: 5:99b31f1c2782
1947 | | parent: 4:17d952250a9d
1950 | | parent: 4:17d952250a9d
1948 | | user: test
1951 | | user: test
1949 | | date: Thu Jan 01 00:00:00 1970 +0000
1952 | | date: Thu Jan 01 00:00:00 1970 +0000
1950 | | summary: merge 5 and 4
1953 | | summary: merge 5 and 4
1951 | |
1954 | |
1952 | | diff --git a/e b/e
1955 | | diff --git a/e b/e
1953 | | --- a/e
1956 | | --- a/e
1954 | | +++ b/e
1957 | | +++ b/e
1955 | | @@ -1,1 +1,1 @@
1958 | | @@ -1,1 +1,1 @@
1956 | | -ee
1959 | | -ee
1957 | | +merge
1960 | | +merge
1958 | |
1961 | |
1959 o | changeset: 5:99b31f1c2782
1962 o | changeset: 5:99b31f1c2782
1960 | | parent: 3:5918b8d165d1
1963 | | parent: 3:5918b8d165d1
1961 | | user: test
1964 | | user: test
1962 | | date: Thu Jan 01 00:00:00 1970 +0000
1965 | | date: Thu Jan 01 00:00:00 1970 +0000
1963 | | summary: add another e
1966 | | summary: add another e
1964 | |
1967 | |
1965 | | diff --git a/e b/e
1968 | | diff --git a/e b/e
1966 | | new file mode 100644
1969 | | new file mode 100644
1967 | | --- /dev/null
1970 | | --- /dev/null
1968 | | +++ b/e
1971 | | +++ b/e
1969 | | @@ -0,0 +1,1 @@
1972 | | @@ -0,0 +1,1 @@
1970 | | +ee
1973 | | +ee
1971 | |
1974 | |
1972
1975
1973 Test old-style --rev
1976 Test old-style --rev
1974
1977
1975 $ hg tag 'foo-bar'
1978 $ hg tag 'foo-bar'
1976 $ testlog -r 'foo-bar'
1979 $ testlog -r 'foo-bar'
1977 ['foo-bar']
1980 ['foo-bar']
1978 []
1981 []
1979
1982
1980 Test --follow and forward --rev
1983 Test --follow and forward --rev
1981
1984
1982 $ hg up -q 6
1985 $ hg up -q 6
1983 $ echo g > g
1986 $ echo g > g
1984 $ hg ci -Am 'add g' g
1987 $ hg ci -Am 'add g' g
1985 created new head
1988 created new head
1986 $ hg up -q 2
1989 $ hg up -q 2
1987 $ hg log -G --template "{rev} {desc|firstline}\n"
1990 $ hg log -G --template "{rev} {desc|firstline}\n"
1988 o 8 add g
1991 o 8 add g
1989 |
1992 |
1990 | o 7 Added tag foo-bar for changeset fc281d8ff18d
1993 | o 7 Added tag foo-bar for changeset fc281d8ff18d
1991 |/
1994 |/
1992 o 6 merge 5 and 4
1995 o 6 merge 5 and 4
1993 |\
1996 |\
1994 | o 5 add another e
1997 | o 5 add another e
1995 | |
1998 | |
1996 o | 4 mv dir/b e
1999 o | 4 mv dir/b e
1997 |/
2000 |/
1998 o 3 mv a b; add d
2001 o 3 mv a b; add d
1999 |
2002 |
2000 @ 2 mv b dir/b
2003 @ 2 mv b dir/b
2001 |
2004 |
2002 o 1 copy a b
2005 o 1 copy a b
2003 |
2006 |
2004 o 0 add a
2007 o 0 add a
2005
2008
2006 $ hg export 'all()'
2009 $ hg export 'all()'
2007 # HG changeset patch
2010 # HG changeset patch
2008 # User test
2011 # User test
2009 # Date 0 0
2012 # Date 0 0
2010 # Thu Jan 01 00:00:00 1970 +0000
2013 # Thu Jan 01 00:00:00 1970 +0000
2011 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2014 # Node ID f8035bb17114da16215af3436ec5222428ace8ee
2012 # Parent 0000000000000000000000000000000000000000
2015 # Parent 0000000000000000000000000000000000000000
2013 add a
2016 add a
2014
2017
2015 diff -r 000000000000 -r f8035bb17114 a
2018 diff -r 000000000000 -r f8035bb17114 a
2016 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2019 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2017 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2020 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2018 @@ -0,0 +1,1 @@
2021 @@ -0,0 +1,1 @@
2019 +a
2022 +a
2020 diff -r 000000000000 -r f8035bb17114 aa
2023 diff -r 000000000000 -r f8035bb17114 aa
2021 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2024 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2022 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2025 +++ b/aa Thu Jan 01 00:00:00 1970 +0000
2023 @@ -0,0 +1,1 @@
2026 @@ -0,0 +1,1 @@
2024 +aa
2027 +aa
2025 diff -r 000000000000 -r f8035bb17114 f
2028 diff -r 000000000000 -r f8035bb17114 f
2026 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2029 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2027 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2030 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2028 @@ -0,0 +1,1 @@
2031 @@ -0,0 +1,1 @@
2029 +f
2032 +f
2030 # HG changeset patch
2033 # HG changeset patch
2031 # User test
2034 # User test
2032 # Date 0 0
2035 # Date 0 0
2033 # Thu Jan 01 00:00:00 1970 +0000
2036 # Thu Jan 01 00:00:00 1970 +0000
2034 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2037 # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92
2035 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2038 # Parent f8035bb17114da16215af3436ec5222428ace8ee
2036 copy a b
2039 copy a b
2037
2040
2038 diff -r f8035bb17114 -r 216d4c92cf98 b
2041 diff -r f8035bb17114 -r 216d4c92cf98 b
2039 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2042 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2040 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2043 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2041 @@ -0,0 +1,1 @@
2044 @@ -0,0 +1,1 @@
2042 +a
2045 +a
2043 diff -r f8035bb17114 -r 216d4c92cf98 g
2046 diff -r f8035bb17114 -r 216d4c92cf98 g
2044 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2047 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2045 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2048 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2046 @@ -0,0 +1,1 @@
2049 @@ -0,0 +1,1 @@
2047 +f
2050 +f
2048 # HG changeset patch
2051 # HG changeset patch
2049 # User test
2052 # User test
2050 # Date 0 0
2053 # Date 0 0
2051 # Thu Jan 01 00:00:00 1970 +0000
2054 # Thu Jan 01 00:00:00 1970 +0000
2052 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2055 # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2053 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2056 # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92
2054 mv b dir/b
2057 mv b dir/b
2055
2058
2056 diff -r 216d4c92cf98 -r bb573313a9e8 b
2059 diff -r 216d4c92cf98 -r bb573313a9e8 b
2057 --- a/b Thu Jan 01 00:00:00 1970 +0000
2060 --- a/b Thu Jan 01 00:00:00 1970 +0000
2058 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2061 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2059 @@ -1,1 +0,0 @@
2062 @@ -1,1 +0,0 @@
2060 -a
2063 -a
2061 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2064 diff -r 216d4c92cf98 -r bb573313a9e8 dir/b
2062 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2065 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2063 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2066 +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000
2064 @@ -0,0 +1,1 @@
2067 @@ -0,0 +1,1 @@
2065 +a
2068 +a
2066 diff -r 216d4c92cf98 -r bb573313a9e8 f
2069 diff -r 216d4c92cf98 -r bb573313a9e8 f
2067 --- a/f Thu Jan 01 00:00:00 1970 +0000
2070 --- a/f Thu Jan 01 00:00:00 1970 +0000
2068 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2071 +++ b/f Thu Jan 01 00:00:00 1970 +0000
2069 @@ -1,1 +1,2 @@
2072 @@ -1,1 +1,2 @@
2070 f
2073 f
2071 +f
2074 +f
2072 diff -r 216d4c92cf98 -r bb573313a9e8 g
2075 diff -r 216d4c92cf98 -r bb573313a9e8 g
2073 --- a/g Thu Jan 01 00:00:00 1970 +0000
2076 --- a/g Thu Jan 01 00:00:00 1970 +0000
2074 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2077 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2075 @@ -1,1 +1,2 @@
2078 @@ -1,1 +1,2 @@
2076 f
2079 f
2077 +g
2080 +g
2078 # HG changeset patch
2081 # HG changeset patch
2079 # User test
2082 # User test
2080 # Date 0 0
2083 # Date 0 0
2081 # Thu Jan 01 00:00:00 1970 +0000
2084 # Thu Jan 01 00:00:00 1970 +0000
2082 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2085 # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2083 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2086 # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3
2084 mv a b; add d
2087 mv a b; add d
2085
2088
2086 diff -r bb573313a9e8 -r 5918b8d165d1 a
2089 diff -r bb573313a9e8 -r 5918b8d165d1 a
2087 --- a/a Thu Jan 01 00:00:00 1970 +0000
2090 --- a/a Thu Jan 01 00:00:00 1970 +0000
2088 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2091 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2089 @@ -1,1 +0,0 @@
2092 @@ -1,1 +0,0 @@
2090 -a
2093 -a
2091 diff -r bb573313a9e8 -r 5918b8d165d1 b
2094 diff -r bb573313a9e8 -r 5918b8d165d1 b
2092 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2095 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2093 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2096 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2094 @@ -0,0 +1,1 @@
2097 @@ -0,0 +1,1 @@
2095 +a
2098 +a
2096 diff -r bb573313a9e8 -r 5918b8d165d1 d
2099 diff -r bb573313a9e8 -r 5918b8d165d1 d
2097 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2100 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2098 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2101 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2099 @@ -0,0 +1,1 @@
2102 @@ -0,0 +1,1 @@
2100 +a
2103 +a
2101 diff -r bb573313a9e8 -r 5918b8d165d1 g
2104 diff -r bb573313a9e8 -r 5918b8d165d1 g
2102 --- a/g Thu Jan 01 00:00:00 1970 +0000
2105 --- a/g Thu Jan 01 00:00:00 1970 +0000
2103 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2106 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2104 @@ -1,2 +1,2 @@
2107 @@ -1,2 +1,2 @@
2105 f
2108 f
2106 -g
2109 -g
2107 +f
2110 +f
2108 # HG changeset patch
2111 # HG changeset patch
2109 # User test
2112 # User test
2110 # Date 0 0
2113 # Date 0 0
2111 # Thu Jan 01 00:00:00 1970 +0000
2114 # Thu Jan 01 00:00:00 1970 +0000
2112 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2115 # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260
2113 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2116 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2114 mv dir/b e
2117 mv dir/b e
2115
2118
2116 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2119 diff -r 5918b8d165d1 -r 17d952250a9d dir/b
2117 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2120 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2118 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2121 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2119 @@ -1,1 +0,0 @@
2122 @@ -1,1 +0,0 @@
2120 -a
2123 -a
2121 diff -r 5918b8d165d1 -r 17d952250a9d e
2124 diff -r 5918b8d165d1 -r 17d952250a9d e
2122 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2125 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2123 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2126 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2124 @@ -0,0 +1,1 @@
2127 @@ -0,0 +1,1 @@
2125 +a
2128 +a
2126 # HG changeset patch
2129 # HG changeset patch
2127 # User test
2130 # User test
2128 # Date 0 0
2131 # Date 0 0
2129 # Thu Jan 01 00:00:00 1970 +0000
2132 # Thu Jan 01 00:00:00 1970 +0000
2130 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2133 # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b
2131 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2134 # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed
2132 add another e
2135 add another e
2133
2136
2134 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2137 diff -r 5918b8d165d1 -r 99b31f1c2782 e
2135 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2138 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2136 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2139 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2137 @@ -0,0 +1,1 @@
2140 @@ -0,0 +1,1 @@
2138 +ee
2141 +ee
2139 # HG changeset patch
2142 # HG changeset patch
2140 # User test
2143 # User test
2141 # Date 0 0
2144 # Date 0 0
2142 # Thu Jan 01 00:00:00 1970 +0000
2145 # Thu Jan 01 00:00:00 1970 +0000
2143 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2146 # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73
2144 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2147 # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b
2145 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2148 # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260
2146 merge 5 and 4
2149 merge 5 and 4
2147
2150
2148 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2151 diff -r 99b31f1c2782 -r fc281d8ff18d dir/b
2149 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2152 --- a/dir/b Thu Jan 01 00:00:00 1970 +0000
2150 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2153 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2151 @@ -1,1 +0,0 @@
2154 @@ -1,1 +0,0 @@
2152 -a
2155 -a
2153 diff -r 99b31f1c2782 -r fc281d8ff18d e
2156 diff -r 99b31f1c2782 -r fc281d8ff18d e
2154 --- a/e Thu Jan 01 00:00:00 1970 +0000
2157 --- a/e Thu Jan 01 00:00:00 1970 +0000
2155 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2158 +++ b/e Thu Jan 01 00:00:00 1970 +0000
2156 @@ -1,1 +1,1 @@
2159 @@ -1,1 +1,1 @@
2157 -ee
2160 -ee
2158 +merge
2161 +merge
2159 # HG changeset patch
2162 # HG changeset patch
2160 # User test
2163 # User test
2161 # Date 0 0
2164 # Date 0 0
2162 # Thu Jan 01 00:00:00 1970 +0000
2165 # Thu Jan 01 00:00:00 1970 +0000
2163 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2166 # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd
2164 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2167 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2165 Added tag foo-bar for changeset fc281d8ff18d
2168 Added tag foo-bar for changeset fc281d8ff18d
2166
2169
2167 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2170 diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags
2168 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2171 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2169 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2172 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
2170 @@ -0,0 +1,1 @@
2173 @@ -0,0 +1,1 @@
2171 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2174 +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar
2172 # HG changeset patch
2175 # HG changeset patch
2173 # User test
2176 # User test
2174 # Date 0 0
2177 # Date 0 0
2175 # Thu Jan 01 00:00:00 1970 +0000
2178 # Thu Jan 01 00:00:00 1970 +0000
2176 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2179 # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449
2177 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2180 # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73
2178 add g
2181 add g
2179
2182
2180 diff -r fc281d8ff18d -r 24c2e826ddeb g
2183 diff -r fc281d8ff18d -r 24c2e826ddeb g
2181 --- a/g Thu Jan 01 00:00:00 1970 +0000
2184 --- a/g Thu Jan 01 00:00:00 1970 +0000
2182 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2185 +++ b/g Thu Jan 01 00:00:00 1970 +0000
2183 @@ -1,2 +1,1 @@
2186 @@ -1,2 +1,1 @@
2184 -f
2187 -f
2185 -f
2188 -f
2186 +g
2189 +g
2187 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2190 $ testlog --follow -r6 -r8 -r5 -r7 -r4
2188 ['6', '8', '5', '7', '4']
2191 ['6', '8', '5', '7', '4']
2189 (group
2192 (group
2190 (func
2193 (func
2191 ('symbol', 'descendants')
2194 ('symbol', 'descendants')
2192 (func
2195 (func
2193 ('symbol', 'rev')
2196 ('symbol', 'rev')
2194 ('symbol', '6'))))
2197 ('symbol', '6'))))
2195 --- log.nodes * (glob)
2198 --- log.nodes * (glob)
2196 +++ glog.nodes * (glob)
2199 +++ glog.nodes * (glob)
2197 @@ -1,3 +1,3 @@
2200 @@ -1,3 +1,3 @@
2198 -nodetag 6
2201 -nodetag 6
2199 nodetag 8
2202 nodetag 8
2200 nodetag 7
2203 nodetag 7
2201 +nodetag 6
2204 +nodetag 6
2202
2205
2203 Test --follow-first and forward --rev
2206 Test --follow-first and forward --rev
2204
2207
2205 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2208 $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
2206 ['6', '8', '5', '7', '4']
2209 ['6', '8', '5', '7', '4']
2207 (group
2210 (group
2208 (func
2211 (func
2209 ('symbol', '_firstdescendants')
2212 ('symbol', '_firstdescendants')
2210 (func
2213 (func
2211 ('symbol', 'rev')
2214 ('symbol', 'rev')
2212 ('symbol', '6'))))
2215 ('symbol', '6'))))
2213 --- log.nodes * (glob)
2216 --- log.nodes * (glob)
2214 +++ glog.nodes * (glob)
2217 +++ glog.nodes * (glob)
2215 @@ -1,3 +1,3 @@
2218 @@ -1,3 +1,3 @@
2216 -nodetag 6
2219 -nodetag 6
2217 nodetag 8
2220 nodetag 8
2218 nodetag 7
2221 nodetag 7
2219 +nodetag 6
2222 +nodetag 6
2220
2223
2221 Test --follow and backward --rev
2224 Test --follow and backward --rev
2222
2225
2223 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2226 $ testlog --follow -r6 -r5 -r7 -r8 -r4
2224 ['6', '5', '7', '8', '4']
2227 ['6', '5', '7', '8', '4']
2225 (group
2228 (group
2226 (func
2229 (func
2227 ('symbol', 'ancestors')
2230 ('symbol', 'ancestors')
2228 (func
2231 (func
2229 ('symbol', 'rev')
2232 ('symbol', 'rev')
2230 ('symbol', '6'))))
2233 ('symbol', '6'))))
2231
2234
2232 Test --follow-first and backward --rev
2235 Test --follow-first and backward --rev
2233
2236
2234 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2237 $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
2235 ['6', '5', '7', '8', '4']
2238 ['6', '5', '7', '8', '4']
2236 (group
2239 (group
2237 (func
2240 (func
2238 ('symbol', '_firstancestors')
2241 ('symbol', '_firstancestors')
2239 (func
2242 (func
2240 ('symbol', 'rev')
2243 ('symbol', 'rev')
2241 ('symbol', '6'))))
2244 ('symbol', '6'))))
2242
2245
2243 Test subdir
2246 Test subdir
2244
2247
2245 $ hg up -q 3
2248 $ hg up -q 3
2246 $ cd dir
2249 $ cd dir
2247 $ testlog .
2250 $ testlog .
2248 []
2251 []
2249 (group
2252 (group
2250 (func
2253 (func
2251 ('symbol', '_matchfiles')
2254 ('symbol', '_matchfiles')
2252 (list
2255 (list
2253 (list
2256 (list
2254 ('string', 'r:')
2257 ('string', 'r:')
2255 ('string', 'd:relpath'))
2258 ('string', 'd:relpath'))
2256 ('string', 'p:.'))))
2259 ('string', 'p:.'))))
2257 $ testlog ../b
2260 $ testlog ../b
2258 []
2261 []
2259 (group
2262 (group
2260 (group
2263 (group
2261 (func
2264 (func
2262 ('symbol', 'filelog')
2265 ('symbol', 'filelog')
2263 ('string', '../b'))))
2266 ('string', '../b'))))
2264 $ testlog -f ../b
2267 $ testlog -f ../b
2265 []
2268 []
2266 (group
2269 (group
2267 (group
2270 (group
2268 (func
2271 (func
2269 ('symbol', 'follow')
2272 ('symbol', 'follow')
2270 ('string', 'b'))))
2273 ('string', 'b'))))
2271 $ cd ..
2274 $ cd ..
2272
2275
2273 Test --hidden
2276 Test --hidden
2274 (enable obsolete)
2277 (enable obsolete)
2275
2278
2276 $ cat >> $HGRCPATH << EOF
2279 $ cat >> $HGRCPATH << EOF
2277 > [experimental]
2280 > [experimental]
2278 > evolution=createmarkers
2281 > evolution=createmarkers
2279 > EOF
2282 > EOF
2280
2283
2281 $ hg debugobsolete `hg id --debug -i -r 8`
2284 $ hg debugobsolete `hg id --debug -i -r 8`
2282 $ testlog
2285 $ testlog
2283 []
2286 []
2284 []
2287 []
2285 $ testlog --hidden
2288 $ testlog --hidden
2286 []
2289 []
2287 []
2290 []
2288 $ hg log -G --template '{rev} {desc}\n'
2291 $ hg log -G --template '{rev} {desc}\n'
2289 o 7 Added tag foo-bar for changeset fc281d8ff18d
2292 o 7 Added tag foo-bar for changeset fc281d8ff18d
2290 |
2293 |
2291 o 6 merge 5 and 4
2294 o 6 merge 5 and 4
2292 |\
2295 |\
2293 | o 5 add another e
2296 | o 5 add another e
2294 | |
2297 | |
2295 o | 4 mv dir/b e
2298 o | 4 mv dir/b e
2296 |/
2299 |/
2297 @ 3 mv a b; add d
2300 @ 3 mv a b; add d
2298 |
2301 |
2299 o 2 mv b dir/b
2302 o 2 mv b dir/b
2300 |
2303 |
2301 o 1 copy a b
2304 o 1 copy a b
2302 |
2305 |
2303 o 0 add a
2306 o 0 add a
2304
2307
2305
2308
2306 A template without trailing newline should do something sane
2309 A template without trailing newline should do something sane
2307
2310
2308 $ hg log -G -r ::2 --template '{rev} {desc}'
2311 $ hg log -G -r ::2 --template '{rev} {desc}'
2309 o 2 mv b dir/b
2312 o 2 mv b dir/b
2310 |
2313 |
2311 o 1 copy a b
2314 o 1 copy a b
2312 |
2315 |
2313 o 0 add a
2316 o 0 add a
2314
2317
2315
2318
2316 Extra newlines must be preserved
2319 Extra newlines must be preserved
2317
2320
2318 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2321 $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n'
2319 o
2322 o
2320 | 2 mv b dir/b
2323 | 2 mv b dir/b
2321 |
2324 |
2322 o
2325 o
2323 | 1 copy a b
2326 | 1 copy a b
2324 |
2327 |
2325 o
2328 o
2326 0 add a
2329 0 add a
2327
2330
2328
2331
2329 The almost-empty template should do something sane too ...
2332 The almost-empty template should do something sane too ...
2330
2333
2331 $ hg log -G -r ::2 --template '\n'
2334 $ hg log -G -r ::2 --template '\n'
2332 o
2335 o
2333 |
2336 |
2334 o
2337 o
2335 |
2338 |
2336 o
2339 o
2337
2340
2338
2341
2339 issue3772
2342 issue3772
2340
2343
2341 $ hg log -G -r :null
2344 $ hg log -G -r :null
2342 o changeset: 0:f8035bb17114
2345 o changeset: 0:f8035bb17114
2343 | user: test
2346 | user: test
2344 | date: Thu Jan 01 00:00:00 1970 +0000
2347 | date: Thu Jan 01 00:00:00 1970 +0000
2345 | summary: add a
2348 | summary: add a
2346 |
2349 |
2347 o changeset: -1:000000000000
2350 o changeset: -1:000000000000
2348 user:
2351 user:
2349 date: Thu Jan 01 00:00:00 1970 +0000
2352 date: Thu Jan 01 00:00:00 1970 +0000
2350
2353
2351 $ hg log -G -r null:null
2354 $ hg log -G -r null:null
2352 o changeset: -1:000000000000
2355 o changeset: -1:000000000000
2353 user:
2356 user:
2354 date: Thu Jan 01 00:00:00 1970 +0000
2357 date: Thu Jan 01 00:00:00 1970 +0000
2355
2358
2356
2359
2357 $ cd ..
2360 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now