Question

From a Mercurial repository I want to regularly create a bundle with all my latest commits (in order to email them).

Starting with a clean directory I envision a process like this:

  1. create a clean repository
    work on my directory
    commit
    work more in directory
    commit
    ...

  2. send a bundle with the commits.

  3. work on my directory
    commit
    work more in directory
    commit
    ...

  4. send a bundle with the all commits after the last sent bundle.

  5. go back to 2.

How can I do this? The problem is step 4. Is there a way to mark all bundled commits (in order to not bundle them again)?


Note: Together all the bundles I sent per email should make up the complete directory in its current state.

Was it helpful?

Solution

There is no built-in mechanism for this in Mercurial. What you want to do is to specify the correct base changeset when you generate a new bundle. That is, in Step 4, you want to run

$ hg bundle --base head-used-in-step-2 changes-after-2.hg

You can do the bookkeeping in different ways: teach your parrot to remember the last bundled commit, write it on a post-it note, write the commit into an untracked file in the repository, or track it using a local tag.

Using a local tag is probably the best way. After you create a new bundle you move the tag to the working copy parent revsion:

$ hg bundle --base last-bundle
$ hg tag --local -f last-bundle

You need -f since you will be moving the tag. You wont have the last-bundle tag the first time you bundle, so just use hg bundle --all the first time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top