Created
August 8, 2011 18:18
-
-
Save bamboo/1132339 to your computer and use it in GitHub Desktop.
stripping all revisions from a non tip head in mercurial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hg(command): | |
return shell("hg", command) | |
def strip(rev): | |
return hg("strip $rev") | |
def heads(): | |
return hg("heads") | |
def nextNonTipRevision(): | |
matches = /changeset:\s+(\d+).+\n(tag:\s*tip\n)?/.Matches(heads()) | |
for m as System.Text.RegularExpressions.Match in matches: | |
if string.IsNullOrEmpty(m.Groups[2].Value): | |
return m.Groups[1].Value | |
while not string.IsNullOrEmpty(rev = nextNonTipRevision()): | |
print "stripping $rev..." | |
print strip(rev) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment