~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow configurable file extensions for merge conflicts
[stgit]
/
stgit
/
commands
/
common.py
diff --git
a/stgit/commands/common.py
b/stgit/commands/common.py
index
2985379
..
c6ca514
100644
(file)
--- 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 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
crt_series = None
@@
-96,7
+97,7
@@
def check_head_top_equal():
' are doing, use the "refresh -f" command'
def check_conflicts():
' 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):
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:
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)
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)
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)
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)
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
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
def name_email(address):
"""Return a tuple consisting of the name and email parsed from a
- standard 'name <email>' string
+ standard 'name <email>'
or 'email (name)'
string
"""
address = re.sub('[\\\\"]', '\\\\\g<0>', address)
str_list = re.findall('^(.*)\s*<(.*)>\s*$', address)
if not str_list:
"""
address = re.sub('[\\\\"]', '\\\\\g<0>', address)
str_list = re.findall('^(.*)\s*<(.*)>\s*$', address)
if not str_list:
- raise CmdException, 'Incorrect "name <email>" string: %s' % address
+ str_list = re.findall('^(.*)\s*\((.*)\)\s*$', address)
+ if not str_list:
+ raise CmdException, 'Incorrect "name <email>"/"email (name)" string: %s' % address
+ return ( str_list[0][1], str_list[0][0] )
return str_list[0]
return str_list[0]