parent
aeca93f0b3
commit
ed231f4b1b
|
@ -1,6 +1,6 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
"""\
|
"""\
|
||||||
py.svnwcrevert WCPATH [precious...]
|
py.svnwcrevert [options] WCPATH
|
||||||
|
|
||||||
Running this script and then 'svn up' puts the working copy WCPATH in a state
|
Running this script and then 'svn up' puts the working copy WCPATH in a state
|
||||||
as clean as a fresh check-out.
|
as clean as a fresh check-out.
|
||||||
|
@ -14,12 +14,9 @@ or that svn doesn't explicitly know about, including svn:ignored files
|
||||||
The goal of this script is to leave the working copy with some files and
|
The goal of this script is to leave the working copy with some files and
|
||||||
directories possibly missing, but - most importantly - in a state where
|
directories possibly missing, but - most importantly - in a state where
|
||||||
the following 'svn up' won't just crash.
|
the following 'svn up' won't just crash.
|
||||||
|
|
||||||
Optionally filenames that should be left untouched can be passed as arguments
|
|
||||||
too.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py
|
import sys, py
|
||||||
|
|
||||||
def kill(p, root):
|
def kill(p, root):
|
||||||
print '< %s' % (p.relto(root),)
|
print '< %s' % (p.relto(root),)
|
||||||
|
@ -43,12 +40,17 @@ def svnwcrevert(path, root=None, precious=[]):
|
||||||
elif p.check(dir=1):
|
elif p.check(dir=1):
|
||||||
svnwcrevert(p, root)
|
svnwcrevert(p, root)
|
||||||
|
|
||||||
|
# XXX add a functional test
|
||||||
|
optparse = py.compat.optparse
|
||||||
|
|
||||||
# XXX use optparse, and add a functional test
|
parser = optparse.OptionParser(usage=__doc__)
|
||||||
|
parser.add_option("-p", "--precious",
|
||||||
|
action="append", dest="precious", default=[],
|
||||||
|
help="preserve files with this name")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import sys
|
opts, args = parser.parse_args()
|
||||||
if len(sys.argv) < 2:
|
if len(args) != 1:
|
||||||
print __doc__
|
parser.print_help()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
svnwcrevert(py.path.local(sys.argv[1]), precious=sys.argv[1:])
|
svnwcrevert(py.path.local(args[0]), precious=opts.precious)
|
||||||
|
|
Loading…
Reference in New Issue