X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/1777d8cd458bddb1a5f638e8928726167469154c..d7fade4be437ade1eaf92ca29cc99b566b0e3c18:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 2985379..c6ca514 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -22,7 +22,8 @@ import sys, os, re from optparse import OptionParser, make_option from stgit.utils import * -from stgit import stack, git +from stgit import stack, git, basedir +from stgit.config import config, file_extensions crt_series = None @@ -96,7 +97,7 @@ def check_head_top_equal(): ' are doing, use the "refresh -f" command' def check_conflicts(): - if os.path.exists(os.path.join(git.get_base_dir(), 'conflicts')): + if os.path.exists(os.path.join(basedir.get(), 'conflicts')): raise CmdException, 'Unsolved conflicts. Please resolve them first' def print_crt_patch(branch = None): @@ -112,7 +113,7 @@ def print_crt_patch(branch = None): def resolved(filename, reset = None): if reset: - reset_file = filename + '.' + reset + reset_file = filename + file_extensions()[reset] if os.path.isfile(reset_file): if os.path.isfile(filename): os.remove(filename) @@ -120,7 +121,7 @@ def resolved(filename, reset = None): git.update_cache([filename], force = True) - for ext in ['.local', '.older', '.remote']: + for ext in file_extensions().values(): fn = filename + ext if os.path.isfile(fn): os.remove(fn) @@ -130,7 +131,7 @@ def resolved_all(reset = None): if conflicts: for filename in conflicts: resolved(filename, reset) - os.remove(os.path.join(git.get_base_dir(), 'conflicts')) + os.remove(os.path.join(basedir.get(), 'conflicts')) def push_patches(patches, check_merged = False): """Push multiple patches onto the stack. This function is shared @@ -175,12 +176,15 @@ def push_patches(patches, check_merged = False): def name_email(address): """Return a tuple consisting of the name and email parsed from a - standard 'name ' string + standard 'name ' or 'email (name)' string """ address = re.sub('[\\\\"]', '\\\\\g<0>', address) str_list = re.findall('^(.*)\s*<(.*)>\s*$', address) if not str_list: - raise CmdException, 'Incorrect "name " string: %s' % address + str_list = re.findall('^(.*)\s*\((.*)\)\s*$', address) + if not str_list: + raise CmdException, 'Incorrect "name "/"email (name)" string: %s' % address + return ( str_list[0][1], str_list[0][0] ) return str_list[0]