Skip to content

Instantly share code, notes, and snippets.

@k-takata
Last active August 30, 2019 11:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-takata/3a152aa2307cc3969cfd to your computer and use it in GitHub Desktop.
Save k-takata/3a152aa2307cc3969cfd to your computer and use it in GitHub Desktop.
Do 'hg pull' and 'hg pull --mq' easily
#!/bin/sh
mainbundle=hg_main.bundle
mqbundle=hg_mq.bundle
rm -f $mainbundle $mqbundle
hg --pager=no incoming -v --bundle $mainbundle
hg --pager=no incoming --mq -v --bundle $mqbundle
if [ -e $mainbundle ]; then
hg pull $mainbundle
fi
if [ -e $mqbundle ]; then
hg pull -R "$(hg root)/.hg/$(hg qqueue --active)" $mqbundle
fi
LANG=C hg summary | grep ^update | grep '(current)' > /dev/null
mainup=$?
LANG=C hg summary --mq | grep ^update | grep '(current)' > /dev/null
mqup=$?
if [ $mainup = 1 -o $mqup = 1 ]; then
hg qpop -a && \
if [ $mainup = 1 ]; then hg up; fi && \
if [ $mqup = 1 ]; then hg up --mq -c; fi && \
hg qpush -a
fi
rm -f $mainbundle $mqbundle
@k-takata
Copy link
Author

k-takata commented Oct 3, 2014

hg pull -u -R "`hg root`/.hg/`hg qqueue --active`" バンドルファイル でも良さそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment