X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/a2dcde7196ecd4e2c6d8bfff825d9b00a366c323..7c47d096c74a2654fc9d67490adbe3066d24df98:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 68bd39b..7a9df6e 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -99,25 +99,34 @@ def print_crt_patch(): else: print 'No patches applied' -def resolved(filename): +def resolved(filename, reset = None): + if reset: + reset_file = filename + '.' + reset + if os.path.isfile(reset_file): + if os.path.isfile(filename): + os.remove(filename) + os.rename(reset_file, filename) + git.update_cache([filename], force = True) + for ext in ['.local', '.older', '.remote']: fn = filename + ext if os.path.isfile(fn): os.remove(fn) -def resolved_all(): +def resolved_all(reset = None): conflicts = git.get_conflicts() if conflicts: for filename in conflicts: - resolved(filename) + resolved(filename, reset) os.remove(os.path.join(git.base_dir, 'conflicts')) def name_email(string): """Return a tuple consisting of the name and email parsed from a standard 'name ' string """ - str_list = re.findall('^(.*)\s+<(.*)>$', string) + string = re.sub('([^\w\s<>@.])', '\\\\\\1', string) + str_list = re.findall('^(.*)\s*<(.*)>\s*$', string) if not str_list: raise CmdException, 'Incorrect "name " string: %s' % string @@ -127,7 +136,8 @@ def name_email_date(string): """Return a tuple consisting of the name, email and date parsed from a 'name date' string """ - str_list = re.findall('^(.*)\s+<(.*)>\s+(.*)$', string) + string = re.sub('([^\w\s<>@.])', '\\\\\\1', string) + str_list = re.findall('^(.*)\s*<(.*)>\s*(.*)\s*$', string) if not str_list: raise CmdException, 'Incorrect "name date" string: %s' % string