Submitter | Durham Goode |
---|---|
Date | March 20, 2015, 1:14 a.m. |
Message ID | <0a4343392b3358584bd1.1426814068@dev2000.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/8191/ |
State | Rejected |
Headers | show |
Comments
On Thu, 19 Mar 2015 21:14:28 -0400, Durham Goode <durham@fb.com> wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1426787637 25200 > # Thu Mar 19 10:53:57 2015 -0700 > # Node ID 0a4343392b3358584bd16e7b7f15e9c2264c9c8b > # Parent 22e9be40a47d397339c4d5a5ea7c82131d72d889 > prune: add --descendants for pruning entire subtrees Doesn't '-r rev::' do the same thing? I don't have a subtree I want to prune handy, but based on passing the same revset to log, it prints what I would expect --descendants would operate on. --Matt
On 3/19/15 6:32 PM, Matt Harbison wrote: > On Thu, 19 Mar 2015 21:14:28 -0400, Durham Goode <durham@fb.com> wrote: > >> # HG changeset patch >> # User Durham Goode <durham@fb.com> >> # Date 1426787637 25200 >> # Thu Mar 19 10:53:57 2015 -0700 >> # Node ID 0a4343392b3358584bd16e7b7f15e9c2264c9c8b >> # Parent 22e9be40a47d397339c4d5a5ea7c82131d72d889 >> prune: add --descendants for pruning entire subtrees > > Doesn't '-r rev::' do the same thing? I don't have a subtree I want > to prune handy, but based on passing the same revset to log, it prints > what I would expect --descendants would operate on. > > --Matt Yea, it does but we're in the process of making the evolve UI easier for users to pick up, and making it able to act like strip without having to know the revset syntax is useful. I don't expect the prune UI to remain fixed, so we can come back here and clean up as we get more feedback.
On Thu, 19 Mar 2015 21:36:57 -0400, Durham Goode <durham@fb.com> wrote: > > > On 3/19/15 6:32 PM, Matt Harbison wrote: >> On Thu, 19 Mar 2015 21:14:28 -0400, Durham Goode <durham@fb.com> wrote: >> >>> # HG changeset patch >>> # User Durham Goode <durham@fb.com> >>> # Date 1426787637 25200 >>> # Thu Mar 19 10:53:57 2015 -0700 >>> # Node ID 0a4343392b3358584bd16e7b7f15e9c2264c9c8b >>> # Parent 22e9be40a47d397339c4d5a5ea7c82131d72d889 >>> prune: add --descendants for pruning entire subtrees >> >> Doesn't '-r rev::' do the same thing? I don't have a subtree I want to >> prune handy, but based on passing the same revset to log, it prints >> what I would expect --descendants would operate on. >> >> --Matt > Yea, it does but we're in the process of making the evolve UI easier for > users to pick up, and making it able to act like strip without having to > know the revset syntax is useful. I don't expect the prune UI to remain > fixed, so we can come back here and clean up as we get more feedback. OK, that makes sense. On the subject of making prune more user friendly, I've done this a couple of times: $ hg kill <rev> -s <rev2> <rev3> thinking it would mark 2 and 3 as successors. Phases saved me both times, but the error message misdirected me into thinking I ran into a bug, instead of forgetting the '-s'. I can't think of any hg command when an option can be specified, followed by a list of revs, so I have no idea where I got the impulse to do that. But I suspect others might run into it too, and there's no official undo for obsolete that I'm aware of. Is there some way to force '-r' to be used with this command? --Matt
On 03/19/2015 06:36 PM, Durham Goode wrote: > > > On 3/19/15 6:32 PM, Matt Harbison wrote: >> On Thu, 19 Mar 2015 21:14:28 -0400, Durham Goode <durham@fb.com> wrote: >> >>> # HG changeset patch >>> # User Durham Goode <durham@fb.com> >>> # Date 1426787637 25200 >>> # Thu Mar 19 10:53:57 2015 -0700 >>> # Node ID 0a4343392b3358584bd16e7b7f15e9c2264c9c8b >>> # Parent 22e9be40a47d397339c4d5a5ea7c82131d72d889 >>> prune: add --descendants for pruning entire subtrees >> >> Doesn't '-r rev::' do the same thing? I don't have a subtree I want >> to prune handy, but based on passing the same revset to log, it prints >> what I would expect --descendants would operate on. >> >> --Matt > Yea, it does but we're in the process of making the evolve UI easier for > users to pick up, and making it able to act like strip without having to > know the revset syntax is useful. I don't expect the prune UI to remain > fixed, so we can come back here and clean up as we get more feedback. While I agree that the current prune UI is not very good I'm definitely not thrilled about this --descendants options. Since it is actually easy to do without it I'm dropping the idea for now.
Patch
diff --git a/hgext/evolve.py b/hgext/evolve.py --- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -1741,6 +1741,7 @@ def _getmetadata(**opts): [('n', 'new', [], _("successor changeset (DEPRECATED)")), ('s', 'succ', [], _("successor changeset")), ('r', 'rev', [], _("revisions to prune")), + ('', 'descendants', None, _("prunes descendants of the revs as well")), ('', 'biject', False, _("do a 1-1 map between rev and successor ranges")), ('B', 'bookmark', '', _("remove revs only reachable from given" " bookmark"))] + metadataopts, @@ -1786,6 +1787,10 @@ def cmdprune(ui, repo, *revs, **opts): lock = repo.lock() # defines pruned changesets precs = [] + + if opts.get('descendants', False): + revs = repo.revs('descendants(%ld)', revs) + revs.sort() for p in revs: cp = repo[p] diff --git a/tests/test-prune.t b/tests/test-prune.t --- a/tests/test-prune.t +++ b/tests/test-prune.t @@ -223,6 +223,21 @@ two old, two new with --biject cb7f8f706a6532967b98cf8583a81baab79a0fa7 8ee176ff1d4b2034ce51e3efc579c2de346b631d 0 (*) {'user': 'test'} (glob) 21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (*) {'user': 'test'} (glob) +test hg prune --descendants + + $ hg log -T '{rev}\n' + 12 + 11 + 10 + 9 + 0 + $ hg prune -r 11 --descendants + 2 changesets pruned + $ hg log -T '{rev}\n' + 10 + 9 + 0 + test hg prune -B bookmark yoinked from test-mq-strip.t