##// END OF EJS Templates
convert: read git output in binary mode under Windows (issue 1359)
Patrick Mezard -
r7222:c1dc903d default
parent child Browse files
Show More
@@ -14,7 +14,7 b' class convert_git(converter_source):'
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']
@@ -22,7 +22,7 b' class convert_git(converter_source):'
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)
@@ -130,3 +130,20 b" splitrepo 'octopus merge' 'foo bar baz'"
130
130
131 splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
131 splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
132
132
133 echo
134 echo '% test binary conversion (issue 1359)'
135 mkdir git-repo3
136 cd git-repo3
137 git init-db >/dev/null 2>/dev/null
138 python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
139 git add b
140 commit -a -m addbinary
141 cd ..
142
143 echo '% convert binary file'
144 hg convert git-repo3 git-repo3-hg
145
146 cd git-repo3-hg
147 hg up -C
148 python -c 'print len(file("b", "rb").read())'
149
@@ -88,3 +88,13 b' o 0 "add foo" files: foo'
88 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
88 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz
89 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
89 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo
90 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
90 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux
91
92 % test binary conversion (issue 1359)
93 % convert binary file
94 initializing destination git-repo3-hg repository
95 scanning source...
96 sorting...
97 converting...
98 0 addbinary
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 4096
General Comments 0
You need to be logged in to leave comments. Login now