summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Rahmatullin <wrar@wrar.name>2012-06-18 14:36:23 +0600
committerAndrey Rahmatullin <wrar@wrar.name>2012-06-18 14:36:23 +0600
commit0428cbd340cbfa2eb0188877dc7c632055849f5a (patch)
treeeadf1653637ccf5f9c7d1306a469a0697cf241ad
parentbb48a9ddcba06d79c75d07a4c04fe863d6c20486 (diff)
parent11224c6c0b48d5eb0207307a9b503f611dc7ffc5 (diff)
downloadhg-fast-export-0428cbd340cbfa2eb0188877dc7c632055849f5a.tar.gz
Merge branch 'upstream'
-rwxr-xr-xhg-fast-export.py8
-rwxr-xr-xhg2git.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/hg-fast-export.py b/hg-fast-export.py
index 2da0289..076d432 100755
--- a/hg-fast-export.py
+++ b/hg-fast-export.py
@@ -23,9 +23,9 @@ def gitmode(flags):
return 'l' in flags and '120000' or 'x' in flags and '100755' or '100644'
def wr(msg=''):
- if msg == None:
- msg = ''
- print msg
+ if msg:
+ sys.stdout.write(msg)
+ sys.stdout.write('\n')
#map(lambda x: sys.stderr.write('\t[%s]\n' % x),msg.split('\n'))
def checkpoint(count):
@@ -140,7 +140,7 @@ def sanitize_name(name,what="branch"):
n=name
p=re.compile('([[ ~^:?*]|\.\.)')
n=p.sub('_', n)
- if n[-1] == '/': n=n[:-1]+'_'
+ if n[-1] in ('/', '.'): n=n[:-1]+'_'
n='/'.join(map(dot,n.split('/')))
p=re.compile('_+')
n=p.sub('_', n)
diff --git a/hg2git.py b/hg2git.py
index ecaac17..9c76dc8 100755
--- a/hg2git.py
+++ b/hg2git.py
@@ -102,7 +102,7 @@ def save_cache(filename,cache):
def get_git_sha1(name,type='heads'):
try:
# use git-rev-parse to support packed refs
- cmd="GIT_DIR='%s' git rev-parse --verify refs/%s/%s 2>/dev/null" % (os.getenv('GIT_DIR','/dev/null'),type,name)
+ cmd="git rev-parse --verify refs/%s/%s 2>%s" % (type,name,os.devnull)
p=os.popen(cmd)
l=p.readline()
p.close()