mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-07-02 20:17:19 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
dbfbcb14c1 | |||
d0ca0f6814 | |||
433977e958 | |||
dd37fb2222 | |||
af908cb543 | |||
74e8ed4bde |
@ -362,7 +362,7 @@ class GitConfig(object):
|
|||||||
return c
|
return c
|
||||||
|
|
||||||
def _do(self, *args):
|
def _do(self, *args):
|
||||||
command = ['config', '--file', self.file]
|
command = ['config', '--file', self.file, '--includes']
|
||||||
command.extend(args)
|
command.extend(args)
|
||||||
|
|
||||||
p = GitCommand(None,
|
p = GitCommand(None,
|
||||||
|
2
main.py
2
main.py
@ -614,7 +614,7 @@ def _Main(argv):
|
|||||||
argv = list(sys.argv)
|
argv = list(sys.argv)
|
||||||
argv.extend(rce.extra_args)
|
argv.extend(rce.extra_args)
|
||||||
try:
|
try:
|
||||||
os.execv(__file__, argv)
|
os.execv(sys.executable, [__file__] + argv)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print('fatal: cannot restart repo after upgrade', file=sys.stderr)
|
print('fatal: cannot restart repo after upgrade', file=sys.stderr)
|
||||||
print('fatal: %s' % e, file=sys.stderr)
|
print('fatal: %s' % e, file=sys.stderr)
|
||||||
|
@ -284,7 +284,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
|||||||
def _ParseGroups(self, groups):
|
def _ParseGroups(self, groups):
|
||||||
return [x for x in re.split(r'[,\s]+', groups) if x]
|
return [x for x in re.split(r'[,\s]+', groups) if x]
|
||||||
|
|
||||||
def Save(self, fd, peg_rev=False, peg_rev_upstream=True, groups=None):
|
def Save(self, fd, peg_rev=False, peg_rev_upstream=True, peg_rev_dest_branch=True, groups=None):
|
||||||
"""Write the current manifest out to the given file descriptor.
|
"""Write the current manifest out to the given file descriptor.
|
||||||
"""
|
"""
|
||||||
mp = self.manifestProject
|
mp = self.manifestProject
|
||||||
@ -389,6 +389,13 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
|
|||||||
# Only save the origin if the origin is not a sha1, and the default
|
# Only save the origin if the origin is not a sha1, and the default
|
||||||
# isn't our value
|
# isn't our value
|
||||||
e.setAttribute('upstream', p.revisionExpr)
|
e.setAttribute('upstream', p.revisionExpr)
|
||||||
|
|
||||||
|
if peg_rev_dest_branch:
|
||||||
|
if p.dest_branch:
|
||||||
|
e.setAttribute('dest-branch', p.dest_branch)
|
||||||
|
elif value != p.revisionExpr:
|
||||||
|
e.setAttribute('dest-branch', p.revisionExpr)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr
|
revision = self.remotes[p.remote.orig_name].revision or d.revisionExpr
|
||||||
if not revision or revision != p.revisionExpr:
|
if not revision or revision != p.revisionExpr:
|
||||||
|
@ -405,8 +405,8 @@ class _LinkFile(object):
|
|||||||
else:
|
else:
|
||||||
src = _SafeExpandPath(self.git_worktree, self.src)
|
src = _SafeExpandPath(self.git_worktree, self.src)
|
||||||
|
|
||||||
if os.path.exists(src):
|
if not glob.has_magic(src):
|
||||||
# Entity exists so just a simple one to one link operation.
|
# Entity does not contain a wild card so just a simple one to one link operation.
|
||||||
dest = _SafeExpandPath(self.topdir, self.dest, skipfinal=True)
|
dest = _SafeExpandPath(self.topdir, self.dest, skipfinal=True)
|
||||||
# dest & src are absolute paths at this point. Make sure the target of
|
# dest & src are absolute paths at this point. Make sure the target of
|
||||||
# the symlink is relative in the context of the repo client checkout.
|
# the symlink is relative in the context of the repo client checkout.
|
||||||
@ -414,7 +414,7 @@ class _LinkFile(object):
|
|||||||
self.__linkIt(relpath, dest)
|
self.__linkIt(relpath, dest)
|
||||||
else:
|
else:
|
||||||
dest = _SafeExpandPath(self.topdir, self.dest)
|
dest = _SafeExpandPath(self.topdir, self.dest)
|
||||||
# Entity doesn't exist assume there is a wild card
|
# Entity contains a wild card.
|
||||||
if os.path.exists(dest) and not platform_utils.isdir(dest):
|
if os.path.exists(dest) and not platform_utils.isdir(dest):
|
||||||
_error('Link error: src with wildcard, %s must be a directory', dest)
|
_error('Link error: src with wildcard, %s must be a directory', dest)
|
||||||
else:
|
else:
|
||||||
|
4
repo
4
repo
@ -1169,6 +1169,10 @@ def main(orig_args):
|
|||||||
if my_main:
|
if my_main:
|
||||||
repo_main = my_main
|
repo_main = my_main
|
||||||
|
|
||||||
|
if not repo_main:
|
||||||
|
print("fatal: unable to find repo entry point", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
ver_str = '.'.join(map(str, VERSION))
|
ver_str = '.'.join(map(str, VERSION))
|
||||||
me = [sys.executable, repo_main,
|
me = [sys.executable, repo_main,
|
||||||
'--repo-dir=%s' % rel_repo_dir,
|
'--repo-dir=%s' % rel_repo_dir,
|
||||||
|
@ -179,6 +179,8 @@ without iterating through the remaining projects.
|
|||||||
'annotations': dict((a.name, a.value) for a in project.annotations),
|
'annotations': dict((a.name, a.value) for a in project.annotations),
|
||||||
'gitdir': project.gitdir,
|
'gitdir': project.gitdir,
|
||||||
'worktree': project.worktree,
|
'worktree': project.worktree,
|
||||||
|
'upstream': project.upstream,
|
||||||
|
'dest_branch': project.dest_branch,
|
||||||
}
|
}
|
||||||
|
|
||||||
def ValidateOptions(self, opt, args):
|
def ValidateOptions(self, opt, args):
|
||||||
@ -317,6 +319,8 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
|
|||||||
setenv('REPO_REMOTE', project['remote_name'])
|
setenv('REPO_REMOTE', project['remote_name'])
|
||||||
setenv('REPO_LREV', project['lrev'])
|
setenv('REPO_LREV', project['lrev'])
|
||||||
setenv('REPO_RREV', project['rrev'])
|
setenv('REPO_RREV', project['rrev'])
|
||||||
|
setenv('REPO_UPSTREAM', project['upstream'])
|
||||||
|
setenv('REPO_DEST_BRANCH', project['dest_branch'])
|
||||||
setenv('REPO_I', str(cnt + 1))
|
setenv('REPO_I', str(cnt + 1))
|
||||||
for name in project['annotations']:
|
for name in project['annotations']:
|
||||||
setenv("REPO__%s" % (name), project['annotations'][name])
|
setenv("REPO__%s" % (name), project['annotations'][name])
|
||||||
|
@ -34,6 +34,12 @@ The manifest and (if present) local_manifest.xml are combined
|
|||||||
together to produce a single manifest file. This file can be stored
|
together to produce a single manifest file. This file can be stored
|
||||||
in a Git repository for use during future 'repo init' invocations.
|
in a Git repository for use during future 'repo init' invocations.
|
||||||
|
|
||||||
|
The -r option can be used to generate a manifest file with project
|
||||||
|
revisions set to the current commit hash. These are known as
|
||||||
|
"revision locked manifests", as they don't follow a particular branch.
|
||||||
|
In this case, the 'upstream' attribute is set to the ref we were on
|
||||||
|
when the manifest was generated. The 'dest-branch' attribute is set
|
||||||
|
to indicate the remote ref to push changes to via 'repo upload'.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -57,6 +63,11 @@ in a Git repository for use during future 'repo init' invocations.
|
|||||||
help='If in -r mode, do not write the upstream field. '
|
help='If in -r mode, do not write the upstream field. '
|
||||||
'Only of use if the branch names for a sha1 manifest are '
|
'Only of use if the branch names for a sha1 manifest are '
|
||||||
'sensitive.')
|
'sensitive.')
|
||||||
|
p.add_option('--suppress-dest-branch', dest='peg_rev_dest_branch',
|
||||||
|
default=True, action='store_false',
|
||||||
|
help='If in -r mode, do not write the dest-branch field. '
|
||||||
|
'Only of use if the branch names for a sha1 manifest are '
|
||||||
|
'sensitive.')
|
||||||
p.add_option('-o', '--output-file',
|
p.add_option('-o', '--output-file',
|
||||||
dest='output_file',
|
dest='output_file',
|
||||||
default='-',
|
default='-',
|
||||||
@ -74,7 +85,8 @@ in a Git repository for use during future 'repo init' invocations.
|
|||||||
fd = open(opt.output_file, 'w')
|
fd = open(opt.output_file, 'w')
|
||||||
self.manifest.Save(fd,
|
self.manifest.Save(fd,
|
||||||
peg_rev=opt.peg_rev,
|
peg_rev=opt.peg_rev,
|
||||||
peg_rev_upstream=opt.peg_rev_upstream)
|
peg_rev_upstream=opt.peg_rev_upstream,
|
||||||
|
peg_rev_dest_branch=opt.peg_rev_dest_branch)
|
||||||
fd.close()
|
fd.close()
|
||||||
if opt.output_file != '-':
|
if opt.output_file != '-':
|
||||||
print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
|
print('Saved manifest to %s' % opt.output_file, file=sys.stderr)
|
||||||
|
Reference in New Issue
Block a user