revert bugfix: revert deleted items in order by status but added/modified items in reverse order

This commit is contained in:
Josh Holtrop 2013-10-24 10:30:52 -04:00
parent efdad72708
commit 4fa19ce27a

9
jsvn
View File

@ -1232,16 +1232,19 @@ def revert_h(argv, svn, out, config):
if target.endswith('/'): if target.endswith('/'):
argv[i] = target[:-1] argv[i] = target[:-1]
p = Popen([svn, 'status'], stdout=PIPE) p = Popen([svn, 'status'], stdout=PIPE)
status_lines = [] modified_files = []
for line in iter(p.stdout.readline, ''): for line in iter(p.stdout.readline, ''):
status_lines.append(line)
for line in reversed(status_lines):
m = re.match(STATUS_LINE_REGEX, line) m = re.match(STATUS_LINE_REGEX, line)
if m is not None: if m is not None:
action = line[0] action = line[0]
prop_action = line[1] prop_action = line[1]
if action in ('A', 'M', 'D', '!') or prop_action == 'M': if action in ('A', 'M', 'D', '!') or prop_action == 'M':
fname = m.group(1) fname = m.group(1)
if action in ('D', '!'):
modified_files.append(fname)
else:
modified_files.insert(0, fname)
for fname in modified_files:
for target in argv: for target in argv:
if fname.startswith(os.getcwd() + os.sep): if fname.startswith(os.getcwd() + os.sep):
fname = fname[len(os.getcwd() + os.sep):] fname = fname[len(os.getcwd() + os.sep):]