equal
deleted
inserted
replaced
12 return s.decode("latin-1").encode("utf-8") |
12 return s.decode("latin-1").encode("utf-8") |
13 except: |
13 except: |
14 return s.decode("utf-8", "replace").encode("utf-8") |
14 return s.decode("utf-8", "replace").encode("utf-8") |
15 |
15 |
16 class convert_git(converter_source): |
16 class convert_git(converter_source): |
17 def gitcmd(self, s): |
17 # Windows does not support GIT_DIR= construct while other systems |
18 return os.popen('GIT_DIR=%s %s' % (self.path, s)) |
18 # cannot remove environment variable. Just assume none have |
|
19 # both issues. |
|
20 if hasattr(os, 'unsetenv'): |
|
21 def gitcmd(self, s): |
|
22 prevgitdir = os.environ.get('GIT_DIR') |
|
23 os.environ['GIT_DIR'] = self.path |
|
24 try: |
|
25 return os.popen(s) |
|
26 finally: |
|
27 if prevgitdir is None: |
|
28 del os.environ['GIT_DIR'] |
|
29 else: |
|
30 os.environ['GIT_DIR'] = prevgitdir |
|
31 else: |
|
32 def gitcmd(self, s): |
|
33 return os.popen('GIT_DIR=%s %s' % (self.path, s)) |
19 |
34 |
20 def __init__(self, ui, path): |
35 def __init__(self, ui, path): |
21 if os.path.isdir(path + "/.git"): |
36 if os.path.isdir(path + "/.git"): |
22 path += "/.git" |
37 path += "/.git" |
23 self.path = path |
38 self.path = path |