[RFC PATCH 0 of 3] Treat bookmark names as fnmatch() patterns in push/pull.

Will Maier willmaier at ml1.net
Tue Sep 21 17:20:41 CDT 2010

Hi all-

On Wed, Sep 15, 2010 at 04:58:35AM -0500, Will Maier wrote:
> These patches make it easier to interact with remote repositories using
> bookmarks. Instead of specifying each bookmark to import or export, PATCH 3
> allows the user to specify fnmatch patterns that will then be matched against
> the remote or local bookmarks, respectively. PATCH 1 adds some basic tests
> of the push/pull bookmark functionality; PATCH 2 expands the tests to cover
> patterns.
> This feature is particularly useful when pushing to or pulling from a Git
> repository using the hg-git extension.

Matt wanted a bit more discussion about the third patch in this series, so I'll
bump this thread and expand a bit on the last sentence above. When I work with
bookmarks, I want all of them to be available in all of the clones I've made of
a source repository. Currently, syncing bookmarks between clones requires a bit
of shell hackery along the following lines:

    $ hg incoming -B source-repo bookmarks |\ 
        sed -e '1,2d' | awk '{print $1}' | xargs -n1 hg pull -B

This is a bit tedious. Rather than add a new option to push/pull, PATCH 3 interprets
the bookmark name as a fnmatch(3) pattern. This means you can do discovery and
syncing in a single step:

    $ hg pull -B \* source-repo

Thoughts? Comments?



Will Maier

More information about the Mercurial-devel mailing list