Show More
@@ -17,7 +17,7 b' from mercurial.commands import templateo' | |||||
17 | from mercurial.i18n import _ |
|
17 | from mercurial.i18n import _ | |
18 | from mercurial.node import nullrev |
|
18 | from mercurial.node import nullrev | |
19 | from mercurial import cmdutil, commands, extensions, scmutil |
|
19 | from mercurial import cmdutil, commands, extensions, scmutil | |
20 | from mercurial import hg, util, graphmod |
|
20 | from mercurial import hg, util, graphmod, templatekw | |
21 |
|
21 | |||
22 | cmdtable = {} |
|
22 | cmdtable = {} | |
23 | command = cmdutil.command(cmdtable) |
|
23 | command = cmdutil.command(cmdtable) | |
@@ -237,7 +237,7 b' def get_revs(repo, rev_opt):' | |||||
237 | return (len(repo) - 1, 0) |
|
237 | return (len(repo) - 1, 0) | |
238 |
|
238 | |||
239 | def check_unsupported_flags(pats, opts): |
|
239 | def check_unsupported_flags(pats, opts): | |
240 |
for op in [" |
|
240 | for op in ["newest_first"]: | |
241 | if op in opts and opts[op]: |
|
241 | if op in opts and opts[op]: | |
242 | raise util.Abort(_("-G/--graph option is incompatible with --%s") |
|
242 | raise util.Abort(_("-G/--graph option is incompatible with --%s") | |
243 | % op.replace("_", "-")) |
|
243 | % op.replace("_", "-")) | |
@@ -350,11 +350,18 b' def revset(repo, pats, opts):' | |||||
350 | revset = 'all()' |
|
350 | revset = 'all()' | |
351 | return revset |
|
351 | return revset | |
352 |
|
352 | |||
353 | def generate(ui, dag, displayer, showparents, edgefn): |
|
353 | def generate(ui, dag, displayer, showparents, edgefn, getrenamed=None): | |
354 | seen, state = [], asciistate() |
|
354 | seen, state = [], asciistate() | |
355 | for rev, type, ctx, parents in dag: |
|
355 | for rev, type, ctx, parents in dag: | |
356 | char = ctx.node() in showparents and '@' or 'o' |
|
356 | char = ctx.node() in showparents and '@' or 'o' | |
357 | displayer.show(ctx) |
|
357 | copies = None | |
|
358 | if getrenamed and ctx.rev(): | |||
|
359 | copies = [] | |||
|
360 | for fn in ctx.files(): | |||
|
361 | rename = getrenamed(fn, ctx.rev()) | |||
|
362 | if rename: | |||
|
363 | copies.append((fn, rename[0])) | |||
|
364 | displayer.show(ctx, copies=copies) | |||
358 | lines = displayer.hunk.pop(rev).split('\n')[:-1] |
|
365 | lines = displayer.hunk.pop(rev).split('\n')[:-1] | |
359 | displayer.flush(rev) |
|
366 | displayer.flush(rev) | |
360 | edges = edgefn(type, char, lines, seen, rev, parents) |
|
367 | edges = edgefn(type, char, lines, seen, rev, parents) | |
@@ -387,9 +394,15 b' def graphlog(ui, repo, *pats, **opts):' | |||||
387 | revs = revs[:limit] |
|
394 | revs = revs[:limit] | |
388 | revdag = graphmod.dagwalker(repo, revs) |
|
395 | revdag = graphmod.dagwalker(repo, revs) | |
389 |
|
396 | |||
|
397 | getrenamed = None | |||
|
398 | if opts.get('copies'): | |||
|
399 | endrev = None | |||
|
400 | if opts.get('rev'): | |||
|
401 | endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1 | |||
|
402 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | |||
390 | displayer = show_changeset(ui, repo, opts, buffered=True) |
|
403 | displayer = show_changeset(ui, repo, opts, buffered=True) | |
391 | showparents = [ctx.node() for ctx in repo[None].parents()] |
|
404 | showparents = [ctx.node() for ctx in repo[None].parents()] | |
392 | generate(ui, revdag, displayer, showparents, asciiedges) |
|
405 | generate(ui, revdag, displayer, showparents, asciiedges, getrenamed) | |
393 |
|
406 | |||
394 | def graphrevs(repo, nodes, opts): |
|
407 | def graphrevs(repo, nodes, opts): | |
395 | limit = cmdutil.loglimit(opts) |
|
408 | limit = cmdutil.loglimit(opts) |
@@ -1642,3 +1642,21 b' Cannot compare with log --follow-first F' | |||||
1642 | o | 5 add another e |
|
1642 | o | 5 add another e | |
1643 | | | |
|
1643 | | | | |
1644 |
|
1644 | |||
|
1645 | Test --copies | |||
|
1646 | ||||
|
1647 | $ hg log -G --copies --template "{rev} {desc|firstline} \ | |||
|
1648 | > copies: {file_copies_switch}\n" | |||
|
1649 | @ 6 merge 5 and 4 copies: | |||
|
1650 | |\ | |||
|
1651 | | o 5 add another e copies: | |||
|
1652 | | | | |||
|
1653 | o | 4 mv dir/b e copies: e (dir/b) | |||
|
1654 | |/ | |||
|
1655 | o 3 mv a b; add d copies: b (a)g (f) | |||
|
1656 | | | |||
|
1657 | o 2 mv b dir/b copies: dir/b (b) | |||
|
1658 | | | |||
|
1659 | o 1 copy a b copies: b (a)g (f) | |||
|
1660 | | | |||
|
1661 | o 0 add a copies: | |||
|
1662 |
General Comments 0
You need to be logged in to leave comments.
Login now