Skip to content

Instantly share code, notes, and snippets.

@runekaagaard
Created February 3, 2012 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runekaagaard/1729500 to your computer and use it in GitHub Desktop.
Save runekaagaard/1729500 to your computer and use it in GitHub Desktop.
/usr/local/bin/hg-delete-obstructed-files
#!/usr/bin/env php
<?php
$obstructed_files = array();
foreach (array_filter(explode("\n", `hg status $(hg root)`)) as $line) {
if ($line{0} !== "!") continue;
$obstructed_files[] = trim($line, "! ");
}
$files_str = implode(" ", $obstructed_files);
$cmd1 = "hg revert $files_str";
$cmd2 = "hg rm $files_str";
echo $cmd1 . "\n\n";
echo `$cmd1`;
echo $cmd2 . "\n\n";
echo `$cmd2`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment