xemacs: fix issue 634

Stephen J. Turnbull stephen at xemacs.org
Fri Nov 27 00:32:22 EST 2009


Adrian Aichner writes:

 > How can I push this fix without also pushing unrelated, uncommited
 > changes I have in the workspace?

The quickest is just

    hg commit -m "Check first whether drive is valid." src/ChangeLog src/nt.c
    hg push

However, although it's more complex, I strongly advise you to use
Mercurial queues, like this:

    # mq is an extension, you need to enable it.
    # Edit $HOME/.hgrc and add these two lines.
    [extensions]
    	hgext.mq = >> ~/.hgrc
    # If you already have an [extensions] section, omit the first line.

    # It is important to do this step now!
    # Make an mq patch for this change:
    hg qnew -f -m "Check first whether drive is valid." valid-drive \
        src/ChangeLog src/nt.c

    # View .hg/patches/valid-drive and make sure it has the patch you
    # want to push.

    # Now make patches for other changes.  For a change to foo.el,
    # foo-msw.el, and lisp/ChangeLog it would look like
    hg qnew -f -m "Frob foo." frob-foo lisp/foo.el lisp/foo-msw.el \
        lisp/ChangeLog
    # Do this until there are *no* changes left (hg status reports no
    # modified files).
    # I strongly recommend that you do this *now*, this is probably
    # the best way to organized your work when you make many small
    # changes.  However, if you have overlapping changes that you
    # can't easily sort out, or just don't feel like doing that, you
    # can just
    hg qnew -f -m "DON'T COMMIT ME!" big-ball-of-mud
    # instead.

    # Now let's commit the patch you want to push.
    # If you feel paranoid, you can view all the patches in
    # .hg/patches to make sure they look OK.
    hg qpop --all            # unapply --all patches
    hg status                # should report no modified files
    hg qpush                 # note, no argument needed
    hg qapplied              # will report "valid-drive" because that was
                             # the first patch you created (it's a queue!!)
    hg qfinish --applied     # convert valid-drive from a patch to a commit
    # Make sure it's OK.
    hg log -r tip            # message you gave in 'qnew -m' is the
                             # log message

    # Update and push.
    hg pull -u               # should work without complaint since you
                             # don't say you have any commits
    hg push                  # Yay!

That looks like a lot of work, but it's actually not too inconvenient.

After this, whenever you have something that could turn into a
commitable change, do "hg qnew ...".  Make the ChangeLog right away
(it can even just be a placeholder to fill in later).  That allows you
to isolate this change from other changes, even if they touch the same
files.

There are a couple of techniques you will need to know about.  I've
already mentioned "guards".  The other is "hg qrefresh", which updates
the current top patch with any uncommitted changes.  Your friends are

    hg help mq
    hg help qrefresh
    hg help qguard

and of course feel free to ask here.

HTH

P.S.  I'll add this and later other hints about using Mercurial to the
Internals manual.



More information about the XEmacs-Patches mailing list