comparison hgext/convert/git.py @ 5232:7d3dcdd92a1a

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Sun, 26 Aug 2007 16:49:26 +0200
parents ef338e34a906 149742a628fd
children 20770c5d41e0
comparison
equal deleted inserted replaced
5227:a1efa71f3ece 5232:7d3dcdd92a1a
3 import os 3 import os
4 4
5 from common import NoRepo, commit, converter_source 5 from common import NoRepo, commit, converter_source
6 6
7 class convert_git(converter_source): 7 class convert_git(converter_source):
8 def gitcmd(self, s): 8 # Windows does not support GIT_DIR= construct while other systems
9 return os.popen('GIT_DIR=%s %s' % (self.path, s)) 9 # cannot remove environment variable. Just assume none have
10 # both issues.
11 if hasattr(os, 'unsetenv'):
12 def gitcmd(self, s):
13 prevgitdir = os.environ.get('GIT_DIR')
14 os.environ['GIT_DIR'] = self.path
15 try:
16 return os.popen(s)
17 finally:
18 if prevgitdir is None:
19 del os.environ['GIT_DIR']
20 else:
21 os.environ['GIT_DIR'] = prevgitdir
22 else:
23 def gitcmd(self, s):
24 return os.popen('GIT_DIR=%s %s' % (self.path, s))
10 25
11 def __init__(self, ui, path, rev=None): 26 def __init__(self, ui, path, rev=None):
12 super(convert_git, self).__init__(ui, path, rev=rev) 27 super(convert_git, self).__init__(ui, path, rev=rev)
13 28
14 if os.path.isdir(path + "/.git"): 29 if os.path.isdir(path + "/.git"):