mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Change print statements to work in python3
This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
This commit is contained in:
parent
fc241240d8
commit
cecd1d864f
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -53,10 +54,10 @@ class Editor(object):
|
|||||||
return e
|
return e
|
||||||
|
|
||||||
if os.getenv('TERM') == 'dumb':
|
if os.getenv('TERM') == 'dumb':
|
||||||
print >>sys.stderr,\
|
print(
|
||||||
"""No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR.
|
"""No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR.
|
||||||
Tried to fall back to vi but terminal is dumb. Please configure at
|
Tried to fall back to vi but terminal is dumb. Please configure at
|
||||||
least one of these before using this command."""
|
least one of these before using this command.""", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return 'vi'
|
return 'vi'
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -92,7 +93,7 @@ class _GitCall(object):
|
|||||||
ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
|
ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'fatal: "%s" unsupported' % ver_str
|
print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return _git_version
|
return _git_version
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ def git_require(min_version, fail=False):
|
|||||||
return True
|
return True
|
||||||
if fail:
|
if fail:
|
||||||
need = '.'.join(map(str, min_version))
|
need = '.'.join(map(str, min_version))
|
||||||
print >>sys.stderr, 'fatal: git %s or later required' % need
|
print('fatal: git %s or later required' % need, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import cPickle
|
import cPickle
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -463,9 +464,8 @@ def _open_ssh(host, port=None):
|
|||||||
p = subprocess.Popen(command)
|
p = subprocess.Popen(command)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_ssh_master = False
|
_ssh_master = False
|
||||||
print >>sys.stderr, \
|
print('\nwarn: cannot enable ssh control master for %s:%s\n%s'
|
||||||
'\nwarn: cannot enable ssh control master for %s:%s\n%s' \
|
% (host,port, str(e)), file=sys.stderr)
|
||||||
% (host,port, str(e))
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
_master_processes.append(p)
|
_master_processes.append(p)
|
||||||
|
50
main.py
50
main.py
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import getpass
|
import getpass
|
||||||
import imp
|
import imp
|
||||||
import netrc
|
import netrc
|
||||||
@ -98,15 +99,14 @@ class _Repo(object):
|
|||||||
if name == 'help':
|
if name == 'help':
|
||||||
name = 'version'
|
name = 'version'
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'fatal: invalid usage of --version'
|
print('fatal: invalid usage of --version', file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = self.commands[name]
|
cmd = self.commands[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print >>sys.stderr,\
|
print("repo: '%s' is not a repo command. See 'repo help'." % name,
|
||||||
"repo: '%s' is not a repo command. See 'repo help'."\
|
file=sys.stderr)
|
||||||
% name
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
cmd.repodir = self.repodir
|
cmd.repodir = self.repodir
|
||||||
@ -114,9 +114,8 @@ class _Repo(object):
|
|||||||
Editor.globalConfig = cmd.manifest.globalConfig
|
Editor.globalConfig = cmd.manifest.globalConfig
|
||||||
|
|
||||||
if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror:
|
if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror:
|
||||||
print >>sys.stderr, \
|
print("fatal: '%s' requires a working directory" % name,
|
||||||
"fatal: '%s' requires a working directory"\
|
file=sys.stderr)
|
||||||
% name
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
copts, cargs = cmd.OptionParser.parse_args(argv)
|
copts, cargs = cmd.OptionParser.parse_args(argv)
|
||||||
@ -142,22 +141,21 @@ class _Repo(object):
|
|||||||
minutes, seconds = divmod(remainder, 60)
|
minutes, seconds = divmod(remainder, 60)
|
||||||
if gopts.time:
|
if gopts.time:
|
||||||
if hours == 0:
|
if hours == 0:
|
||||||
print >>sys.stderr, 'real\t%dm%.3fs' \
|
print('real\t%dm%.3fs' % (minutes, seconds), file=sys.stderr)
|
||||||
% (minutes, seconds)
|
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'real\t%dh%dm%.3fs' \
|
print('real\t%dh%dm%.3fs' % (hours, minutes, seconds),
|
||||||
% (hours, minutes, seconds)
|
file=sys.stderr)
|
||||||
except DownloadError as e:
|
except DownloadError as e:
|
||||||
print >>sys.stderr, 'error: %s' % str(e)
|
print('error: %s' % str(e), file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
except ManifestInvalidRevisionError as e:
|
except ManifestInvalidRevisionError as e:
|
||||||
print >>sys.stderr, 'error: %s' % str(e)
|
print('error: %s' % str(e), file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
except NoSuchProjectError as e:
|
except NoSuchProjectError as e:
|
||||||
if e.name:
|
if e.name:
|
||||||
print >>sys.stderr, 'error: project %s not found' % e.name
|
print('error: project %s not found' % e.name, file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'error: no project in current directory'
|
print('error: no project in current directory', file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -183,7 +181,7 @@ def _CheckWrapperVersion(ver, repo_path):
|
|||||||
repo_path = '~/bin/repo'
|
repo_path = '~/bin/repo'
|
||||||
|
|
||||||
if not ver:
|
if not ver:
|
||||||
print >>sys.stderr, 'no --wrapper-version argument'
|
print('no --wrapper-version argument', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
exp = _CurrentWrapperVersion()
|
exp = _CurrentWrapperVersion()
|
||||||
@ -193,25 +191,25 @@ def _CheckWrapperVersion(ver, repo_path):
|
|||||||
|
|
||||||
exp_str = '.'.join(map(str, exp))
|
exp_str = '.'.join(map(str, exp))
|
||||||
if exp[0] > ver[0] or ver < (0, 4):
|
if exp[0] > ver[0] or ver < (0, 4):
|
||||||
print >>sys.stderr, """
|
print("""
|
||||||
!!! A new repo command (%5s) is available. !!!
|
!!! A new repo command (%5s) is available. !!!
|
||||||
!!! You must upgrade before you can continue: !!!
|
!!! You must upgrade before you can continue: !!!
|
||||||
|
|
||||||
cp %s %s
|
cp %s %s
|
||||||
""" % (exp_str, _MyWrapperPath(), repo_path)
|
""" % (exp_str, _MyWrapperPath(), repo_path), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if exp > ver:
|
if exp > ver:
|
||||||
print >>sys.stderr, """
|
print("""
|
||||||
... A new repo command (%5s) is available.
|
... A new repo command (%5s) is available.
|
||||||
... You should upgrade soon:
|
... You should upgrade soon:
|
||||||
|
|
||||||
cp %s %s
|
cp %s %s
|
||||||
""" % (exp_str, _MyWrapperPath(), repo_path)
|
""" % (exp_str, _MyWrapperPath(), repo_path), file=sys.stderr)
|
||||||
|
|
||||||
def _CheckRepoDir(repo_dir):
|
def _CheckRepoDir(repo_dir):
|
||||||
if not repo_dir:
|
if not repo_dir:
|
||||||
print >>sys.stderr, 'no --repo-dir argument'
|
print('no --repo-dir argument', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _PruneOptions(argv, opt):
|
def _PruneOptions(argv, opt):
|
||||||
@ -281,7 +279,7 @@ def _AddPasswordFromUserInput(handler, msg, req):
|
|||||||
url = req.get_full_url()
|
url = req.get_full_url()
|
||||||
user, password = handler.passwd.find_user_password(None, url)
|
user, password = handler.passwd.find_user_password(None, url)
|
||||||
if user is None:
|
if user is None:
|
||||||
print msg
|
print(msg)
|
||||||
try:
|
try:
|
||||||
user = raw_input('User: ')
|
user = raw_input('User: ')
|
||||||
password = getpass.getpass()
|
password = getpass.getpass()
|
||||||
@ -388,10 +386,10 @@ def _Main(argv):
|
|||||||
finally:
|
finally:
|
||||||
close_ssh()
|
close_ssh()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print >>sys.stderr, 'aborted by user'
|
print('aborted by user', file=sys.stderr)
|
||||||
result = 1
|
result = 1
|
||||||
except ManifestParseError as mpe:
|
except ManifestParseError as mpe:
|
||||||
print >>sys.stderr, 'fatal: %s' % mpe
|
print('fatal: %s' % mpe, file=sys.stderr)
|
||||||
result = 1
|
result = 1
|
||||||
except RepoChangedException as rce:
|
except RepoChangedException as rce:
|
||||||
# If repo changed, re-exec ourselves.
|
# If repo changed, re-exec ourselves.
|
||||||
@ -401,8 +399,8 @@ def _Main(argv):
|
|||||||
try:
|
try:
|
||||||
os.execv(__file__, argv)
|
os.execv(__file__, argv)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, 'fatal: cannot restart repo after upgrade'
|
print('fatal: cannot restart repo after upgrade', file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: %s' % e
|
print('fatal: %s' % e, file=sys.stderr)
|
||||||
result = 128
|
result = 128
|
||||||
|
|
||||||
sys.exit(result)
|
sys.exit(result)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -306,8 +307,9 @@ class XmlManifest(object):
|
|||||||
|
|
||||||
local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
|
local = os.path.join(self.repodir, LOCAL_MANIFEST_NAME)
|
||||||
if os.path.exists(local):
|
if os.path.exists(local):
|
||||||
print >>sys.stderr, 'warning: %s is deprecated; put local manifests in %s instead' % \
|
print('warning: %s is deprecated; put local manifests in %s instead'
|
||||||
(LOCAL_MANIFEST_NAME, LOCAL_MANIFESTS_DIR_NAME)
|
% (LOCAL_MANIFEST_NAME, LOCAL_MANIFESTS_DIR_NAME),
|
||||||
|
file=sys.stderr)
|
||||||
nodes.append(self._ParseManifestXml(local, self.repodir))
|
nodes.append(self._ParseManifestXml(local, self.repodir))
|
||||||
|
|
||||||
local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME))
|
local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME))
|
||||||
@ -317,7 +319,7 @@ class XmlManifest(object):
|
|||||||
try:
|
try:
|
||||||
nodes.append(self._ParseManifestXml(local_file, self.repodir))
|
nodes.append(self._ParseManifestXml(local_file, self.repodir))
|
||||||
except ManifestParseError as e:
|
except ManifestParseError as e:
|
||||||
print >>sys.stderr, '%s' % str(e)
|
print('%s' % str(e), file=sys.stderr)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
3
pager.py
3
pager.py
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import select
|
import select
|
||||||
import sys
|
import sys
|
||||||
@ -49,7 +50,7 @@ def RunPager(globalConfig):
|
|||||||
|
|
||||||
_BecomePager(pager)
|
_BecomePager(pager)
|
||||||
except Exception:
|
except Exception:
|
||||||
print >>sys.stderr, "fatal: cannot start pager '%s'" % pager
|
print("fatal: cannot start pager '%s'" % pager, file=sys.stderr)
|
||||||
sys.exit(255)
|
sys.exit(255)
|
||||||
|
|
||||||
def _SelectPager(globalConfig):
|
def _SelectPager(globalConfig):
|
||||||
|
14
project.py
14
project.py
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import traceback
|
import traceback
|
||||||
import errno
|
import errno
|
||||||
import filecmp
|
import filecmp
|
||||||
@ -50,7 +51,7 @@ def _lwrite(path, content):
|
|||||||
|
|
||||||
def _error(fmt, *args):
|
def _error(fmt, *args):
|
||||||
msg = fmt % args
|
msg = fmt % args
|
||||||
print >>sys.stderr, 'error: %s' % msg
|
print('error: %s' % msg, file=sys.stderr)
|
||||||
|
|
||||||
def not_rev(r):
|
def not_rev(r):
|
||||||
return '^' + r
|
return '^' + r
|
||||||
@ -683,9 +684,9 @@ class Project(object):
|
|||||||
if not os.path.isdir(self.worktree):
|
if not os.path.isdir(self.worktree):
|
||||||
if output_redir == None:
|
if output_redir == None:
|
||||||
output_redir = sys.stdout
|
output_redir = sys.stdout
|
||||||
print >>output_redir, ''
|
print(file=output_redir)
|
||||||
print >>output_redir, 'project %s/' % self.relpath
|
print('project %s/' % self.relpath, file=output_redir)
|
||||||
print >>output_redir, ' missing (run "repo sync")'
|
print(' missing (run "repo sync")', file=output_redir)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.work_git.update_index('-q',
|
self.work_git.update_index('-q',
|
||||||
@ -785,7 +786,7 @@ class Project(object):
|
|||||||
out.project('project %s/' % self.relpath)
|
out.project('project %s/' % self.relpath)
|
||||||
out.nl()
|
out.nl()
|
||||||
has_diff = True
|
has_diff = True
|
||||||
print line[:-1]
|
print(line[:-1])
|
||||||
p.Wait()
|
p.Wait()
|
||||||
|
|
||||||
|
|
||||||
@ -1586,7 +1587,8 @@ class Project(object):
|
|||||||
# returned another error with the HTTP error code being 400 or above.
|
# returned another error with the HTTP error code being 400 or above.
|
||||||
# This return code only appears if -f, --fail is used.
|
# This return code only appears if -f, --fail is used.
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print >> sys.stderr, "Server does not provide clone.bundle; ignoring."
|
print("Server does not provide clone.bundle; ignoring.",
|
||||||
|
file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if os.path.exists(tmpPath):
|
if os.path.exists(tmpPath):
|
||||||
|
126
repo
126
repo
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## repo default configuration
|
## repo default configuration
|
||||||
##
|
##
|
||||||
|
from __future__ import print_function
|
||||||
REPO_URL='https://gerrit.googlesource.com/git-repo'
|
REPO_URL='https://gerrit.googlesource.com/git-repo'
|
||||||
REPO_REV='stable'
|
REPO_REV='stable'
|
||||||
|
|
||||||
@ -215,16 +216,15 @@ def _Init(args):
|
|||||||
if branch.startswith('refs/heads/'):
|
if branch.startswith('refs/heads/'):
|
||||||
branch = branch[len('refs/heads/'):]
|
branch = branch[len('refs/heads/'):]
|
||||||
if branch.startswith('refs/'):
|
if branch.startswith('refs/'):
|
||||||
print >>sys.stderr, "fatal: invalid branch name '%s'" % branch
|
print("fatal: invalid branch name '%s'" % branch, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
if not os.path.isdir(repodir):
|
if not os.path.isdir(repodir):
|
||||||
try:
|
try:
|
||||||
os.mkdir(repodir)
|
os.mkdir(repodir)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, \
|
print('fatal: cannot make %s directory: %s'
|
||||||
'fatal: cannot make %s directory: %s' % (
|
% (repodir, e.strerror), file=sys.stderr)
|
||||||
repodir, e.strerror)
|
|
||||||
# Don't faise CloneFailure; that would delete the
|
# Don't faise CloneFailure; that would delete the
|
||||||
# name. Instead exit immediately.
|
# name. Instead exit immediately.
|
||||||
#
|
#
|
||||||
@ -248,8 +248,8 @@ def _Init(args):
|
|||||||
_Checkout(dst, branch, rev, opt.quiet)
|
_Checkout(dst, branch, rev, opt.quiet)
|
||||||
except CloneFailure:
|
except CloneFailure:
|
||||||
if opt.quiet:
|
if opt.quiet:
|
||||||
print >>sys.stderr, \
|
print('fatal: repo init failed; run without --quiet to see why',
|
||||||
'fatal: repo init failed; run without --quiet to see why'
|
file=sys.stderr)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
@ -258,12 +258,12 @@ def _CheckGitVersion():
|
|||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, "fatal: '%s' is not available" % GIT
|
print("fatal: '%s' is not available" % GIT, file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: %s' % e
|
print('fatal: %s' % e, file=sys.stderr)
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, 'Please make sure %s is installed'\
|
print('Please make sure %s is installed and in your path.' % GIT,
|
||||||
' and in your path.' % GIT
|
file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
ver_str = proc.stdout.read().strip()
|
ver_str = proc.stdout.read().strip()
|
||||||
@ -271,14 +271,14 @@ def _CheckGitVersion():
|
|||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
if not ver_str.startswith('git version '):
|
if not ver_str.startswith('git version '):
|
||||||
print >>sys.stderr, 'error: "%s" unsupported' % ver_str
|
print('error: "%s" unsupported' % ver_str, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
ver_str = ver_str[len('git version '):].strip()
|
ver_str = ver_str[len('git version '):].strip()
|
||||||
ver_act = tuple(map(int, ver_str.split('.')[0:3]))
|
ver_act = tuple(map(int, ver_str.split('.')[0:3]))
|
||||||
if ver_act < MIN_GIT_VERSION:
|
if ver_act < MIN_GIT_VERSION:
|
||||||
need = '.'.join(map(str, MIN_GIT_VERSION))
|
need = '.'.join(map(str, MIN_GIT_VERSION))
|
||||||
print >>sys.stderr, 'fatal: git %s or later required' % need
|
print('fatal: git %s or later required' % need, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
|
|
||||||
@ -305,18 +305,16 @@ def SetupGnuPG(quiet):
|
|||||||
try:
|
try:
|
||||||
os.mkdir(home_dot_repo)
|
os.mkdir(home_dot_repo)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, \
|
print('fatal: cannot make %s directory: %s'
|
||||||
'fatal: cannot make %s directory: %s' % (
|
% (home_dot_repo, e.strerror), file=sys.stderr)
|
||||||
home_dot_repo, e.strerror)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not os.path.isdir(gpg_dir):
|
if not os.path.isdir(gpg_dir):
|
||||||
try:
|
try:
|
||||||
os.mkdir(gpg_dir, stat.S_IRWXU)
|
os.mkdir(gpg_dir, stat.S_IRWXU)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, \
|
print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror),
|
||||||
'fatal: cannot make %s directory: %s' % (
|
file=sys.stderr)
|
||||||
gpg_dir, e.strerror)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@ -329,16 +327,16 @@ def SetupGnuPG(quiet):
|
|||||||
stdin = subprocess.PIPE)
|
stdin = subprocess.PIPE)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print >>sys.stderr, 'warning: gpg (GnuPG) is not available.'
|
print('warning: gpg (GnuPG) is not available.', file=sys.stderr)
|
||||||
print >>sys.stderr, 'warning: Installing it is strongly encouraged.'
|
print('warning: Installing it is strongly encouraged.', file=sys.stderr)
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
proc.stdin.write(MAINTAINER_KEYS)
|
proc.stdin.write(MAINTAINER_KEYS)
|
||||||
proc.stdin.close()
|
proc.stdin.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
print >>sys.stderr, 'fatal: registering repo maintainer keys failed'
|
print('fatal: registering repo maintainer keys failed', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print
|
print
|
||||||
|
|
||||||
@ -382,7 +380,7 @@ def _InitHttp():
|
|||||||
|
|
||||||
def _Fetch(url, local, src, quiet):
|
def _Fetch(url, local, src, quiet):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print >>sys.stderr, 'Get %s' % url
|
print('Get %s' % url, file=sys.stderr)
|
||||||
|
|
||||||
cmd = [GIT, 'fetch']
|
cmd = [GIT, 'fetch']
|
||||||
if quiet:
|
if quiet:
|
||||||
@ -431,16 +429,16 @@ def _DownloadBundle(url, local, quiet):
|
|||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
return False
|
return False
|
||||||
print >>sys.stderr, 'fatal: Cannot get %s' % url
|
print('fatal: Cannot get %s' % url, file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: HTTP error %s' % e.code
|
print('fatal: HTTP error %s' % e.code, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
print >>sys.stderr, 'fatal: Cannot get %s' % url
|
print('fatal: Cannot get %s' % url, file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: error %s' % e.reason
|
print('fatal: error %s' % e.reason, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
try:
|
try:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print >>sys.stderr, 'Get %s' % url
|
print('Get %s' % url, file=sys.stderr)
|
||||||
while True:
|
while True:
|
||||||
buf = r.read(8192)
|
buf = r.read(8192)
|
||||||
if buf == '':
|
if buf == '':
|
||||||
@ -464,24 +462,23 @@ def _Clone(url, local, quiet):
|
|||||||
try:
|
try:
|
||||||
os.mkdir(local)
|
os.mkdir(local)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, \
|
print('fatal: cannot make %s directory: %s' % (local, e.strerror),
|
||||||
'fatal: cannot make %s directory: %s' \
|
file=sys.stderr)
|
||||||
% (local, e.strerror)
|
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
cmd = [GIT, 'init', '--quiet']
|
cmd = [GIT, 'init', '--quiet']
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(cmd, cwd = local)
|
proc = subprocess.Popen(cmd, cwd = local)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, "fatal: '%s' is not available" % GIT
|
print("fatal: '%s' is not available" % GIT, file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: %s' % e
|
print('fatal: %s' % e, file=sys.stderr)
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, 'Please make sure %s is installed'\
|
print('Please make sure %s is installed and in your path.' % GIT,
|
||||||
' and in your path.' % GIT
|
file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
print >>sys.stderr, 'fatal: could not create %s' % local
|
print('fatal: could not create %s' % local, file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
_InitHttp()
|
_InitHttp()
|
||||||
@ -509,21 +506,18 @@ def _Verify(cwd, branch, quiet):
|
|||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
|
|
||||||
if proc.wait() != 0 or not cur:
|
if proc.wait() != 0 or not cur:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr,\
|
print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr)
|
||||||
"fatal: branch '%s' has not been signed" \
|
|
||||||
% branch
|
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
|
m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
|
||||||
if m:
|
if m:
|
||||||
cur = m.group(1)
|
cur = m.group(1)
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, \
|
print("info: Ignoring branch '%s'; using tagged release '%s'"
|
||||||
"info: Ignoring branch '%s'; using tagged release '%s'" \
|
% (branch, cur), file=sys.stderr)
|
||||||
% (branch, cur)
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr
|
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['GNUPGHOME'] = gpg_dir.encode()
|
env['GNUPGHOME'] = gpg_dir.encode()
|
||||||
@ -541,10 +535,10 @@ def _Verify(cwd, branch, quiet):
|
|||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, out
|
print(out, file=sys.stderr)
|
||||||
print >>sys.stderr, err
|
print(err, file=sys.stderr)
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
return '%s^0' % cur
|
return '%s^0' % cur
|
||||||
|
|
||||||
@ -611,7 +605,7 @@ def _ParseArguments(args):
|
|||||||
|
|
||||||
|
|
||||||
def _Usage():
|
def _Usage():
|
||||||
print >>sys.stderr,\
|
print(
|
||||||
"""usage: repo COMMAND [ARGS]
|
"""usage: repo COMMAND [ARGS]
|
||||||
|
|
||||||
repo is not yet installed. Use "repo init" to install it here.
|
repo is not yet installed. Use "repo init" to install it here.
|
||||||
@ -622,7 +616,7 @@ The most commonly used repo commands are:
|
|||||||
help Display detailed help on a command
|
help Display detailed help on a command
|
||||||
|
|
||||||
For access to the full online help, install repo ("repo init").
|
For access to the full online help, install repo ("repo init").
|
||||||
"""
|
""", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@ -632,25 +626,23 @@ def _Help(args):
|
|||||||
init_optparse.print_help()
|
init_optparse.print_help()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr,\
|
print("error: '%s' is not a bootstrap command.\n"
|
||||||
"error: '%s' is not a bootstrap command.\n"\
|
' For access to online help, install repo ("repo init").'
|
||||||
' For access to online help, install repo ("repo init").'\
|
% args[0], file=sys.stderr)
|
||||||
% args[0]
|
|
||||||
else:
|
else:
|
||||||
_Usage()
|
_Usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def _NotInstalled():
|
def _NotInstalled():
|
||||||
print >>sys.stderr,\
|
print('error: repo is not installed. Use "repo init" to install it here.',
|
||||||
'error: repo is not installed. Use "repo init" to install it here.'
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def _NoCommands(cmd):
|
def _NoCommands(cmd):
|
||||||
print >>sys.stderr,\
|
print("""error: command '%s' requires repo to be installed first.
|
||||||
"""error: command '%s' requires repo to be installed first.
|
Use "repo init" to install it here.""" % cmd, file=sys.stderr)
|
||||||
Use "repo init" to install it here.""" % cmd
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@ -687,7 +679,7 @@ def _SetDefaultsTo(gitdir):
|
|||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
print >>sys.stderr, 'fatal: %s has no current branch' % gitdir
|
print('fatal: %s has no current branch' % gitdir, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@ -736,8 +728,8 @@ def main(orig_args):
|
|||||||
try:
|
try:
|
||||||
os.execv(repo_main, me)
|
os.execv(repo_main, me)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, "fatal: unable to start %s" % repo_main
|
print("fatal: unable to start %s" % repo_main, file=sys.stderr)
|
||||||
print >>sys.stderr, "fatal: %s" % e
|
print("fatal: %s" % e, file=sys.stderr)
|
||||||
sys.exit(148)
|
sys.exit(148)
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from command import Command
|
from command import Command
|
||||||
from git_command import git
|
from git_command import git
|
||||||
@ -36,7 +37,7 @@ It is equivalent to "git branch -D <branchname>".
|
|||||||
|
|
||||||
nb = args[0]
|
nb = args[0]
|
||||||
if not git.check_ref_format('heads/%s' % nb):
|
if not git.check_ref_format('heads/%s' % nb):
|
||||||
print >>sys.stderr, "error: '%s' is not a valid name" % nb
|
print("error: '%s' is not a valid name" % nb, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
nb = args[0]
|
nb = args[0]
|
||||||
@ -58,13 +59,13 @@ It is equivalent to "git branch -D <branchname>".
|
|||||||
|
|
||||||
if err:
|
if err:
|
||||||
for p in err:
|
for p in err:
|
||||||
print >>sys.stderr,\
|
print("error: %s/: cannot abandon %s" % (p.relpath, nb),
|
||||||
"error: %s/: cannot abandon %s" \
|
file=sys.stderr)
|
||||||
% (p.relpath, nb)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif not success:
|
elif not success:
|
||||||
print >>sys.stderr, 'error: no project has branch %s' % nb
|
print('error: no project has branch %s' % nb, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'Abandoned in %d project(s):\n %s' % (
|
print('Abandoned in %d project(s):\n %s'
|
||||||
len(success), '\n '.join(p.relpath for p in success))
|
% (len(success), '\n '.join(p.relpath for p in success)),
|
||||||
|
file=sys.stderr)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import Command
|
from command import Command
|
||||||
@ -107,7 +108,7 @@ is shown, then the branch appears in all projects.
|
|||||||
names.sort()
|
names.sort()
|
||||||
|
|
||||||
if not names:
|
if not names:
|
||||||
print >>sys.stderr, ' (no branches)'
|
print(' (no branches)', file=sys.stderr)
|
||||||
return
|
return
|
||||||
|
|
||||||
width = 25
|
width = 25
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from command import Command
|
from command import Command
|
||||||
from progress import Progress
|
from progress import Progress
|
||||||
@ -55,10 +56,9 @@ The command is equivalent to:
|
|||||||
|
|
||||||
if err:
|
if err:
|
||||||
for p in err:
|
for p in err:
|
||||||
print >>sys.stderr,\
|
print("error: %s/: cannot checkout %s" % (p.relpath, nb),
|
||||||
"error: %s/: cannot checkout %s" \
|
file=sys.stderr)
|
||||||
% (p.relpath, nb)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif not success:
|
elif not success:
|
||||||
print >>sys.stderr, 'error: no project has branch %s' % nb
|
print('error: no project has branch %s' % nb, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from command import Command
|
from command import Command
|
||||||
@ -46,13 +47,13 @@ change id will be added.
|
|||||||
capture_stdout = True,
|
capture_stdout = True,
|
||||||
capture_stderr = True)
|
capture_stderr = True)
|
||||||
if p.Wait() != 0:
|
if p.Wait() != 0:
|
||||||
print >>sys.stderr, p.stderr
|
print(p.stderr, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
sha1 = p.stdout.strip()
|
sha1 = p.stdout.strip()
|
||||||
|
|
||||||
p = GitCommand(None, ['cat-file', 'commit', sha1], capture_stdout=True)
|
p = GitCommand(None, ['cat-file', 'commit', sha1], capture_stdout=True)
|
||||||
if p.Wait() != 0:
|
if p.Wait() != 0:
|
||||||
print >>sys.stderr, "error: Failed to retrieve old commit message"
|
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(p.stdout)
|
||||||
|
|
||||||
@ -62,8 +63,8 @@ change id will be added.
|
|||||||
capture_stderr = True)
|
capture_stderr = True)
|
||||||
status = p.Wait()
|
status = p.Wait()
|
||||||
|
|
||||||
print >>sys.stdout, p.stdout
|
print(p.stdout, file=sys.stdout)
|
||||||
print >>sys.stderr, p.stderr
|
print(p.stderr, file=sys.stderr)
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
# The cherry-pick was applied correctly. We just need to edit the
|
# The cherry-pick was applied correctly. We just need to edit the
|
||||||
@ -76,16 +77,14 @@ change id will be added.
|
|||||||
capture_stderr = True)
|
capture_stderr = True)
|
||||||
p.stdin.write(new_msg)
|
p.stdin.write(new_msg)
|
||||||
if p.Wait() != 0:
|
if p.Wait() != 0:
|
||||||
print >>sys.stderr, "error: Failed to update commit message"
|
print("error: Failed to update commit message", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, """\
|
print('NOTE: When committing (please see above) and editing the commit'
|
||||||
NOTE: When committing (please see above) and editing the commit message,
|
'message, please remove the old Change-Id-line and add:')
|
||||||
please remove the old Change-Id-line and add:
|
print(self._GetReference(sha1), file=stderr)
|
||||||
"""
|
print(file=stderr)
|
||||||
print >>sys.stderr, self._GetReference(sha1)
|
|
||||||
print >>sys.stderr
|
|
||||||
|
|
||||||
def _IsChangeId(self, line):
|
def _IsChangeId(self, line):
|
||||||
return CHANGE_ID_RE.match(line)
|
return CHANGE_ID_RE.match(line)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -68,23 +69,23 @@ makes it available in your project's local working directory.
|
|||||||
for project, change_id, ps_id in self._ParseChangeIds(args):
|
for project, change_id, ps_id in self._ParseChangeIds(args):
|
||||||
dl = project.DownloadPatchSet(change_id, ps_id)
|
dl = project.DownloadPatchSet(change_id, ps_id)
|
||||||
if not dl:
|
if not dl:
|
||||||
print >>sys.stderr, \
|
print('[%s] change %d/%d not found'
|
||||||
'[%s] change %d/%d not found' \
|
% (project.name, change_id, ps_id),
|
||||||
% (project.name, change_id, ps_id)
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not opt.revert and not dl.commits:
|
if not opt.revert and not dl.commits:
|
||||||
print >>sys.stderr, \
|
print('[%s] change %d/%d has already been merged'
|
||||||
'[%s] change %d/%d has already been merged' \
|
% (project.name, change_id, ps_id),
|
||||||
% (project.name, change_id, ps_id)
|
file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if len(dl.commits) > 1:
|
if len(dl.commits) > 1:
|
||||||
print >>sys.stderr, \
|
print('[%s] %d/%d depends on %d unmerged changes:' \
|
||||||
'[%s] %d/%d depends on %d unmerged changes:' \
|
% (project.name, change_id, ps_id, len(dl.commits)),
|
||||||
% (project.name, change_id, ps_id, len(dl.commits))
|
file=sys.stderr)
|
||||||
for c in dl.commits:
|
for c in dl.commits:
|
||||||
print >>sys.stderr, ' %s' % (c)
|
print(' %s' % (c), file=sys.stderr)
|
||||||
if opt.cherrypick:
|
if opt.cherrypick:
|
||||||
project._CherryPick(dl.commit)
|
project._CherryPick(dl.commit)
|
||||||
elif opt.revert:
|
elif opt.revert:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import fcntl
|
import fcntl
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
@ -183,7 +184,7 @@ terminal and are not redirected.
|
|||||||
if not os.path.exists(cwd):
|
if not os.path.exists(cwd):
|
||||||
if (opt.project_header and opt.verbose) \
|
if (opt.project_header and opt.verbose) \
|
||||||
or not opt.project_header:
|
or not opt.project_header:
|
||||||
print >>sys.stderr, 'skipping %s/' % project.relpath
|
print('skipping %s/' % project.relpath, file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if opt.project_header:
|
if opt.project_header:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import PagedCommand
|
from command import PagedCommand
|
||||||
@ -178,8 +179,7 @@ contain a line that matches both expressions:
|
|||||||
have_rev = False
|
have_rev = False
|
||||||
if opt.revision:
|
if opt.revision:
|
||||||
if '--cached' in cmd_argv:
|
if '--cached' in cmd_argv:
|
||||||
print >>sys.stderr,\
|
print('fatal: cannot combine --cached and --revision', file=sys.stderr)
|
||||||
'fatal: cannot combine --cached and --revision'
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
have_rev = True
|
have_rev = True
|
||||||
cmd_argv.extend(opt.revision)
|
cmd_argv.extend(opt.revision)
|
||||||
@ -230,13 +230,13 @@ contain a line that matches both expressions:
|
|||||||
out.nl()
|
out.nl()
|
||||||
else:
|
else:
|
||||||
for line in r:
|
for line in r:
|
||||||
print line
|
print(line)
|
||||||
|
|
||||||
if have_match:
|
if have_match:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif have_rev and bad_rev:
|
elif have_rev and bad_rev:
|
||||||
for r in opt.revision:
|
for r in opt.revision:
|
||||||
print >>sys.stderr, "error: can't search revision %s" % r
|
print("error: can't search revision %s" % r, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from formatter import AbstractFormatter, DumbWriter
|
from formatter import AbstractFormatter, DumbWriter
|
||||||
@ -31,10 +32,8 @@ Displays detailed usage information about a command.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _PrintAllCommands(self):
|
def _PrintAllCommands(self):
|
||||||
print 'usage: repo COMMAND [ARGS]'
|
print('usage: repo COMMAND [ARGS]')
|
||||||
print """
|
print('The complete list of recognized repo commands are:')
|
||||||
The complete list of recognized repo commands are:
|
|
||||||
"""
|
|
||||||
commandNames = self.commands.keys()
|
commandNames = self.commands.keys()
|
||||||
commandNames.sort()
|
commandNames.sort()
|
||||||
|
|
||||||
@ -49,16 +48,13 @@ The complete list of recognized repo commands are:
|
|||||||
summary = command.helpSummary.strip()
|
summary = command.helpSummary.strip()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
summary = ''
|
summary = ''
|
||||||
print fmt % (name, summary)
|
print(fmt % (name, summary))
|
||||||
print """
|
print("See 'repo help <command>' for more information on a"
|
||||||
See 'repo help <command>' for more information on a specific command.
|
'specific command.')
|
||||||
"""
|
|
||||||
|
|
||||||
def _PrintCommonCommands(self):
|
def _PrintCommonCommands(self):
|
||||||
print 'usage: repo COMMAND [ARGS]'
|
print('usage: repo COMMAND [ARGS]')
|
||||||
print """
|
print('The most commonly used repo commands are:')
|
||||||
The most commonly used repo commands are:
|
|
||||||
"""
|
|
||||||
commandNames = [name
|
commandNames = [name
|
||||||
for name in self.commands.keys()
|
for name in self.commands.keys()
|
||||||
if self.commands[name].common]
|
if self.commands[name].common]
|
||||||
@ -75,11 +71,10 @@ The most commonly used repo commands are:
|
|||||||
summary = command.helpSummary.strip()
|
summary = command.helpSummary.strip()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
summary = ''
|
summary = ''
|
||||||
print fmt % (name, summary)
|
print(fmt % (name, summary))
|
||||||
print """
|
print(
|
||||||
See 'repo help <command>' for more information on a specific command.
|
"See 'repo help <command>' for more information on a specific command.\n"
|
||||||
See 'repo help --all' for a complete list of recognized commands.
|
"See 'repo help --all' for a complete list of recognized commands.")
|
||||||
"""
|
|
||||||
|
|
||||||
def _PrintCommandHelp(self, cmd):
|
def _PrintCommandHelp(self, cmd):
|
||||||
class _Out(Coloring):
|
class _Out(Coloring):
|
||||||
@ -162,7 +157,7 @@ See 'repo help --all' for a complete list of recognized commands.
|
|||||||
try:
|
try:
|
||||||
cmd = self.commands[name]
|
cmd = self.commands[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print >>sys.stderr, "repo: '%s' is not a repo command." % name
|
print("repo: '%s' is not a repo command." % name, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cmd.manifest = self.manifest
|
cmd.manifest = self.manifest
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
@ -123,12 +124,12 @@ to update the working directory files.
|
|||||||
|
|
||||||
if is_new:
|
if is_new:
|
||||||
if not opt.manifest_url:
|
if not opt.manifest_url:
|
||||||
print >>sys.stderr, 'fatal: manifest url (-u) is required.'
|
print('fatal: manifest url (-u) is required.', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not opt.quiet:
|
if not opt.quiet:
|
||||||
print >>sys.stderr, 'Get %s' \
|
print('Get %s' % GitConfig.ForUser().UrlInsteadOf(opt.manifest_url),
|
||||||
% GitConfig.ForUser().UrlInsteadOf(opt.manifest_url)
|
file=sys.stderr)
|
||||||
m._InitGitDir()
|
m._InitGitDir()
|
||||||
|
|
||||||
if opt.manifest_branch:
|
if opt.manifest_branch:
|
||||||
@ -159,7 +160,7 @@ to update the working directory files.
|
|||||||
elif opt.platform in all_platforms:
|
elif opt.platform in all_platforms:
|
||||||
groups.extend(platformize(opt.platform))
|
groups.extend(platformize(opt.platform))
|
||||||
elif opt.platform != 'none':
|
elif opt.platform != 'none':
|
||||||
print >>sys.stderr, 'fatal: invalid platform flag'
|
print('fatal: invalid platform flag', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
groups = [x for x in groups if x]
|
groups = [x for x in groups if x]
|
||||||
@ -175,12 +176,13 @@ to update the working directory files.
|
|||||||
if is_new:
|
if is_new:
|
||||||
m.config.SetString('repo.mirror', 'true')
|
m.config.SetString('repo.mirror', 'true')
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'fatal: --mirror not supported on existing client'
|
print('fatal: --mirror not supported on existing client',
|
||||||
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not m.Sync_NetworkHalf(is_new=is_new):
|
if not m.Sync_NetworkHalf(is_new=is_new):
|
||||||
r = m.GetRemote(m.remote.name)
|
r = m.GetRemote(m.remote.name)
|
||||||
print >>sys.stderr, 'fatal: cannot obtain manifest %s' % r.url
|
print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
|
||||||
|
|
||||||
# Better delete the manifest git dir if we created it; otherwise next
|
# Better delete the manifest git dir if we created it; otherwise next
|
||||||
# time (when user fixes problems) we won't go through the "is_new" logic.
|
# time (when user fixes problems) we won't go through the "is_new" logic.
|
||||||
@ -197,19 +199,19 @@ to update the working directory files.
|
|||||||
|
|
||||||
if is_new or m.CurrentBranch is None:
|
if is_new or m.CurrentBranch is None:
|
||||||
if not m.StartBranch('default'):
|
if not m.StartBranch('default'):
|
||||||
print >>sys.stderr, 'fatal: cannot create default in manifest'
|
print('fatal: cannot create default in manifest', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _LinkManifest(self, name):
|
def _LinkManifest(self, name):
|
||||||
if not name:
|
if not name:
|
||||||
print >>sys.stderr, 'fatal: manifest name (-m) is required.'
|
print('fatal: manifest name (-m) is required.', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.manifest.Link(name)
|
self.manifest.Link(name)
|
||||||
except ManifestParseError as e:
|
except ManifestParseError as e:
|
||||||
print >>sys.stderr, "fatal: manifest '%s' not available" % name
|
print("fatal: manifest '%s' not available" % name, file=sys.stderr)
|
||||||
print >>sys.stderr, 'fatal: %s' % str(e)
|
print('fatal: %s' % str(e), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _Prompt(self, prompt, value):
|
def _Prompt(self, prompt, value):
|
||||||
@ -231,22 +233,22 @@ to update the working directory files.
|
|||||||
mp.config.SetString('user.name', gc.GetString('user.name'))
|
mp.config.SetString('user.name', gc.GetString('user.name'))
|
||||||
mp.config.SetString('user.email', gc.GetString('user.email'))
|
mp.config.SetString('user.email', gc.GetString('user.email'))
|
||||||
|
|
||||||
print ''
|
print()
|
||||||
print 'Your identity is: %s <%s>' % (mp.config.GetString('user.name'),
|
print('Your identity is: %s <%s>' % (mp.config.GetString('user.name'),
|
||||||
mp.config.GetString('user.email'))
|
mp.config.GetString('user.email')))
|
||||||
print 'If you want to change this, please re-run \'repo init\' with --config-name'
|
print('If you want to change this, please re-run \'repo init\' with --config-name')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _ConfigureUser(self):
|
def _ConfigureUser(self):
|
||||||
mp = self.manifest.manifestProject
|
mp = self.manifest.manifestProject
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print ''
|
print()
|
||||||
name = self._Prompt('Your Name', mp.UserName)
|
name = self._Prompt('Your Name', mp.UserName)
|
||||||
email = self._Prompt('Your Email', mp.UserEmail)
|
email = self._Prompt('Your Email', mp.UserEmail)
|
||||||
|
|
||||||
print ''
|
print()
|
||||||
print 'Your identity is: %s <%s>' % (name, email)
|
print('Your identity is: %s <%s>' % (name, email))
|
||||||
sys.stdout.write('is this correct [y/N]? ')
|
sys.stdout.write('is this correct [y/N]? ')
|
||||||
a = sys.stdin.readline().strip().lower()
|
a = sys.stdin.readline().strip().lower()
|
||||||
if a in ('yes', 'y', 't', 'true'):
|
if a in ('yes', 'y', 't', 'true'):
|
||||||
@ -274,8 +276,8 @@ to update the working directory files.
|
|||||||
self._on = True
|
self._on = True
|
||||||
out = _Test()
|
out = _Test()
|
||||||
|
|
||||||
print ''
|
print()
|
||||||
print "Testing colorized output (for 'repo diff', 'repo status'):"
|
print("Testing colorized output (for 'repo diff', 'repo status'):")
|
||||||
|
|
||||||
for c in ['black','red','green','yellow','blue','magenta','cyan']:
|
for c in ['black','red','green','yellow','blue','magenta','cyan']:
|
||||||
out.write(' ')
|
out.write(' ')
|
||||||
@ -319,14 +321,16 @@ to update the working directory files.
|
|||||||
else:
|
else:
|
||||||
init_type = ''
|
init_type = ''
|
||||||
|
|
||||||
print ''
|
print()
|
||||||
print 'repo %shas been initialized in %s' % (init_type, self.manifest.topdir)
|
print('repo %shas been initialized in %s'
|
||||||
|
% (init_type, self.manifest.topdir))
|
||||||
|
|
||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
if current_dir != self.manifest.topdir:
|
if current_dir != self.manifest.topdir:
|
||||||
print 'If this is not the directory in which you want to initialize repo, please run:'
|
print('If this is not the directory in which you want to initialize'
|
||||||
print ' rm -r %s/.repo' % self.manifest.topdir
|
'repo, please run:')
|
||||||
print 'and try again.'
|
print(' rm -r %s/.repo' % self.manifest.topdir)
|
||||||
|
print('and try again.')
|
||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
git_require(MIN_GIT_VERSION, fail=True)
|
git_require(MIN_GIT_VERSION, fail=True)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command, MirrorSafeCommand
|
||||||
@ -64,7 +65,7 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'.
|
|||||||
lines.append("%s : %s" % (_getpath(project), project.name))
|
lines.append("%s : %s" % (_getpath(project), project.name))
|
||||||
|
|
||||||
lines.sort()
|
lines.sort()
|
||||||
print '\n'.join(lines)
|
print('\n'.join(lines))
|
||||||
|
|
||||||
def FindProjects(self, args):
|
def FindProjects(self, args):
|
||||||
result = []
|
result = []
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ in a Git repository for use during future 'repo init' invocations.
|
|||||||
peg_rev_upstream = opt.peg_rev_upstream)
|
peg_rev_upstream = opt.peg_rev_upstream)
|
||||||
fd.close()
|
fd.close()
|
||||||
if opt.output_file != '-':
|
if opt.output_file != '-':
|
||||||
print >>sys.stderr, 'Saved manifest to %s' % opt.output_file
|
print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
|
||||||
|
|
||||||
def Execute(self, opt, args):
|
def Execute(self, opt, args):
|
||||||
if args:
|
if args:
|
||||||
@ -79,6 +80,6 @@ in a Git repository for use during future 'repo init' invocations.
|
|||||||
self._Output(opt)
|
self._Output(opt)
|
||||||
return
|
return
|
||||||
|
|
||||||
print >>sys.stderr, 'error: no operation to perform'
|
print('error: no operation to perform', file=sys.stderr)
|
||||||
print >>sys.stderr, 'error: see repo help manifest'
|
print('error: see repo help manifest', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import PagedCommand
|
from command import PagedCommand
|
||||||
|
|
||||||
@ -70,11 +71,11 @@ are displayed.
|
|||||||
|
|
||||||
commits = branch.commits
|
commits = branch.commits
|
||||||
date = branch.date
|
date = branch.date
|
||||||
print '%s %-33s (%2d commit%s, %s)' % (
|
print('%s %-33s (%2d commit%s, %s)' % (
|
||||||
branch.name == project.CurrentBranch and '*' or ' ',
|
branch.name == project.CurrentBranch and '*' or ' ',
|
||||||
branch.name,
|
branch.name,
|
||||||
len(commits),
|
len(commits),
|
||||||
len(commits) != 1 and 's' or ' ',
|
len(commits) != 1 and 's' or ' ',
|
||||||
date)
|
date))
|
||||||
for commit in commits:
|
for commit in commits:
|
||||||
print '%-35s - %s' % ('', commit)
|
print('%-35s - %s' % ('', commit))
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import PagedCommand
|
from command import PagedCommand
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ class Prune(PagedCommand):
|
|||||||
|
|
||||||
commits = branch.commits
|
commits = branch.commits
|
||||||
date = branch.date
|
date = branch.date
|
||||||
print '%s %-33s (%2d commit%s, %s)' % (
|
print('%s %-33s (%2d commit%s, %s)' % (
|
||||||
branch.name == project.CurrentBranch and '*' or ' ',
|
branch.name == project.CurrentBranch and '*' or ' ',
|
||||||
branch.name,
|
branch.name,
|
||||||
len(commits),
|
len(commits),
|
||||||
len(commits) != 1 and 's' or ' ',
|
len(commits) != 1 and 's' or ' ',
|
||||||
date)
|
date))
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command
|
from command import Command
|
||||||
@ -59,14 +60,16 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
one_project = len(all_projects) == 1
|
one_project = len(all_projects) == 1
|
||||||
|
|
||||||
if opt.interactive and not one_project:
|
if opt.interactive and not one_project:
|
||||||
print >>sys.stderr, 'error: interactive rebase not supported with multiple projects'
|
print('error: interactive rebase not supported with multiple projects',
|
||||||
|
file=sys.stderr)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
for project in all_projects:
|
for project in all_projects:
|
||||||
cb = project.CurrentBranch
|
cb = project.CurrentBranch
|
||||||
if not cb:
|
if not cb:
|
||||||
if one_project:
|
if one_project:
|
||||||
print >>sys.stderr, "error: project %s has a detatched HEAD" % project.relpath
|
print("error: project %s has a detatched HEAD" % project.relpath,
|
||||||
|
file=sys.stderr)
|
||||||
return -1
|
return -1
|
||||||
# ignore branches with detatched HEADs
|
# ignore branches with detatched HEADs
|
||||||
continue
|
continue
|
||||||
@ -74,7 +77,8 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
upbranch = project.GetBranch(cb)
|
upbranch = project.GetBranch(cb)
|
||||||
if not upbranch.LocalMerge:
|
if not upbranch.LocalMerge:
|
||||||
if one_project:
|
if one_project:
|
||||||
print >>sys.stderr, "error: project %s does not track any remote branches" % project.relpath
|
print("error: project %s does not track any remote branches"
|
||||||
|
% project.relpath, file=sys.stderr)
|
||||||
return -1
|
return -1
|
||||||
# ignore branches without remotes
|
# ignore branches without remotes
|
||||||
continue
|
continue
|
||||||
@ -101,8 +105,8 @@ branch but need to incorporate new upstream changes "underneath" them.
|
|||||||
|
|
||||||
args.append(upbranch.LocalMerge)
|
args.append(upbranch.LocalMerge)
|
||||||
|
|
||||||
print >>sys.stderr, '# %s: rebasing %s -> %s' % \
|
print('# %s: rebasing %s -> %s'
|
||||||
(project.relpath, cb, upbranch.LocalMerge)
|
% (project.relpath, cb, upbranch.LocalMerge), file=sys.stderr)
|
||||||
|
|
||||||
needs_stash = False
|
needs_stash = False
|
||||||
if opt.auto_stash:
|
if opt.auto_stash:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from optparse import SUPPRESS_HELP
|
from optparse import SUPPRESS_HELP
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ need to be performed by an end-user.
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if not rp.Sync_NetworkHalf():
|
if not rp.Sync_NetworkHalf():
|
||||||
print >>sys.stderr, "error: can't update repo"
|
print("error: can't update repo", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
rp.bare_git.gc('--auto')
|
rp.bare_git.gc('--auto')
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
@ -50,7 +51,7 @@ The '%prog' command stages files to prepare the next commit.
|
|||||||
def _Interactive(self, opt, args):
|
def _Interactive(self, opt, args):
|
||||||
all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args))
|
all_projects = filter(lambda x: x.IsDirty(), self.GetProjects(args))
|
||||||
if not all_projects:
|
if not all_projects:
|
||||||
print >>sys.stderr,'no projects have uncommitted modifications'
|
print('no projects have uncommitted modifications', file=sys.stderr)
|
||||||
return
|
return
|
||||||
|
|
||||||
out = _ProjectList(self.manifest.manifestProject.config)
|
out = _ProjectList(self.manifest.manifestProject.config)
|
||||||
@ -101,7 +102,7 @@ The '%prog' command stages files to prepare the next commit.
|
|||||||
if len(p) == 1:
|
if len(p) == 1:
|
||||||
_AddI(p[0])
|
_AddI(p[0])
|
||||||
continue
|
continue
|
||||||
print 'Bye.'
|
print('Bye.')
|
||||||
|
|
||||||
def _AddI(project):
|
def _AddI(project):
|
||||||
p = GitCommand(project, ['add', '--interactive'], bare=False)
|
p = GitCommand(project, ['add', '--interactive'], bare=False)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from command import Command
|
from command import Command
|
||||||
from git_config import IsId
|
from git_config import IsId
|
||||||
@ -41,7 +42,7 @@ revision specified in the manifest.
|
|||||||
|
|
||||||
nb = args[0]
|
nb = args[0]
|
||||||
if not git.check_ref_format('heads/%s' % nb):
|
if not git.check_ref_format('heads/%s' % nb):
|
||||||
print >>sys.stderr, "error: '%s' is not a valid name" % nb
|
print("error: '%s' is not a valid name" % nb, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
err = []
|
err = []
|
||||||
@ -49,7 +50,7 @@ revision specified in the manifest.
|
|||||||
if not opt.all:
|
if not opt.all:
|
||||||
projects = args[1:]
|
projects = args[1:]
|
||||||
if len(projects) < 1:
|
if len(projects) < 1:
|
||||||
print >>sys.stderr, "error: at least one project must be specified"
|
print("error: at least one project must be specified", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
all_projects = self.GetProjects(projects)
|
all_projects = self.GetProjects(projects)
|
||||||
@ -67,7 +68,6 @@ revision specified in the manifest.
|
|||||||
|
|
||||||
if err:
|
if err:
|
||||||
for p in err:
|
for p in err:
|
||||||
print >>sys.stderr,\
|
print("error: %s/: cannot start %s" % (p.relpath, nb),
|
||||||
"error: %s/: cannot start %s" \
|
file=sys.stderr)
|
||||||
% (p.relpath, nb)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -129,4 +129,4 @@ the following meanings:
|
|||||||
output.dump(sys.stdout)
|
output.dump(sys.stdout)
|
||||||
output.close()
|
output.close()
|
||||||
if len(all_projects) == counter.next():
|
if len(all_projects) == counter.next():
|
||||||
print 'nothing to commit (working directory clean)'
|
print('nothing to commit (working directory clean)')
|
||||||
|
102
subcmds/sync.py
102
subcmds/sync.py
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import netrc
|
import netrc
|
||||||
from optparse import SUPPRESS_HELP
|
from optparse import SUPPRESS_HELP
|
||||||
import os
|
import os
|
||||||
@ -234,9 +235,10 @@ later is required to fix a server side protocol bug.
|
|||||||
did_lock = True
|
did_lock = True
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
print >>sys.stderr, 'error: Cannot fetch %s' % project.name
|
print('error: Cannot fetch %s' % project.name, file=sys.stderr)
|
||||||
if opt.force_broken:
|
if opt.force_broken:
|
||||||
print >>sys.stderr, 'warn: --force-broken, continuing to sync'
|
print('warn: --force-broken, continuing to sync',
|
||||||
|
file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
raise _FetchError()
|
raise _FetchError()
|
||||||
|
|
||||||
@ -265,9 +267,9 @@ later is required to fix a server side protocol bug.
|
|||||||
clone_bundle=not opt.no_clone_bundle):
|
clone_bundle=not opt.no_clone_bundle):
|
||||||
fetched.add(project.gitdir)
|
fetched.add(project.gitdir)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'error: Cannot fetch %s' % project.name
|
print('error: Cannot fetch %s' % project.name, file=sys.stderr)
|
||||||
if opt.force_broken:
|
if opt.force_broken:
|
||||||
print >>sys.stderr, 'warn: --force-broken, continuing to sync'
|
print('warn: --force-broken, continuing to sync', file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
@ -300,7 +302,7 @@ later is required to fix a server side protocol bug.
|
|||||||
|
|
||||||
# If we saw an error, exit with code 1 so that other scripts can check.
|
# If we saw an error, exit with code 1 so that other scripts can check.
|
||||||
if err_event.isSet():
|
if err_event.isSet():
|
||||||
print >>sys.stderr, '\nerror: Exited sync due to fetch errors'
|
print('\nerror: Exited sync due to fetch errors', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
pm.end()
|
pm.end()
|
||||||
@ -353,7 +355,7 @@ later is required to fix a server side protocol bug.
|
|||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
if err_event.isSet():
|
if err_event.isSet():
|
||||||
print >>sys.stderr, '\nerror: Exited sync due to gc errors'
|
print('\nerror: Exited sync due to gc errors', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def UpdateProjectList(self):
|
def UpdateProjectList(self):
|
||||||
@ -390,12 +392,14 @@ later is required to fix a server side protocol bug.
|
|||||||
groups = None)
|
groups = None)
|
||||||
|
|
||||||
if project.IsDirty():
|
if project.IsDirty():
|
||||||
print >>sys.stderr, 'error: Cannot remove project "%s": \
|
print('error: Cannot remove project "%s": uncommitted changes'
|
||||||
uncommitted changes are present' % project.relpath
|
'are present' % project.relpath, file=sys.stderr)
|
||||||
print >>sys.stderr, ' commit changes, then run sync again'
|
print(' commit changes, then run sync again',
|
||||||
|
file=sys.stderr)
|
||||||
return -1
|
return -1
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'Deleting obsolete path %s' % project.worktree
|
print('Deleting obsolete path %s' % project.worktree,
|
||||||
|
file=sys.stderr)
|
||||||
shutil.rmtree(project.worktree)
|
shutil.rmtree(project.worktree)
|
||||||
# Try deleting parent subdirs if they are empty
|
# Try deleting parent subdirs if they are empty
|
||||||
project_dir = os.path.dirname(project.worktree)
|
project_dir = os.path.dirname(project.worktree)
|
||||||
@ -423,24 +427,24 @@ uncommitted changes are present' % project.relpath
|
|||||||
self.jobs = min(self.jobs, (soft_limit - 5) / 3)
|
self.jobs = min(self.jobs, (soft_limit - 5) / 3)
|
||||||
|
|
||||||
if opt.network_only and opt.detach_head:
|
if opt.network_only and opt.detach_head:
|
||||||
print >>sys.stderr, 'error: cannot combine -n and -d'
|
print('error: cannot combine -n and -d', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.network_only and opt.local_only:
|
if opt.network_only and opt.local_only:
|
||||||
print >>sys.stderr, 'error: cannot combine -n and -l'
|
print('error: cannot combine -n and -l', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.manifest_name and opt.smart_sync:
|
if opt.manifest_name and opt.smart_sync:
|
||||||
print >>sys.stderr, 'error: cannot combine -m and -s'
|
print('error: cannot combine -m and -s', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.manifest_name and opt.smart_tag:
|
if opt.manifest_name and opt.smart_tag:
|
||||||
print >>sys.stderr, 'error: cannot combine -m and -t'
|
print('error: cannot combine -m and -t', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.manifest_server_username or opt.manifest_server_password:
|
if opt.manifest_server_username or opt.manifest_server_password:
|
||||||
if not (opt.smart_sync or opt.smart_tag):
|
if not (opt.smart_sync or opt.smart_tag):
|
||||||
print >>sys.stderr, 'error: -u and -p may only be combined with ' \
|
print('error: -u and -p may only be combined with -s or -t',
|
||||||
'-s or -t'
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if None in [opt.manifest_server_username, opt.manifest_server_password]:
|
if None in [opt.manifest_server_username, opt.manifest_server_password]:
|
||||||
print >>sys.stderr, 'error: both -u and -p must be given'
|
print('error: both -u and -p must be given', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if opt.manifest_name:
|
if opt.manifest_name:
|
||||||
@ -448,8 +452,8 @@ uncommitted changes are present' % project.relpath
|
|||||||
|
|
||||||
if opt.smart_sync or opt.smart_tag:
|
if opt.smart_sync or opt.smart_tag:
|
||||||
if not self.manifest.manifest_server:
|
if not self.manifest.manifest_server:
|
||||||
print >>sys.stderr, \
|
print('error: cannot smart sync: no manifest server defined in'
|
||||||
'error: cannot smart sync: no manifest server defined in manifest'
|
'manifest', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
manifest_server = self.manifest.manifest_server
|
manifest_server = self.manifest.manifest_server
|
||||||
@ -464,7 +468,8 @@ uncommitted changes are present' % project.relpath
|
|||||||
try:
|
try:
|
||||||
info = netrc.netrc()
|
info = netrc.netrc()
|
||||||
except IOError:
|
except IOError:
|
||||||
print >>sys.stderr, '.netrc file does not exist or could not be opened'
|
print('.netrc file does not exist or could not be opened',
|
||||||
|
file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
parse_result = urlparse.urlparse(manifest_server)
|
parse_result = urlparse.urlparse(manifest_server)
|
||||||
@ -474,10 +479,10 @@ uncommitted changes are present' % project.relpath
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
# TypeError is raised when the given hostname is not present
|
# TypeError is raised when the given hostname is not present
|
||||||
# in the .netrc file.
|
# in the .netrc file.
|
||||||
print >>sys.stderr, 'No credentials found for %s in .netrc' % \
|
print('No credentials found for %s in .netrc'
|
||||||
parse_result.hostname
|
% parse_result.hostname, file=sys.stderr)
|
||||||
except netrc.NetrcParseError as e:
|
except netrc.NetrcParseError as e:
|
||||||
print >>sys.stderr, 'Error parsing .netrc file: %s' % e
|
print('Error parsing .netrc file: %s' % e, file=sys.stderr)
|
||||||
|
|
||||||
if (username and password):
|
if (username and password):
|
||||||
manifest_server = manifest_server.replace('://', '://%s:%s@' %
|
manifest_server = manifest_server.replace('://', '://%s:%s@' %
|
||||||
@ -516,20 +521,21 @@ uncommitted changes are present' % project.relpath
|
|||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
print >>sys.stderr, 'error: cannot write manifest to %s' % \
|
print('error: cannot write manifest to %s' % manifest_path,
|
||||||
manifest_path
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self.manifest.Override(manifest_name)
|
self.manifest.Override(manifest_name)
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'error: %s' % manifest_str
|
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, xmlrpclib.Fault) as e:
|
||||||
print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%s' % (
|
print('error: cannot connect to manifest server %s:\n%s'
|
||||||
self.manifest.manifest_server, e)
|
% (self.manifest.manifest_server, e), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except xmlrpclib.ProtocolError as e:
|
except xmlrpclib.ProtocolError as e:
|
||||||
print >>sys.stderr, '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)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
rp = self.manifest.repoProject
|
rp = self.manifest.repoProject
|
||||||
@ -585,14 +591,14 @@ uncommitted changes are present' % project.relpath
|
|||||||
if project.worktree:
|
if project.worktree:
|
||||||
project.Sync_LocalHalf(syncbuf)
|
project.Sync_LocalHalf(syncbuf)
|
||||||
pm.end()
|
pm.end()
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
if not syncbuf.Finish():
|
if not syncbuf.Finish():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# If there's a notice that's supposed to print at the end of the sync, print
|
# If there's a notice that's supposed to print at the end of the sync, print
|
||||||
# it now...
|
# it now...
|
||||||
if self.manifest.notice:
|
if self.manifest.notice:
|
||||||
print self.manifest.notice
|
print(self.manifest.notice)
|
||||||
|
|
||||||
def _PostRepoUpgrade(manifest, quiet=False):
|
def _PostRepoUpgrade(manifest, quiet=False):
|
||||||
wrapper = WrapperModule()
|
wrapper = WrapperModule()
|
||||||
@ -604,27 +610,28 @@ def _PostRepoUpgrade(manifest, quiet=False):
|
|||||||
|
|
||||||
def _PostRepoFetch(rp, no_repo_verify=False, verbose=False):
|
def _PostRepoFetch(rp, no_repo_verify=False, verbose=False):
|
||||||
if rp.HasChanges:
|
if rp.HasChanges:
|
||||||
print >>sys.stderr, 'info: A new version of repo is available'
|
print('info: A new version of repo is available', file=sys.stderr)
|
||||||
print >>sys.stderr, ''
|
print(file=sys.stderr)
|
||||||
if no_repo_verify or _VerifyTag(rp):
|
if no_repo_verify or _VerifyTag(rp):
|
||||||
syncbuf = SyncBuffer(rp.config)
|
syncbuf = SyncBuffer(rp.config)
|
||||||
rp.Sync_LocalHalf(syncbuf)
|
rp.Sync_LocalHalf(syncbuf)
|
||||||
if not syncbuf.Finish():
|
if not syncbuf.Finish():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print >>sys.stderr, 'info: Restarting repo with latest version'
|
print('info: Restarting repo with latest version', file=sys.stderr)
|
||||||
raise RepoChangedException(['--repo-upgraded'])
|
raise RepoChangedException(['--repo-upgraded'])
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'warning: Skipped upgrade to unverified version'
|
print('warning: Skipped upgrade to unverified version', file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
if verbose:
|
if verbose:
|
||||||
print >>sys.stderr, 'repo version %s is current' % rp.work_git.describe(HEAD)
|
print('repo version %s is current' % rp.work_git.describe(HEAD),
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
def _VerifyTag(project):
|
def _VerifyTag(project):
|
||||||
gpg_dir = os.path.expanduser('~/.repoconfig/gnupg')
|
gpg_dir = os.path.expanduser('~/.repoconfig/gnupg')
|
||||||
if not os.path.exists(gpg_dir):
|
if not os.path.exists(gpg_dir):
|
||||||
print >>sys.stderr,\
|
print('warning: GnuPG was not available during last "repo init"\n'
|
||||||
"""warning: GnuPG was not available during last "repo init"
|
'warning: Cannot automatically authenticate repo."""',
|
||||||
warning: Cannot automatically authenticate repo."""
|
file=sys.stderr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -638,10 +645,9 @@ warning: Cannot automatically authenticate repo."""
|
|||||||
if rev.startswith(R_HEADS):
|
if rev.startswith(R_HEADS):
|
||||||
rev = rev[len(R_HEADS):]
|
rev = rev[len(R_HEADS):]
|
||||||
|
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr,\
|
print("warning: project '%s' branch '%s' is not signed"
|
||||||
"warning: project '%s' branch '%s' is not signed" \
|
% (project.name, rev), file=sys.stderr)
|
||||||
% (project.name, rev)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@ -660,10 +666,10 @@ warning: Cannot automatically authenticate repo."""
|
|||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, out
|
print(out, file=sys.stderr)
|
||||||
print >>sys.stderr, err
|
print(err, file=sys.stderr)
|
||||||
print >>sys.stderr
|
print(file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import copy
|
import copy
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -26,16 +27,18 @@ UNUSUAL_COMMIT_THRESHOLD = 5
|
|||||||
|
|
||||||
def _ConfirmManyUploads(multiple_branches=False):
|
def _ConfirmManyUploads(multiple_branches=False):
|
||||||
if multiple_branches:
|
if multiple_branches:
|
||||||
print "ATTENTION: One or more branches has an unusually high number of commits."
|
print('ATTENTION: One or more branches has an unusually high number'
|
||||||
|
'of commits.')
|
||||||
else:
|
else:
|
||||||
print "ATTENTION: You are uploading an unusually high number of commits."
|
print('ATTENTION: You are uploading an unusually high number of commits.')
|
||||||
print "YOU PROBABLY DO NOT MEAN TO DO THIS. (Did you rebase across branches?)"
|
print('YOU PROBABLY DO NOT MEAN TO DO THIS. (Did you rebase across'
|
||||||
|
'branches?)')
|
||||||
answer = raw_input("If you are sure you intend to do this, type 'yes': ").strip()
|
answer = raw_input("If you are sure you intend to do this, type 'yes': ").strip()
|
||||||
return answer == "yes"
|
return answer == "yes"
|
||||||
|
|
||||||
def _die(fmt, *args):
|
def _die(fmt, *args):
|
||||||
msg = fmt % args
|
msg = fmt % args
|
||||||
print >>sys.stderr, 'error: %s' % msg
|
print('error: %s' % msg, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def _SplitEmails(values):
|
def _SplitEmails(values):
|
||||||
@ -176,14 +179,14 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
date = branch.date
|
date = branch.date
|
||||||
commit_list = branch.commits
|
commit_list = branch.commits
|
||||||
|
|
||||||
print 'Upload project %s/ to remote branch %s:' % (project.relpath, project.revisionExpr)
|
print('Upload project %s/ to remote branch %s:' % (project.relpath, project.revisionExpr))
|
||||||
print ' branch %s (%2d commit%s, %s):' % (
|
print(' branch %s (%2d commit%s, %s):' % (
|
||||||
name,
|
name,
|
||||||
len(commit_list),
|
len(commit_list),
|
||||||
len(commit_list) != 1 and 's' or '',
|
len(commit_list) != 1 and 's' or '',
|
||||||
date)
|
date))
|
||||||
for commit in commit_list:
|
for commit in commit_list:
|
||||||
print ' %s' % commit
|
print(' %s' % commit)
|
||||||
|
|
||||||
sys.stdout.write('to %s (y/N)? ' % remote.review)
|
sys.stdout.write('to %s (y/N)? ' % remote.review)
|
||||||
answer = sys.stdin.readline().strip().lower()
|
answer = sys.stdin.readline().strip().lower()
|
||||||
@ -317,7 +320,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
sys.stdout.write('Uncommitted changes in ' + branch.project.name + ' (did you forget to amend?). Continue uploading? (y/N) ')
|
sys.stdout.write('Uncommitted changes in ' + branch.project.name + ' (did you forget to amend?). Continue uploading? (y/N) ')
|
||||||
a = sys.stdin.readline().strip().lower()
|
a = sys.stdin.readline().strip().lower()
|
||||||
if a not in ('y', 'yes', 't', 'true', 'on'):
|
if a not in ('y', 'yes', 't', 'true', 'on'):
|
||||||
print >>sys.stderr, "skipping upload"
|
print("skipping upload", file=sys.stderr)
|
||||||
branch.uploaded = False
|
branch.uploaded = False
|
||||||
branch.error = 'User aborted'
|
branch.error = 'User aborted'
|
||||||
continue
|
continue
|
||||||
@ -334,8 +337,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
branch.uploaded = False
|
branch.uploaded = False
|
||||||
have_errors = True
|
have_errors = True
|
||||||
|
|
||||||
print >>sys.stderr, ''
|
print(file=sys.stderr)
|
||||||
print >>sys.stderr, '----------------------------------------------------------------------'
|
print('----------------------------------------------------------------------', file=sys.stderr)
|
||||||
|
|
||||||
if have_errors:
|
if have_errors:
|
||||||
for branch in todo:
|
for branch in todo:
|
||||||
@ -344,17 +347,19 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
fmt = ' (%s)'
|
fmt = ' (%s)'
|
||||||
else:
|
else:
|
||||||
fmt = '\n (%s)'
|
fmt = '\n (%s)'
|
||||||
print >>sys.stderr, ('[FAILED] %-15s %-15s' + fmt) % (
|
print(('[FAILED] %-15s %-15s' + fmt) % (
|
||||||
branch.project.relpath + '/', \
|
branch.project.relpath + '/', \
|
||||||
branch.name, \
|
branch.name, \
|
||||||
str(branch.error))
|
str(branch.error)),
|
||||||
print >>sys.stderr, ''
|
file=sys.stderr)
|
||||||
|
print()
|
||||||
|
|
||||||
for branch in todo:
|
for branch in todo:
|
||||||
if branch.uploaded:
|
if branch.uploaded:
|
||||||
print >>sys.stderr, '[OK ] %-15s %s' % (
|
print('[OK ] %-15s %s' % (
|
||||||
branch.project.relpath + '/',
|
branch.project.relpath + '/',
|
||||||
branch.name)
|
branch.name),
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
if have_errors:
|
if have_errors:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -385,7 +390,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
try:
|
try:
|
||||||
hook.Run(opt.allow_all_hooks, project_list=pending_proj_names)
|
hook.Run(opt.allow_all_hooks, project_list=pending_proj_names)
|
||||||
except HookError as e:
|
except HookError as e:
|
||||||
print >>sys.stderr, "ERROR: %s" % str(e)
|
print("ERROR: %s" % str(e), file=sys.stderr)
|
||||||
return
|
return
|
||||||
|
|
||||||
if opt.reviewers:
|
if opt.reviewers:
|
||||||
@ -395,7 +400,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
people = (reviewers,cc)
|
people = (reviewers,cc)
|
||||||
|
|
||||||
if not pending:
|
if not pending:
|
||||||
print >>sys.stdout, "no branches ready for upload"
|
print("no branches ready for upload", file=sys.stderr)
|
||||||
elif len(pending) == 1 and len(pending[0][1]) == 1:
|
elif len(pending) == 1 and len(pending[0][1]) == 1:
|
||||||
self._SingleBranch(opt, pending[0][1][0], people)
|
self._SingleBranch(opt, pending[0][1][0], people)
|
||||||
else:
|
else:
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command, MirrorSafeCommand
|
||||||
from git_command import git
|
from git_command import git
|
||||||
@ -32,12 +33,12 @@ class Version(Command, MirrorSafeCommand):
|
|||||||
rp = self.manifest.repoProject
|
rp = self.manifest.repoProject
|
||||||
rem = rp.GetRemote(rp.remote.name)
|
rem = rp.GetRemote(rp.remote.name)
|
||||||
|
|
||||||
print 'repo version %s' % rp.work_git.describe(HEAD)
|
print('repo version %s' % rp.work_git.describe(HEAD))
|
||||||
print ' (from %s)' % rem.url
|
print(' (from %s)' % rem.url)
|
||||||
|
|
||||||
if Version.wrapper_path is not None:
|
if Version.wrapper_path is not None:
|
||||||
print 'repo launcher version %s' % Version.wrapper_version
|
print('repo launcher version %s' % Version.wrapper_version)
|
||||||
print ' (from %s)' % Version.wrapper_path
|
print(' (from %s)' % Version.wrapper_path)
|
||||||
|
|
||||||
print git.version().strip()
|
print(git.version().strip())
|
||||||
print 'Python %s' % sys.version
|
print('Python %s' % sys.version)
|
||||||
|
3
trace.py
3
trace.py
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
REPO_TRACE = 'REPO_TRACE'
|
REPO_TRACE = 'REPO_TRACE'
|
||||||
@ -31,4 +32,4 @@ def SetTrace():
|
|||||||
|
|
||||||
def Trace(fmt, *args):
|
def Trace(fmt, *args):
|
||||||
if IsTrace():
|
if IsTrace():
|
||||||
print >>sys.stderr, fmt % args
|
print(fmt % args, file=sys.stderr)
|
||||||
|
Loading…
Reference in New Issue
Block a user