Mercurial alias using awk

Reimer Behrends behrends at
Tue Jan 5 15:43:37 CST 2016

Tavis Elliott wrote:
> Due to I need a way for my team to clean up bookmarks locally.  I have the following alias:
> bookrefresh=! for bm in `$HG bookmarks | awk '{print$1}'`; do $HG bookmark -d $bm; done; $HG pull
> This works as a regular shell script.

The active bookmark is marked with a leading asterisk, so even in a 
shell script that may not always work. The experimental template feature 
(see `hg help -v bookmarks`) may be the better solution (also, xargs 
avoids invoking Mercurial repeatedly for each bookmark):

	bookrefresh = !$HG bookmarks -T '{bookmark}\n' | xargs $HG bookmark -d; 
$HG pull

Does this help?

			Reimer Behrends

More information about the Mercurial mailing list