星期四 七月 17, 2008

There are several ways to exchange changesets of mercurial between repositories (branches).
  1. hg bundle/unbundle

  2. Just like an offline hg pull/update, which means you could not apply the changesets from another repository if they do not share the same changesets.

  3. hg export/import

  4. hg export -o changesets/patch%r REV1:REV2. It could work for the repositories that does not share the same changesets (repositories may come from different ancestors), but it does not work so well for merged revisions (the changesets have multiple parents). Even with --switch-parent option, you still need to manually edit the patch to eliminate the additional parent declaration in comments.

  5. hg transplant extension

  6. So far the best solution, though I still met a problem when transplanting a specific merged revision (for other merged revisions, it worked smoothly). So I use hg cat -r REV to output the relevant files, copy them to the new repository and commit. Then skip the specific revision.

星期三 十一月 28, 2007

When I work in a Mercurial local workspace, to fix one bug or add a new feature, I'd like to track my modifications in versioning way, so I did local check-ins on every milestone. While when I push the changes to parent workspace, all the changesets (even some trivial changes, e.g., fixing typo:$) will be saved to parent workspace.

I once used the most stupid way, having two local copies, one is for development, another one is for pushing to parent. Then I found one tip to concatenate multiple changesets into one changeset, but it still needs an extra clone. Finally, I met the MQ extension.

Refer to the tutorial, you would find it's really close to what you want.

Here I list the most important tips:

  • To initialize the patch versioned repository:
  • hg qinit -c
  • To convert all applied MQ patches into permanent changesets: (Note, after the conversion, you may not rollback the last changeset)
  • hg qdelete -r qbase:qtip
  • Synchronizing with upstream (which is much simpler than the steps in MqMerge, and does not introduce extra "merge marker" changeset)
  • hg qpop -a
    hg pull -u
    hg qpush -a

    This blog copyright 2009 by yongsun