Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 612:9cd745437269
On Sat, Jul 02, 2005 at 02:11:34PM -0700, Matt Mackall wrote:
# HG changeset patch
# User Alecs King <alecsk@gmail.com>
On Sat, Jul 02, 2005 at 02:11:34PM -0700, Matt Mackall wrote:
> On Sun, Jul 03, 2005 at 12:49:27AM +0800, Alecs King wrote:
> > Hg is really very nice. The only feature i miss from git is the
> > whatchanged -p, which shows a diff along with a changeset.
> > python before, i just dig into the mercurial/commands.py a while and
> > see what diff(), dodiff(), export(), show_changeset(), log() would
> > normally do. There might be one thing or two missed or wrong. But here
> > it is: a '-d' option to 'hg log' showing the diff info. You can use 'hg
> > log -d' to show the whole history with the diff or 'hg log -d <file>' to
> > show that info of a particular file. And also works with the '-r'
> > option.
>
> Let's use -p. We're going to be combining the global and per command
> switch namespace shortly and the global -p will disappear.
Okay. '-d' changed to '-p'. Just like 'whatchanged -p', now we have
'hg log -p'.
> Also, the argument list for show_changeset is getting a bit unwieldy.
This time i remain show_changeset untouched at all. Only changed some
bits of log().
author | Alecs King <alecsk@gmail.com> |
---|---|
date | Mon, 04 Jul 2005 12:15:44 -0800 |
parents | 4c02464cb9f0 |
children | 5374955ec5b1 |
comparison
equal
deleted
inserted
replaced
611:48c3eb2bf844 | 612:9cd745437269 |
---|---|
633 repo = hg.repository(ui, ".", create=1) | 633 repo = hg.repository(ui, ".", create=1) |
634 | 634 |
635 def log(ui, repo, f=None, **opts): | 635 def log(ui, repo, f=None, **opts): |
636 """show the revision history of the repository or a single file""" | 636 """show the revision history of the repository or a single file""" |
637 if f: | 637 if f: |
638 filelog = repo.file(relpath(repo, [f])[0]) | 638 files = relpath(repo, [f]) |
639 filelog = repo.file(files[0]) | |
639 log = filelog | 640 log = filelog |
640 lookup = filelog.lookup | 641 lookup = filelog.lookup |
641 else: | 642 else: |
643 files = None | |
642 filelog = None | 644 filelog = None |
643 log = repo.changelog | 645 log = repo.changelog |
644 lookup = repo.lookup | 646 lookup = repo.lookup |
645 revlist = [] | 647 revlist = [] |
646 revs = [log.rev(lookup(rev)) for rev in opts['rev']] | 648 revs = [log.rev(lookup(rev)) for rev in opts['rev']] |
653 off = a > b and -1 or 1 | 655 off = a > b and -1 or 1 |
654 revlist.extend(range(a, b + off, off)) | 656 revlist.extend(range(a, b + off, off)) |
655 | 657 |
656 for i in revlist or range(log.count() - 1, -1, -1): | 658 for i in revlist or range(log.count() - 1, -1, -1): |
657 show_changeset(ui, repo, filelog=filelog, rev=i) | 659 show_changeset(ui, repo, filelog=filelog, rev=i) |
660 if opts['patch']: | |
661 if filelog: | |
662 filenode = filelog.node(i) | |
663 i = filelog.linkrev(filenode) | |
664 changenode = repo.changelog.node(i) | |
665 prev, other = repo.changelog.parents(changenode) | |
666 dodiff(sys.stdout, ui, repo, files, prev, changenode) | |
667 ui.write("\n") | |
668 ui.write("\n") | |
658 | 669 |
659 def manifest(ui, repo, rev = []): | 670 def manifest(ui, repo, rev = []): |
660 """output the latest or given revision of the project manifest""" | 671 """output the latest or given revision of the project manifest""" |
661 n = repo.manifest.tip() | 672 n = repo.manifest.tip() |
662 if rev: | 673 if rev: |
975 [('p', 'strip', 1, 'path strip'), | 986 [('p', 'strip', 1, 'path strip'), |
976 ('b', 'base', "", 'base path')], | 987 ('b', 'base', "", 'base path')], |
977 "hg import [options] <patches>"), | 988 "hg import [options] <patches>"), |
978 "^init": (init, [], 'hg init'), | 989 "^init": (init, [], 'hg init'), |
979 "^log|history": (log, | 990 "^log|history": (log, |
980 [('r', 'rev', [], 'revision')], | 991 [('r', 'rev', [], 'revision'), |
981 'hg log [-r A] [-r B] [file]'), | 992 ('p', 'patch', None, 'show patch')], |
993 'hg log [-r A] [-r B] [-p] [file]'), | |
982 "manifest": (manifest, [], 'hg manifest [rev]'), | 994 "manifest": (manifest, [], 'hg manifest [rev]'), |
983 "parents": (parents, [], 'hg parents [node]'), | 995 "parents": (parents, [], 'hg parents [node]'), |
984 "^pull": (pull, | 996 "^pull": (pull, |
985 [('u', 'update', None, 'update working directory')], | 997 [('u', 'update', None, 'update working directory')], |
986 'hg pull [options] [source]'), | 998 'hg pull [options] [source]'), |