chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gitmergeonefile.py should use git.get_base_dir()
[stgit]
/
gitmergeonefile.py
diff --git
a/gitmergeonefile.py
b/gitmergeonefile.py
index 9344d33b8a17eee746fd8f0163eec4ba04dc9f12..99882c8be56322772a5bf9867e495e2ab7cb8007 100755
(executable)
--- a/
gitmergeonefile.py
+++ b/
gitmergeonefile.py
@@
-35,6
+35,7
@@
if bin == 'bin' and prefix != sys.prefix:
from stgit.config import config
from stgit.utils import append_string
from stgit.config import config
from stgit.utils import append_string
+from stgit.git import get_base_dir
#
#
@@
-52,15
+53,6
@@
else:
keeporig = 'yes'
keeporig = 'yes'
-#
-# Global variables
-#
-if 'GIT_DIR' in os.environ:
- base_dir = os.environ['GIT_DIR']
-else:
- base_dir = '.git'
-
-
#
# Utility functions
#
#
# Utility functions
#
@@
-113,7
+105,7
@@
def __remove_files():
def __conflict():
"""Write the conflict file for the 'path' variable and exit
"""
def __conflict():
"""Write the conflict file for the 'path' variable and exit
"""
- append_string(os.path.join(
base_dir
, 'conflicts'), path)
+ append_string(os.path.join(
get_base_dir()
, 'conflicts'), path)
sys.exit(1)
sys.exit(1)
@@
-121,7
+113,7
@@
def __conflict():
# $2 - file in branch1 SHA1 (or empty)
# $3 - file in branch2 SHA1 (or empty)
# $4 - pathname in repository
# $2 - file in branch1 SHA1 (or empty)
# $3 - file in branch2 SHA1 (or empty)
# $4 - pathname in repository
-# $5 - orignal file mode (or empty)
+# $5 - orig
i
nal file mode (or empty)
# $6 - file in branch1 mode (or empty)
# $7 - file in branch2 mode (or empty)
#
# $6 - file in branch1 mode (or empty)
# $7 - file in branch2 mode (or empty)
#
@@
-140,7
+132,7
@@
__checkout_files()
if orig_hash:
# modified in both
if file1_hash and file2_hash:
if orig_hash:
# modified in both
if file1_hash and file2_hash:
- # if modes are the same (git-read-tree probably deal
ed
with it)
+ # if modes are the same (git-read-tree probably deal
t
with it)
if file1_hash == file2_hash:
if os.system('git-update-index --cacheinfo %s %s %s'
% (file1_mode, file1_hash, path)) != 0:
if file1_hash == file2_hash:
if os.system('git-update-index --cacheinfo %s %s %s'
% (file1_mode, file1_hash, path)) != 0:
@@
-242,8
+234,8
@@
else:
__remove_files()
sys.exit(os.system('git-checkout-index -u -f -- %s' % path))
__remove_files()
sys.exit(os.system('git-checkout-index -u -f -- %s' % path))
-# Un
-
handled case
-print >> sys.stderr, 'Error: Un
-
handled merge conflict'
+# Unhandled case
+print >> sys.stderr, 'Error: Unhandled merge conflict'
print >> sys.stderr, 'gitmergeonefile.py "%s" "%s" "%s" "%s" "%s" "%s" "%s"' \
% tuple(sys.argv[1:8])
__conflict()
print >> sys.stderr, 'gitmergeonefile.py "%s" "%s" "%s" "%s" "%s" "%s" "%s"' \
% tuple(sys.argv[1:8])
__conflict()