Bug 3824 - move the strip command to an extension of its own
Summary: move the strip command to an extension of its own
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: mq (show other bugs)
Version: unspecified
Hardware: All All
: normal feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-14 14:18 UTC by Bryan O'Sullivan
Modified: 2013-11-07 17:48 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan O'Sullivan 2013-02-14 14:18 UTC
I'd like to be able to have people/tools use strip without being exposed to the rest of mq. We should create a strip extension that only supports this command, and modify mq to use it.
Comment 1 Pierre-Yves David 2013-02-14 14:23 UTC
yes please!
Comment 2 Sean Farley 2013-02-14 15:20 UTC
Would it be too crazy to make this a core command? My precedent for this is Matt's email here (where he compares it to clone -r):

http://article.gmane.org/gmane.comp.version-control.mercurial.devel/48874
Comment 3 Matt Mackall 2013-02-14 15:39 UTC
Sean: not any time soon. If anything, the message you cite shows that nothing has changed that would allow the promotion of strip to core.
Comment 4 Sean Farley 2013-02-14 16:32 UTC
(In reply to comment #3)

Alas. Does it make sense to bundle strip with histedit or evolve (or some other history mucking tool)? It just seems a little odd to me that strip would be an extension all by itself.
Comment 5 IsaacJurado 2013-02-14 17:40 UTC
I had this thought too some time ago.  But I never new if there was some kind of dependency management between extension.  That is, an extension enabling another one (due to requirement) even if it is NOT enabled in the configuration.

Besides, most of the stripping logic is already in core so having an extension to expose it as an advanced command makes perfect sense.
Comment 6 Pierre-Yves David 2013-02-15 04:21 UTC
Strip has no future as a first class command. The semantic of strip is "annihilate this changesets from my repo whatever it takes". We will certainly have a first class command to "delete" changesets. But it'll be something laying obsolescence marker around like the "prune" commands in evolve
Comment 7 HG Bot 2013-09-27 18:30 UTC
Fixed by http://selenic.com/repo/hg/rev/5d6cfdc38a3d
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: simplifies the refresh hint in checklocalchanges

The `checklocalchanges` function in the `mq.queue` class takes a `refresh` argument that
changes the error message of raised exception. When refresh is
`True` the exception message is "local changes found, refresh first" otherwise,
the message is just "local changes found".

This changeset is the first of a series that extract `strip` into a standalone
extension (as discussed in issue3824). This `checklocalchanges` function is
indirectly used by the strip command. But in a standalone strip extension the
concept of "refresh first" has no sense. In practice, When used in the context
of the strip commands `refresh`'s value is always `False`.

So my final goal is a be able to extract the `checklocalchanges` logic in a
standalone extension but to keep the part related to "refresh first" in the mq
extension. However the refresh handling is deeply entangled into the
`checklocalchanges` code. It is handled as low a possible at the point we raise
the exception.

So we moves handling of refresh upper in the `checklocalchanges` code. This will
allow the extraction of a simple version in the strip extension while mq can
still inject its logic when needed.

Two helper functions `localchangesfound` and `localchangedsubreposfound` died in
the process they are replaced by simple raise lines.

(please test the fix)
Comment 8 HG Bot 2013-09-27 18:30 UTC
Fixed by http://selenic.com/repo/hg/rev/76796fe65bad
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: extract checksubstate from the queue class

This function does not need any of the the `mq.queue` method or attributes. It
is indirectly used by the `strip` command. We are trying to extract this command
in a standalone extension as discussed in issue issue3824.

(please test the fix)
Comment 9 HG Bot 2013-09-27 18:30 UTC
Fixed by http://selenic.com/repo/hg/rev/4495c6a272e0
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: extract checklocalchanges from `mq.queue`

The core part of `checklocalchanges` is now mq independent. We can extract it in
a standalone function to help the extraction of `strip` as discussed in issue3824.

A `checklocalchanges` function stay in `mq.queue` with the part related to
"refresh first" messages.

(please test the fix)
Comment 10 HG Bot 2013-09-27 18:30 UTC
Fixed by http://selenic.com/repo/hg/rev/e67786965af2
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: drop the use of mq.queue.qparent in mq.strip

In this case, rev is never `None`. We can just copy the two relevant lines in
in `strip`. This help having `strip` independent from `queue` one
further step toward its extraction in an independent extension. (As
discussed in issue3824).

(please test the fix)
Comment 11 HG Bot 2013-09-27 18:30 UTC
Fixed by http://selenic.com/repo/hg/rev/f72b513ad234
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: drop the use of mq.queue.qparent in mq.queue.strip

Same as in the previous changeset, rev is never `None`. We can just copy the two
relevant lines in in `queue.strip`. This help having `queue.strip` independent
from `queue`. One further step toward the extraction of `strip` in an independent
extension. (As discussed in issue3824).

(please test the fix)
Comment 12 Pierre-Yves David 2013-09-28 09:56 UTC
actually closed by 4b1cbcfdabf7 (currently in crew)
Comment 13 HG Bot 2013-09-30 15:45 UTC
Fixed by http://selenic.com/repo/hg/rev/a194a33f8cb2
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
mq: prepare a strip extension for extraction

Strip will lives in its own extension. The extension is surprisingly called
`strip`. (as discussed in issue3824) The `mq` extension force the use of the
strip extension when its enabled. This will both necessary for backward
compatibility (people expect `mq` to comes with strip) and become some utility
function used by `mq` will move in the strip extension.

(please test the fix)
Comment 14 HG Bot 2013-09-30 15:45 UTC
Fixed by http://selenic.com/repo/hg/rev/6fb14d21fe9d
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
strip: move checksubstate from mq to strip

One more step for issue3824

(please test the fix)
Comment 15 HG Bot 2013-09-30 15:45 UTC
Fixed by http://selenic.com/repo/hg/rev/237e40b2c1ff
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
strip: move checklocalchanges from mq to strip

One more step for issue3824.

(please test the fix)
Comment 16 HG Bot 2013-09-30 15:45 UTC
Fixed by http://selenic.com/repo/hg/rev/4b4997068143
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
strip: move the strip helper function for mq to strip

The next patch finally move the command. No joke! (hey, this is for issue3824)

(please test the fix)