tla undo/redo like functionality for hg

Benoit Boissinot bboissin at gmail.com
Tue Nov 28 04:13:05 CST 2006


On 11/28/06, Stefan Reichör <stefan at xsteve.at> wrote:
> "Benoit Boissinot" <bboissin at gmail.com> writes:
>
> > On 11/28/06, Stefan Reichör <stefan at xsteve.at> wrote:
> >> Hi!
> >>
> >> One very useful of GNU Arch is that I can undo all current changes
> >> and store them in a directory.
> >>
> >> Later I can redo that saved changes.
> >>
> >>
> >> How can I do that with hg?
> >>
> >> I could start like this:
> >>
> >> % hg diff --git > changeset.diff
> >> % hg revert --no-backup
> >>
> >> ...
> >>
> >> How can I redo now my changes?
> >> % hg import changeset.diff
> >> That command will commit the changes. Is there a way to apply the
> >> changes without committing?
> >
> > patch -p1 < changeset.diff ? (this may have problem with git patches)
>
> Exactly. It would be nice, if mercurial has a command to apply a patch
> without committing it.
>
> What about "hg import --no-commit"
>
> > But the easiest way is with mq:
> >
> > hg qnew -f changeset.diff
> > hg qpop
> > hg qpush
>
> I have several questions to this suggestion:
>
> a) Can I save several changesets (changeset1.diff, changeset2.diff)
>    and apply them in arbitrary order?

It is a quilt like queue, so the patch order is recorded in
.hg/patches/series, and if they are unapplied you can reorder them if
you edit this file.

> b) Is the patch recorded in the repository? And if yes, can I
>    delete this patch from the repository.
>
Not sure I understand what you mean with "recorded", patches are
stored in .hg/patches/<patchname>, you can delete them with "hg
qdelete"

regards,

Benoit



More information about the Mercurial-devel mailing list