Mercurial alias using awk

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


Tavis Elliott wrote:
> Due to https://bz.mercurial-scm.org/show_bug.cgi?id=4980 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):

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

Does this help?

			Reimer Behrends


More information about the Mercurial mailing list