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 -uhg pull -u --mq を同時に簡単に行うためのスクリプト

hg incoming で、アップストリームに更新があるかをチェックする際に、バンドルファイルを作成することで、hg pull で再度通信を行うことを抑制している。

参考:

@k-takata
Copy link
Author

k-takata commented Oct 3, 2014

なぜか、hg pull -u --mq バンドルファイル というやり方では、バンドルファイルから MQ リポジトリに pull することが出来なかった。(hg 3.0.1)
仕方なく、hg pull -u --cwd "`hg root`/.hg/`hg qqueue --active`" "$PWD/バンドルファイル" とすることにした。

@k-takata
Copy link
Author

k-takata commented Oct 3, 2014

hg incoming --mq バンドルファイル でバンドルファイルの正当性の確認も同様に出来なかった。

@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