Mercurial > hg
comparison hgext/convert/git.py @ 7222:c1dc903dc7b6
convert: read git output in binary mode under Windows (issue 1359)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 23 Oct 2008 14:05:11 +0200 |
parents | e30c56f337b1 |
children | d1dff8c492dd a8e4e599e17f |
comparison
equal
deleted
inserted
replaced
7221:b340cb536893 | 7222:c1dc903dc7b6 |
---|---|
12 if hasattr(os, 'unsetenv'): | 12 if hasattr(os, 'unsetenv'): |
13 def gitcmd(self, s): | 13 def gitcmd(self, s): |
14 prevgitdir = os.environ.get('GIT_DIR') | 14 prevgitdir = os.environ.get('GIT_DIR') |
15 os.environ['GIT_DIR'] = self.path | 15 os.environ['GIT_DIR'] = self.path |
16 try: | 16 try: |
17 return util.popen(s) | 17 return util.popen(s, 'rb') |
18 finally: | 18 finally: |
19 if prevgitdir is None: | 19 if prevgitdir is None: |
20 del os.environ['GIT_DIR'] | 20 del os.environ['GIT_DIR'] |
21 else: | 21 else: |
22 os.environ['GIT_DIR'] = prevgitdir | 22 os.environ['GIT_DIR'] = prevgitdir |
23 else: | 23 else: |
24 def gitcmd(self, s): | 24 def gitcmd(self, s): |
25 return util.popen('GIT_DIR=%s %s' % (self.path, s)) | 25 return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb') |
26 | 26 |
27 def __init__(self, ui, path, rev=None): | 27 def __init__(self, ui, path, rev=None): |
28 super(convert_git, self).__init__(ui, path, rev=rev) | 28 super(convert_git, self).__init__(ui, path, rev=rev) |
29 | 29 |
30 if os.path.isdir(path + "/.git"): | 30 if os.path.isdir(path + "/.git"): |