Merge "Teach _LinkFile._Link to handle globs."
diff --git a/error.py b/error.py
index ff948f9..f2a7c4e 100644
--- a/error.py
+++ b/error.py
@@ -80,7 +80,7 @@
self.name = name
def __str__(self):
- if self.Name is None:
+ if self.name is None:
return 'in current directory'
return self.name
@@ -93,7 +93,7 @@
self.name = name
def __str__(self):
- if self.Name is None:
+ if self.name is None:
return 'in current directory'
return self.name
diff --git a/git_command.py b/git_command.py
index 259fb02..0893bff 100644
--- a/git_command.py
+++ b/git_command.py
@@ -92,7 +92,10 @@
def version(self):
p = GitCommand(None, ['--version'], capture_stdout=True)
if p.Wait() == 0:
- return p.stdout.decode('utf-8')
+ if hasattr(p.stdout, 'decode'):
+ return p.stdout.decode('utf-8')
+ else:
+ return p.stdout
return None
def version_tuple(self):
@@ -263,6 +266,8 @@
if not buf:
s_in.remove(s)
continue
+ if not hasattr(buf, 'encode'):
+ buf = buf.decode()
if s.std_name == 'stdout':
self.stdout += buf
else:
diff --git a/git_config.py b/git_config.py
index c4c31e1..8ded7c2 100644
--- a/git_config.py
+++ b/git_config.py
@@ -280,7 +280,7 @@
finally:
fd.close()
except (IOError, TypeError):
- if os.path.exists(self.json):
+ if os.path.exists(self._json):
os.remove(self._json)
def _ReadGit(self):
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 6a6d30c..ebc8bec 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -278,7 +278,9 @@
def setenv(name, val):
if val is None:
val = ''
- env[name] = val.encode()
+ if hasattr(val, 'encode'):
+ val = val.encode()
+ env[name] = val
setenv('REPO_PROJECT', project['name'])
setenv('REPO_PATH', project['relpath'])
diff --git a/subcmds/init.py b/subcmds/init.py
index b73de71..dbb6ddd 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -27,7 +27,7 @@
import imp
import urlparse
urllib = imp.new_module('urllib')
- urllib.parse = urlparse.urlparse
+ urllib.parse = urlparse
from color import Coloring
from command import InteractiveCommand, MirrorSafeCommand
@@ -153,7 +153,7 @@
# server where this git is located, so let's save that here.
mirrored_manifest_git = None
if opt.reference:
- manifest_git_path = urllib.parse(opt.manifest_url).path[1:]
+ manifest_git_path = urllib.parse.urlparse(opt.manifest_url).path[1:]
mirrored_manifest_git = os.path.join(opt.reference, manifest_git_path)
if not mirrored_manifest_git.endswith(".git"):
mirrored_manifest_git += ".git"