On 2007-07-18 15:06, Giorgos Keramidas <[EMAIL PROTECTED]> wrote:
> That's where MQ can prove handy.  Uncommitted changes in a workspace can
> be saved with:
>
>     # hg add foo
>     # hg rename bar baz
>     # edit some files
>
>     hg qnew -f -m 'patch description' newpatch
>     hg qcommit -m 'newpatch: save patch state'
>
> Then 'newpatch' appears as an already "pushed" patch, and it can be
> qpop'ed or qpush'ed at will.
>
> The tricky part is making sure that the ~/.hg/patches repository lives
> over NFS or some other place where it has more chance of surviving a
> complete and unrecoverable system crash.  Symlinking .hg/patches to an
> NFS-shared location may work, but I haven't experimented with this yet.

With a recent build of the `Mercurial Crew' version, symlinked patch
queues seem to work:

1. Create a symlinked patch queue:

        $ pwd
        /home/keramida/hg/articles/mercurial
        $ mkdir ~/safe-mq
        $ ln -s ~/safe-mq .hg/patches
        $ hg qinit -c

2. Import local changes as a new patch:

        $ hg diff --git
        diff --git a/article.tex b/article.tex
        --- a/article.tex
        +++ b/article.tex
        @@ -1,4 +1,3 @@
        -% ``Introduction to the Mercurial SCM System''
         %
         % Copyright (C) 2007, Giorgos Keramidas <[EMAIL PROTECTED]>
         % All rights reserved.
        $ hg qnew -f -m 'trim header line' newpatch
        $ hg qcommit -m 'newpatch: save patch state'

3. Pop the patch off the stack:

        $ hg qpop -a
        Patch queue now empty
        $

On another machine, which can see the same HOME directory, it may be
possible to do:

        $ hg clone parent child && cd child
        $ hg clone ~/safe-mq .hg/patches
        $ hg -R .hg/patches log
        changeset:   0:15612db2e9e8
        tag:         tip
        user:        Giorgos Keramidas <[EMAIL PROTECTED]>
        date:        Wed Jul 18 15:12:23 2007 +0300
        summary:     newpatch: save patch state

        $

Then the new patch queue can be treated as a repository of its own, and
patches can be qpushed, modified, qrefreshed, qpopped, qcommitted to the
.hg/patches repository.  Normal Mercurial operations can be used to pull
and push changes from ~/safe-mq to the patch queue of the active
workspace.

Just some food for thought,

- Giorgos

_______________________________________________
tools-discuss mailing list
[email protected]

Reply via email to