Submitter | Durham Goode |
---|---|
Date | Feb. 27, 2015, 5:54 p.m. |
Message ID | <5e68ecffa023a3413dc5.1425059689@dev2000.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/7848/ |
State | Accepted |
Commit | 8b4b9ee6001ab1818463ecc242bf3989524aea42 |
Headers | show |
Comments
On 2/27/2015 9:54 AM, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1423249495 28800 > # Fri Feb 06 11:04:55 2015 -0800 > # Node ID 5e68ecffa023a3413dc5cba325b79951f7ceb574 > # Parent ff5caa8dfd993680d9602ca6ebb14da9de10d5f4 > log: make -fr show complete history from the given revs > > Right now it's very obtuse to show the history of a particular rev (hg log -r > 'reverse(::foo)'). This changes the -f option to make it follow history for the > revs specified by -r. > > The current -f -r behavior is to limit the result of -r to only the commits that > are ancestors of the current working copy. Changing this is a bit of a BC break, > but the old behavior is A) rare, B) easy to emulate (& ::.), and C) currently > undefined. The new behavior is frequently requested enough that I think the > change is worth it. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -4477,6 +4477,10 @@ def log(ui, repo, *pats, **opts): > Returns 0 on success. > > """ > + if opts.get('follow') and opts.get('rev'): > + opts['rev'] = [revset.formatspec('reverse(::%lr)', opts.get('rev'))] > + del opts['follow'] > + > if opts.get('graph'): > return cmdutil.graphlog(ui, repo, *pats, **opts) > > diff --git a/tests/test-glog.t b/tests/test-glog.t > --- a/tests/test-glog.t > +++ b/tests/test-glog.t > @@ -2202,13 +2202,6 @@ Test --follow and forward --rev > (func > ('symbol', 'rev') > ('symbol', '6')))) > - --- log.nodes * (glob) > - +++ glog.nodes * (glob) > - @@ -1,3 +1,3 @@ > - -nodetag 6 > - nodetag 8 > - nodetag 7 > - +nodetag 6 > > Test --follow-first and forward --rev > > diff --git a/tests/test-log.t b/tests/test-log.t > --- a/tests/test-log.t > +++ b/tests/test-log.t > @@ -631,7 +631,7 @@ log -f > > > > -log -f -r 1:tip > +log -f -r '1 + 4' > > $ hg up -C 0 > 1 files updated, 0 files merged, 1 files removed, 0 files unresolved > @@ -639,25 +639,24 @@ log -f -r 1:tip > $ hg ci -Amb2 -d '1 0' > adding b2 > created new head > - $ hg log -f -r 1:tip > + $ hg log -f -r '1 + 4' > + changeset: 4:ddb82e70d1a1 > + tag: tip > + parent: 0:67e992f2c4f3 > + user: test > + date: Thu Jan 01 00:00:01 1970 +0000 > + summary: b2 > + > changeset: 1:3d5bf5654eda > user: test > date: Thu Jan 01 00:00:01 1970 +0000 > summary: r1 > > - changeset: 2:60c670bf5b30 > + changeset: 0:67e992f2c4f3 > user: test > date: Thu Jan 01 00:00:01 1970 +0000 > - summary: r2 > + summary: base > > - changeset: 3:e62f78d544b4 > - parent: 1:3d5bf5654eda > - user: test > - date: Thu Jan 01 00:00:01 1970 +0000 > - summary: b1 > - > - > - > log -f -r null > > $ hg log -f -r null > @@ -1346,6 +1345,11 @@ Also check when maxrev < lastrevfilelog > date: Thu Jan 01 00:00:00 1970 +0000 > summary: add foo, related > > + changeset: 2:c4c64aedf0f7 > + user: test > + date: Thu Jan 01 00:00:00 1970 +0000 > + summary: add unrelated old foo > + > $ cd .. > > Issue2383: hg log showing _less_ differences than hg diff > +1 on this feature; it was discussed several weeks ago on IRC and currently seems to be undefined. This is a good way to expose a commonly desired behavior. Implementation looks straightforward and obviously correct to me. I'm not in love with deleting an option, but in this case it seems to be the correct thing to do to maintain code simplicity. ~Ryan
On Fri, 27 Feb 2015 09:54:49 -0800, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1423249495 28800 > # Fri Feb 06 11:04:55 2015 -0800 > # Node ID 5e68ecffa023a3413dc5cba325b79951f7ceb574 > # Parent ff5caa8dfd993680d9602ca6ebb14da9de10d5f4 > log: make -fr show complete history from the given revs > > Right now it's very obtuse to show the history of a particular rev (hg log -r > 'reverse(::foo)'). This changes the -f option to make it follow history for the > revs specified by -r. > > The current -f -r behavior is to limit the result of -r to only the commits that > are ancestors of the current working copy. Changing this is a bit of a BC break, > but the old behavior is A) rare, B) easy to emulate (& ::.), and C) currently > undefined. The new behavior is frequently requested enough that I think the > change is worth it. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -4477,6 +4477,10 @@ def log(ui, repo, *pats, **opts): > Returns 0 on success. > > """ > + if opts.get('follow') and opts.get('rev'): > + opts['rev'] = [revset.formatspec('reverse(::%lr)', opts.get('rev'))] > + del opts['follow'] +1, but it won't work correctly if renamed file is specified. % hg log -qf mercurial/help/hg.1.txt | wc -l 164 % hg log -qfr. mercurial/help/hg.1.txt | wc -l 3 Regards,
On Fri, 2015-02-27 at 09:54 -0800, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1423249495 28800 > # Fri Feb 06 11:04:55 2015 -0800 > # Node ID 5e68ecffa023a3413dc5cba325b79951f7ceb574 > # Parent ff5caa8dfd993680d9602ca6ebb14da9de10d5f4 > log: make -fr show complete history from the given revs > > Right now it's very obtuse to show the history of a particular rev (hg log -r > 'reverse(::foo)'). This changes the -f option to make it follow history for the > revs specified by -r. > > The current -f -r behavior is to limit the result of -r to only the commits that > are ancestors of the current working copy. Changing this is a bit of a BC break, > but the old behavior is A) rare, B) easy to emulate (& ::.), and C) currently > undefined. The new behavior is frequently requested enough that I think the > change is worth it. Queued for default, thanks.
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4477,6 +4477,10 @@ def log(ui, repo, *pats, **opts): Returns 0 on success. """ + if opts.get('follow') and opts.get('rev'): + opts['rev'] = [revset.formatspec('reverse(::%lr)', opts.get('rev'))] + del opts['follow'] + if opts.get('graph'): return cmdutil.graphlog(ui, repo, *pats, **opts) diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -2202,13 +2202,6 @@ Test --follow and forward --rev (func ('symbol', 'rev') ('symbol', '6')))) - --- log.nodes * (glob) - +++ glog.nodes * (glob) - @@ -1,3 +1,3 @@ - -nodetag 6 - nodetag 8 - nodetag 7 - +nodetag 6 Test --follow-first and forward --rev diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -631,7 +631,7 @@ log -f -log -f -r 1:tip +log -f -r '1 + 4' $ hg up -C 0 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -639,25 +639,24 @@ log -f -r 1:tip $ hg ci -Amb2 -d '1 0' adding b2 created new head - $ hg log -f -r 1:tip + $ hg log -f -r '1 + 4' + changeset: 4:ddb82e70d1a1 + tag: tip + parent: 0:67e992f2c4f3 + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: b2 + changeset: 1:3d5bf5654eda user: test date: Thu Jan 01 00:00:01 1970 +0000 summary: r1 - changeset: 2:60c670bf5b30 + changeset: 0:67e992f2c4f3 user: test date: Thu Jan 01 00:00:01 1970 +0000 - summary: r2 + summary: base - changeset: 3:e62f78d544b4 - parent: 1:3d5bf5654eda - user: test - date: Thu Jan 01 00:00:01 1970 +0000 - summary: b1 - - - log -f -r null $ hg log -f -r null @@ -1346,6 +1345,11 @@ Also check when maxrev < lastrevfilelog date: Thu Jan 01 00:00:00 1970 +0000 summary: add foo, related + changeset: 2:c4c64aedf0f7 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add unrelated old foo + $ cd .. Issue2383: hg log showing _less_ differences than hg diff