forked from guillermooo/Vintageous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Push.ps1
30 lines (25 loc) · 1.01 KB
/
Push.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
param([switch]$Force)
# This script ensures that we abort pushing if we have unfinzalied Mercurial patches.
#
# hg-git has bug that will break the local repository if we do all the following things:
# 1. we push changes in A.patch to Github without finalizing the patch first
# 2. we make further changes to the patch locally and refresh
# 3. we finalize and push A.patch to Github again
#
# Other requirements so that this script work:
#
# 1. bb must be defined under [paths] in .hg/hgrc
# 2. git must be defined under [paths] in .hg/hgrc
# 3. 'push' must be disabled under [alias] in .hg/hgrc
if (!$Force -and (& hg qseries)) {
write-host "Cannot push: unfinalized patches" -foregroundcolor RED
exit
}
if (@(& hg bookmarks).length -gt 1) {
# Normally we just want to have a single branch in this repo before pushing.
write-host "Cannot push: too many bookmarks" -foregroundcolor RED
exit
}
# Override .hg/hgrc
& hg --config "alias.push=push" push bb
& hg --config "alias.push=push" push git