Commit 66be4f8a authored by Matthias Putz's avatar Matthias Putz

migrated to py33, init works so far (bug in links)

parent 2acbeb81
...@@ -79,7 +79,7 @@ class _GitCall(object): ...@@ -79,7 +79,7 @@ class _GitCall(object):
def version(self): def version(self):
p = GitCommand(None, ['--version'], capture_stdout=True) p = GitCommand(None, ['--version'], capture_stdout=True)
if p.Wait() == 0: if p.Wait() == 0:
return p.stdout return str(p.stdout, encoding='UTF-8')
return None return None
def version_tuple(self): def version_tuple(self):
...@@ -117,7 +117,7 @@ def git_require(min_version, fail=False): ...@@ -117,7 +117,7 @@ def git_require(min_version, fail=False):
return False return False
def _setenv(env, name, value): def _setenv(env, name, value):
env[name] = value.encode() env[name] = value.encode(encoding='UTF-8')
class GitCommand(object): class GitCommand(object):
def __init__(self, def __init__(self,
...@@ -164,7 +164,7 @@ class GitCommand(object): ...@@ -164,7 +164,7 @@ class GitCommand(object):
command = [GIT] command = [GIT]
if bare: if bare:
if gitdir: if gitdir:
_setenv(env, GIT_DIR, gitdir) env[GIT_DIR] = gitdir
cwd = None cwd = None
command.extend(cmdv) command.extend(cmdv)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
from __future__ import print_function from __future__ import print_function
import cPickle import pickle
import os import os
import re import re
import subprocess import subprocess
...@@ -262,7 +262,7 @@ class GitConfig(object): ...@@ -262,7 +262,7 @@ class GitConfig(object):
Trace(': unpickle %s', self.file) Trace(': unpickle %s', self.file)
fd = open(self._pickle, 'rb') fd = open(self._pickle, 'rb')
try: try:
return cPickle.load(fd) return pickle.load(fd)
finally: finally:
fd.close() fd.close()
except EOFError: except EOFError:
...@@ -271,7 +271,7 @@ class GitConfig(object): ...@@ -271,7 +271,7 @@ class GitConfig(object):
except IOError: except IOError:
os.remove(self._pickle) os.remove(self._pickle)
return None return None
except cPickle.PickleError: except pickle.PickleError:
os.remove(self._pickle) os.remove(self._pickle)
return None return None
...@@ -279,13 +279,13 @@ class GitConfig(object): ...@@ -279,13 +279,13 @@ class GitConfig(object):
try: try:
fd = open(self._pickle, 'wb') fd = open(self._pickle, 'wb')
try: try:
cPickle.dump(cache, fd, cPickle.HIGHEST_PROTOCOL) pickle.dump(cache, fd, pickle.HIGHEST_PROTOCOL)
finally: finally:
fd.close() fd.close()
except IOError: except IOError:
if os.path.exists(self._pickle): if os.path.exists(self._pickle):
os.remove(self._pickle) os.remove(self._pickle)
except cPickle.PickleError: except pickle.PickleError:
if os.path.exists(self._pickle): if os.path.exists(self._pickle):
os.remove(self._pickle) os.remove(self._pickle)
...@@ -324,7 +324,7 @@ class GitConfig(object): ...@@ -324,7 +324,7 @@ class GitConfig(object):
capture_stdout = True, capture_stdout = True,
capture_stderr = True) capture_stderr = True)
if p.Wait() == 0: if p.Wait() == 0:
return p.stdout return str(p.stdout, encoding='UTF-8')
else: else:
GitError('git config %s: %s' % (str(args), p.stderr)) GitError('git config %s: %s' % (str(args), p.stderr))
...@@ -701,7 +701,7 @@ class Branch(object): ...@@ -701,7 +701,7 @@ class Branch(object):
self._Set('merge', self.merge) self._Set('merge', self.merge)
else: else:
fd = open(self._config.file, 'ab') fd = open(self._config.file, 'at')
try: try:
fd.write('[branch "%s"]\n' % self.name) fd.write('[branch "%s"]\n' % self.name)
if self.remote: if self.remote:
......
...@@ -66,7 +66,7 @@ class GitRefs(object): ...@@ -66,7 +66,7 @@ class GitRefs(object):
def _NeedUpdate(self): def _NeedUpdate(self):
Trace(': scan refs %s', self._gitdir) Trace(': scan refs %s', self._gitdir)
for name, mtime in self._mtime.iteritems(): for name, mtime in self._mtime.items():
try: try:
if mtime != os.path.getmtime(os.path.join(self._gitdir, name)): if mtime != os.path.getmtime(os.path.join(self._gitdir, name)):
return True return True
...@@ -89,7 +89,7 @@ class GitRefs(object): ...@@ -89,7 +89,7 @@ class GitRefs(object):
attempts = 0 attempts = 0
while scan and attempts < 5: while scan and attempts < 5:
scan_next = {} scan_next = {}
for name, dest in scan.iteritems(): for name, dest in scan.items():
if dest in self._phyref: if dest in self._phyref:
self._phyref[name] = self._phyref[dest] self._phyref[name] = self._phyref[dest]
else: else:
...@@ -100,7 +100,7 @@ class GitRefs(object): ...@@ -100,7 +100,7 @@ class GitRefs(object):
def _ReadPackedRefs(self): def _ReadPackedRefs(self):
path = os.path.join(self._gitdir, 'packed-refs') path = os.path.join(self._gitdir, 'packed-refs')
try: try:
fd = open(path, 'rb') fd = open(path, 'rt')
mtime = os.path.getmtime(path) mtime = os.path.getmtime(path)
except IOError: except IOError:
return return
...@@ -137,7 +137,7 @@ class GitRefs(object): ...@@ -137,7 +137,7 @@ class GitRefs(object):
def _ReadLoose1(self, path, name): def _ReadLoose1(self, path, name):
try: try:
fd = open(path, 'rb') fd = open(path, 'rt')
except IOError: except IOError:
return return
......
...@@ -50,6 +50,17 @@ from pager import RunPager ...@@ -50,6 +50,17 @@ from pager import RunPager
from subcmds import all_commands from subcmds import all_commands
REMOTE_DBG = True
if REMOTE_DBG:
try:
sys.path.append("C:\Program Files\eclipsePython\plugins\org.python.pydev_2.7.1.2012100913\pysrc")
import pydevd as pydevd
# stdoutToServer and stderrToServer redirect stdout and stderr to eclipse console
pydevd.settrace('localhost', stdoutToServer=True, stderrToServer=True)
except ImportError:
sys.stderr.write("Error: you must add pydevd in a pysrc folder (e.g. in eclipse plugin) to your PYTHONPATH.")
sys.exit(1)
global_options = optparse.OptionParser( global_options = optparse.OptionParser(
usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]" usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]"
) )
......
...@@ -18,8 +18,9 @@ import itertools ...@@ -18,8 +18,9 @@ import itertools
import os import os
import re import re
import sys import sys
import urlparse import urllib
import xml.dom.minidom import xml.dom.minidom
import xml.parsers.expat
from git_config import GitConfig from git_config import GitConfig
from git_refs import R_HEADS, HEAD from git_refs import R_HEADS, HEAD
...@@ -30,8 +31,8 @@ MANIFEST_FILE_NAME = 'manifest.xml' ...@@ -30,8 +31,8 @@ MANIFEST_FILE_NAME = 'manifest.xml'
LOCAL_MANIFEST_NAME = 'local_manifest.xml' LOCAL_MANIFEST_NAME = 'local_manifest.xml'
LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' LOCAL_MANIFESTS_DIR_NAME = 'local_manifests'
urlparse.uses_relative.extend(['ssh', 'git']) urllib.parse.uses_relative.extend(['ssh', 'git'])
urlparse.uses_netloc.extend(['ssh', 'git']) urllib.parse.uses_netloc.extend(['ssh', 'git'])
class _Default(object): class _Default(object):
"""Project defaults within the manifest.""" """Project defaults within the manifest."""
...@@ -73,7 +74,7 @@ class _XmlRemote(object): ...@@ -73,7 +74,7 @@ class _XmlRemote(object):
# ie, if manifestUrl is of the form <hostname:port> # ie, if manifestUrl is of the form <hostname:port>
if manifestUrl.find(':') != manifestUrl.find('/') - 1: if manifestUrl.find(':') != manifestUrl.find('/') - 1:
manifestUrl = 'gopher://' + manifestUrl manifestUrl = 'gopher://' + manifestUrl
url = urlparse.urljoin(manifestUrl, url) url = urllib.parse.urljoin(manifestUrl, url)
url = re.sub(r'^gopher://', '', url) url = re.sub(r'^gopher://', '', url)
if p: if p:
url = 'persistent-' + url url = 'persistent-' + url
...@@ -388,9 +389,9 @@ class XmlManifest(object): ...@@ -388,9 +389,9 @@ class XmlManifest(object):
name = self._reqatt(node, 'name') name = self._reqatt(node, 'name')
fp = os.path.join(include_root, name) fp = os.path.join(include_root, name)
if not os.path.isfile(fp): if not os.path.isfile(fp):
raise ManifestParseError, \ raise ManifestParseError(\
"include %s doesn't exist or isn't a file" % \ "include %s doesn't exist or isn't a file" % \
(name,) (name,))
try: try:
nodes.extend(self._ParseManifestXml(fp, include_root)) nodes.extend(self._ParseManifestXml(fp, include_root))
# should isolate this to the exact exception, but that's # should isolate this to the exact exception, but that's
...@@ -496,7 +497,7 @@ class XmlManifest(object): ...@@ -496,7 +497,7 @@ class XmlManifest(object):
name = None name = None
m_url = m.GetRemote(m.remote.name).url m_url = m.GetRemote(m.remote.name).url
if m_url.endswith('/.git'): if m_url.endswith('/.git'):
raise ManifestParseError, 'refusing to mirror %s' % m_url raise ManifestParseError('refusing to mirror %s' % m_url)
if self._default and self._default.remote: if self._default and self._default.remote:
url = self._default.remote.resolvedFetchUrl url = self._default.remote.resolvedFetchUrl
...@@ -590,7 +591,7 @@ class XmlManifest(object): ...@@ -590,7 +591,7 @@ class XmlManifest(object):
# Figure out minimum indentation, skipping the first line (the same line # Figure out minimum indentation, skipping the first line (the same line
# as the <notice> tag)... # as the <notice> tag)...
minIndent = sys.maxint minIndent = sys.maxsize
lines = notice.splitlines() lines = notice.splitlines()
for line in lines[1:]: for line in lines[1:]:
lstrippedLine = line.lstrip() lstrippedLine = line.lstrip()
...@@ -629,25 +630,25 @@ class XmlManifest(object): ...@@ -629,25 +630,25 @@ class XmlManifest(object):
if remote is None: if remote is None:
remote = self._default.remote remote = self._default.remote
if remote is None: if remote is None:
raise ManifestParseError, \ raise ManifestParseError(\
"no remote for project %s within %s" % \ "no remote for project %s within %s" % \
(name, self.manifestFile) (name, self.manifestFile))
revisionExpr = node.getAttribute('revision') revisionExpr = node.getAttribute('revision')
if not revisionExpr: if not revisionExpr:
revisionExpr = self._default.revisionExpr revisionExpr = self._default.revisionExpr
if not revisionExpr: if not revisionExpr:
raise ManifestParseError, \ raise ManifestParseError(\
"no revision for project %s within %s" % \ "no revision for project %s within %s" % \
(name, self.manifestFile) (name, self.manifestFile))
path = node.getAttribute('path') path = node.getAttribute('path')
if not path: if not path:
path = name path = name
if path.startswith('/'): if path.startswith('/'):
raise ManifestParseError, \ raise ManifestParseError(\
"project %s path cannot be absolute in %s" % \ "project %s path cannot be absolute in %s" % \
(name, self.manifestFile) (name, self.manifestFile))
rebase = node.getAttribute('rebase') rebase = node.getAttribute('rebase')
if not rebase: if not rebase:
...@@ -751,7 +752,7 @@ class XmlManifest(object): ...@@ -751,7 +752,7 @@ class XmlManifest(object):
except ManifestParseError: except ManifestParseError:
keep = "true" keep = "true"
if keep != "true" and keep != "false": if keep != "true" and keep != "false":
raise ManifestParseError, "optional \"keep\" attribute must be \"true\" or \"false\"" raise ManifestParseError("optional \"keep\" attribute must be \"true\" or \"false\"")
project.AddAnnotation(name, value, keep) project.AddAnnotation(name, value, keep)
def _get_remote(self, node): def _get_remote(self, node):
...@@ -761,9 +762,9 @@ class XmlManifest(object): ...@@ -761,9 +762,9 @@ class XmlManifest(object):
v = self._remotes.get(name) v = self._remotes.get(name)
if not v: if not v:
raise ManifestParseError, \ raise ManifestParseError(\
"remote %s not defined in %s" % \ "remote %s not defined in %s" % \
(name, self.manifestFile) (name, self.manifestFile))
return v return v
def _reqatt(self, node, attname): def _reqatt(self, node, attname):
...@@ -772,7 +773,7 @@ class XmlManifest(object): ...@@ -772,7 +773,7 @@ class XmlManifest(object):
""" """
v = node.getAttribute(attname) v = node.getAttribute(attname)
if not v: if not v:
raise ManifestParseError, \ raise ManifestParseError(\
"no %s in <%s> within %s" % \ "no %s in <%s> within %s" % \
(attname, node.nodeName, self.manifestFile) (attname, node.nodeName, self.manifestFile))
return v return v
...@@ -39,14 +39,14 @@ from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M ...@@ -39,14 +39,14 @@ from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M
def _lwrite(path, content): def _lwrite(path, content):
lock = '%s.lock' % path lock = '%s.lock' % path
fd = open(lock, 'wb') fd = open(lock, 'wt')
try: try:
fd.write(content) fd.write(content)
finally: finally:
fd.close() fd.close()
try: try:
os.rename(lock, path) os.replace(lock, path)
except OSError: except OSError:
os.remove(lock) os.remove(lock)
raise raise
...@@ -644,7 +644,7 @@ class Project(object): ...@@ -644,7 +644,7 @@ class Project(object):
all_refs = self._allrefs all_refs = self._allrefs
heads = {} heads = {}
for name, ref_id in all_refs.iteritems(): for name, ref_id in all_refs.items():
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
name = name[len(R_HEADS):] name = name[len(R_HEADS):]
b = self.GetBranch(name) b = self.GetBranch(name)
...@@ -653,7 +653,7 @@ class Project(object): ...@@ -653,7 +653,7 @@ class Project(object):
b.revision = ref_id b.revision = ref_id
heads[name] = b heads[name] = b
for name, ref_id in all_refs.iteritems(): for name, ref_id in all_refs.items():
if name.startswith(R_PUB): if name.startswith(R_PUB):
name = name[len(R_PUB):] name = name[len(R_PUB):]
b = heads.get(name) b = heads.get(name)
...@@ -849,13 +849,13 @@ class Project(object): ...@@ -849,13 +849,13 @@ class Project(object):
all_refs = self._allrefs all_refs = self._allrefs
heads = set() heads = set()
canrm = {} canrm = {}
for name, ref_id in all_refs.iteritems(): for name, ref_id in all_refs.items():
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
heads.add(name) heads.add(name)
elif name.startswith(R_PUB): elif name.startswith(R_PUB):
canrm[name] = ref_id canrm[name] = ref_id
for name, ref_id in canrm.iteritems(): for name, ref_id in canrm.items():
n = name[len(R_PUB):] n = name[len(R_PUB):]
if R_HEADS + n not in heads: if R_HEADS + n not in heads:
self.bare_git.DeleteRef(name, ref_id) self.bare_git.DeleteRef(name, ref_id)
...@@ -866,14 +866,14 @@ class Project(object): ...@@ -866,14 +866,14 @@ class Project(object):
heads = {} heads = {}
pubed = {} pubed = {}
for name, ref_id in self._allrefs.iteritems(): for name, ref_id in self._allrefs.items():
if name.startswith(R_HEADS): if name.startswith(R_HEADS):
heads[name[len(R_HEADS):]] = ref_id heads[name[len(R_HEADS):]] = ref_id
elif name.startswith(R_PUB): elif name.startswith(R_PUB):
pubed[name[len(R_PUB):]] = ref_id pubed[name[len(R_PUB):]] = ref_id
ready = [] ready = []
for branch, ref_id in heads.iteritems(): for branch, ref_id in heads.items():
if branch in pubed and pubed[branch] == ref_id: if branch in pubed and pubed[branch] == ref_id:
continue continue
if selected_branch and branch != selected_branch: if selected_branch and branch != selected_branch:
...@@ -1597,7 +1597,7 @@ class Project(object): ...@@ -1597,7 +1597,7 @@ class Project(object):
ids = set(all_refs.values()) ids = set(all_refs.values())
tmp = set() tmp = set()
for r, ref_id in GitRefs(ref_dir).all.iteritems(): for r, ref_id in GitRefs(ref_dir).all.items():
if r not in all_refs: if r not in all_refs:
if r.startswith(R_TAGS) or remote.WritesTo(r): if r.startswith(R_TAGS) or remote.WritesTo(r):
all_refs[r] = ref_id all_refs[r] = ref_id
...@@ -2074,7 +2074,7 @@ class Project(object): ...@@ -2074,7 +2074,7 @@ class Project(object):
else: else:
path = os.path.join(self._project.worktree, '.git', HEAD) path = os.path.join(self._project.worktree, '.git', HEAD)
try: try:
fd = open(path, 'rb') fd = open(path, 'rt')
except IOError: except IOError:
raise NoManifestException(path) raise NoManifestException(path)
try: try:
...@@ -2174,7 +2174,7 @@ class Project(object): ...@@ -2174,7 +2174,7 @@ class Project(object):
if not git_require((1, 7, 2)): if not git_require((1, 7, 2)):
raise ValueError('cannot set config on command line for %s()' raise ValueError('cannot set config on command line for %s()'
% name) % name)
for k, v in config.iteritems(): for k, v in config.items():
cmdv.append('-c') cmdv.append('-c')
cmdv.append('%s=%s' % (k, v)) cmdv.append('%s=%s' % (k, v))
cmdv.append(name) cmdv.append(name)
...@@ -2189,7 +2189,7 @@ class Project(object): ...@@ -2189,7 +2189,7 @@ class Project(object):
self._project.name, self._project.name,
name, name,
p.stderr)) p.stderr))
r = p.stdout r = str(p.stdout, encoding='UTF-8')
if r.endswith('\n') and r.index('\n') == len(r) - 1: if r.endswith('\n') and r.index('\n') == len(r) - 1:
return r[:-1] return r[:-1]
return r return r
......
...@@ -38,8 +38,8 @@ for py in os.listdir(my_dir): ...@@ -38,8 +38,8 @@ for py in os.listdir(my_dir):
try: try:
cmd = getattr(mod, clsn)() cmd = getattr(mod, clsn)()
except AttributeError: except AttributeError:
raise SyntaxError, '%s/%s does not define class %s' % ( raise SyntaxError('%s/%s does not define class %s' % (
__name__, py, clsn) __name__, py, clsn))
name = name.replace('_', '-') name = name.replace('_', '-')
cmd.NAME = name cmd.NAME = name
......
...@@ -98,7 +98,7 @@ is shown, then the branch appears in all projects. ...@@ -98,7 +98,7 @@ is shown, then the branch appears in all projects.
project_cnt = len(projects) project_cnt = len(projects)
for project in projects: for project in projects:
for name, b in project.GetBranches().iteritems(): for name, b in project.GetBranches().items():
b.project = project b.project = project
if name not in all_branches: if name not in all_branches:
all_branches[name] = BranchInfo(name) all_branches[name] = BranchInfo(name)
......
...@@ -55,7 +55,7 @@ change id will be added. ...@@ -55,7 +55,7 @@ change id will be added.
if p.Wait() != 0: if p.Wait() != 0:
print("error: Failed to retrieve old commit message", file=sys.stderr) print("error: Failed to retrieve old commit message", file=sys.stderr)
sys.exit(1) sys.exit(1)
old_msg = self._StripHeader(p.stdout) old_msg = self._StripHeader(str(p.stdout, encoding='UTF-8'))
p = GitCommand(None, p = GitCommand(None,
['cherry-pick', sha1], ['cherry-pick', sha1],
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
from __future__ import print_function from __future__ import print_function
import fcntl #import fcntl
import re import re
import os import os
import select import select
...@@ -218,47 +218,47 @@ without iterating through the remaining projects. ...@@ -218,47 +218,47 @@ without iterating through the remaining projects.
def fileno(self): def fileno(self):
return self.fd.fileno() return self.fd.fileno()
empty = True # empty = True
errbuf = '' # errbuf = ''
#
p.stdin.close() # p.stdin.close()
s_in = [sfd(p.stdout, sys.stdout), # s_in = [sfd(p.stdout, sys.stdout),
sfd(p.stderr, sys.stderr)] # sfd(p.stderr, sys.stderr)]
#
for s in s_in: # for s in s_in:
flags = fcntl.fcntl(s.fd, fcntl.F_GETFL) # flags = fcntl.fcntl(s.fd, fcntl.F_GETFL)
fcntl.fcntl(s.fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) # fcntl.fcntl(s.fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
#
while s_in: # while s_in:
in_ready, _out_ready, _err_ready = select.select(s_in, [], []) # in_ready, _out_ready, _err_ready = select.select(s_in, [], [])
for s in in_ready: # for s in in_ready:
buf = s.fd.read(4096) # buf = s.fd.read(4096)
if not buf: # if not buf:
s.fd.close() # s.fd.close()
s_in.remove(s) # s_in.remove(s)
continue # continue
#
if not opt.verbose: # if not opt.verbose:
if s.fd != p.stdout: # if s.fd != p.stdout:
errbuf += buf # errbuf += buf
continue # continue
#
if empty: # if empty:
if first: # if first:
first = False # first = False
else: # else:
out.nl() # out.nl()
out.project('project %s/', project.relpath) # out.project('project %s/', project.relpath)
out.nl() # out.nl()
out.flush() # out.flush()
if errbuf: # if errbuf:
sys.stderr.write(errbuf) # sys.stderr.write(errbuf)
sys.stderr.flush() # sys.stderr.flush()
errbuf = '' # errbuf = ''
empty = False # empty = False
#
s.dest.write(buf) # s.dest.write(buf)
s.dest.flush() # s.dest.flush()
r = p.wait() r = p.wait()
if r != 0: if r != 0:
......
...@@ -210,7 +210,7 @@ contain a line that matches both expressions: ...@@ -210,7 +210,7 @@ contain a line that matches both expressions:
# We cut the last element, to avoid a blank line. # We cut the last element, to avoid a blank line.
# #
r = p.stdout.split('\n') r = str(p.stdout, encoding='UTF-8').split('\n')
r = r[0:-1] r = r[0:-1]
if have_rev and full_name: if have_rev and full_name:
......
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
from optparse import SUPPRESS_HELP
import sys
from command import Command, MirrorSafeCommand
from subcmds.sync import _PostRepoUpgrade
from subcmds.sync import _PostRepoFetch
class Selfupdate(Command, MirrorSafeCommand):
common = False
helpSummary = "Update repo to the latest version"
helpUsage = """
%prog
"""
helpDescription = """
The '%prog' command upgrades repo to the latest version, if a
newer version is available.
Normally this is done automatically by 'repo sync' and does not
need to be performed by an end-user.
"""
def _Options(self, p):
g = p.add_option_group('repo Version options')
g.add_option('--no-repo-verify',
dest='no_repo_verify', action='store_true',
help='do not verify repo source code')
g.add_option('--repo-upgraded',
dest='repo_upgraded', action='store_true',
help=SUPPRESS_HELP)
def Execute(self, opt, args):
rp = self.manifest.repoProject
rp.PreSync()
if opt.repo_upgraded:
_PostRepoUpgrade(self.manifest)
else:
if not rp.Sync_NetworkHalf():
print("error: can't update repo", file=sys.stderr)
sys.exit(1)
rp.bare_git.gc('--auto')
_PostRepoFetch(rp,
no_repo_verify = opt.no_repo_verify,
verbose = True)
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
from command import PagedCommand from command import PagedCommand
try: #try:
import threading as _threading import threading as _threading
except ImportError: #except ImportError:
import dummy_threading as _threading # import dummy_threading as _threading
import glob import glob
import itertools import itertools
import os import os
import sys import sys
import StringIO import io
from color import Coloring from color import Coloring
...@@ -142,7 +142,7 @@ the following meanings: ...@@ -142,7 +142,7 @@ the following meanings:
for project in all_projects: for project in all_projects:
sem.acquire() sem.acquire()
class BufList(StringIO.StringIO): class BufList(io.StringIO.StringIO):
def dump(self, ostream): def dump(self, ostream):
for entry in self.buflist: for entry in self.buflist:
ostream.write(entry) ostream.write(entry)
...@@ -182,7 +182,7 @@ the following meanings: ...@@ -182,7 +182,7 @@ the following meanings:
try: try:
os.chdir(self.manifest.topdir) os.chdir(self.manifest.topdir)
outstring = StringIO.StringIO() outstring = io.StringIO.StringIO()
self._FindOrphans(glob.glob('.*') + \ self._FindOrphans(glob.glob('.*') + \
glob.glob('*'), \ glob.glob('*'), \
proj_dirs, proj_dirs_parents, outstring) proj_dirs, proj_dirs_parents, outstring)
......
...@@ -24,13 +24,13 @@ import socket ...@@ -24,13 +24,13 @@ import socket
import subprocess import subprocess
import sys import sys
import time import time
import urlparse import urllib
import xmlrpclib import xmlrpc
try: #try:
import threading as _threading import threading as _threading
except ImportError: #except ImportError:
import dummy_threading as _threading # import dummy_threading as _threading
try: try:
import resource import resource
...@@ -282,6 +282,8 @@ later is required to fix a server side protocol bug. ...@@ -282,6 +282,8 @@ later is required to fix a server side protocol bug.
else: else:
sys.exit(1) sys.exit(1)
else: else:
# TODO
# assume jobs=1 always
threads = set() threads = set()
lock = _threading.Lock() lock = _threading.Lock()
sem = _threading.Semaphore(self.jobs) sem = _threading.Semaphore(self.jobs)
...@@ -481,7 +483,7 @@ later is required to fix a server side protocol bug. ...@@ -481,7 +483,7 @@ later is required to fix a server side protocol bug.
file=sys.stderr) file=sys.stderr)
else: else:
try: try:
parse_result = urlparse.urlparse(manifest_server) parse_result = urllib.parse(manifest_server)
if parse_result.hostname: if parse_result.hostname:
username, _account, password = \ username, _account, password = \
info.authenticators(parse_result.hostname) info.authenticators(parse_result.hostname)
...@@ -499,7 +501,7 @@ later is required to fix a server side protocol bug. ...@@ -499,7 +501,7 @@ later is required to fix a server side protocol bug.
1) 1)
try: try:
server = xmlrpclib.Server(manifest_server) server = xmlrpc.server(manifest_server)
if opt.smart_sync: if opt.smart_sync:
p = self.manifest.manifestProject p = self.manifest.manifestProject
b = p.GetBranch(p.CurrentBranch) b = p.GetBranch(p.CurrentBranch)
...@@ -537,11 +539,11 @@ later is required to fix a server side protocol bug. ...@@ -537,11 +539,11 @@ later is required to fix a server side protocol bug.
else: else:
print('error: %s' % manifest_str, file=sys.stderr) print('error: %s' % manifest_str, file=sys.stderr)
sys.exit(1) sys.exit(1)
except (socket.error, IOError, xmlrpclib.Fault) as e: except (socket.error, IOError, xmlrpc.client.Fault) as e:
print('error: cannot connect to manifest server %s:\n%s' print('error: cannot connect to manifest server %s:\n%s'
% (self.manifest.manifest_server, e), file=sys.stderr) % (self.manifest.manifest_server, e), file=sys.stderr)
sys.exit(1) sys.exit(1)
except xmlrpclib.ProtocolError as e: except xmlrpc.client.ProtocolError as e:
print('error: cannot connect to manifest server %s:\n%d %s' print('error: cannot connect to manifest server %s:\n%d %s'
% (self.manifest.manifest_server, e.errcode, e.errmsg), % (self.manifest.manifest_server, e.errcode, e.errmsg),
file=sys.stderr) file=sys.stderr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment