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