Created
March 1, 2012 18:06
-
-
Save bamboo/1951742 to your computer and use it in GitHub Desktop.
copy all local hg changes to another folder
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
import System.IO | |
import Boo.Lang.PatternMatching | |
targetFolder = argv[0] | |
changes = ((statusLine[:1], statusLine[2:]) for statusLine in /\n/.Split(shell("hg", "st")) if len(statusLine) > 0) | |
for status, file in changes: | |
targetFile = Path.Combine(targetFolder, file) | |
match status: | |
case "M" | "?": | |
Directory.CreateDirectory(Path.GetDirectoryName(targetFile)) | |
File.Copy(file, targetFile, true) | |
case "R" | "!": | |
File.Delete(targetFile) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment