mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Add 'repo sync -l' to only do local operations
This permits usage of 'repo sync' while offline, as we bypass the network based portions of the code and do only the local sync. An example use case might be: repo sync -n ; # while we have network ... some time later ... repo sync -l ; # while without network, come up to date Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
3e768c9dc7
commit
b1562faee0
@ -52,6 +52,9 @@ revision is temporarily needed.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _Options(self, p):
|
def _Options(self, p):
|
||||||
|
p.add_option('-l','--local-only',
|
||||||
|
dest='local_only', action='store_true',
|
||||||
|
help="only update working tree, don't fetch")
|
||||||
p.add_option('-n','--network-only',
|
p.add_option('-n','--network-only',
|
||||||
dest='network_only', action='store_true',
|
dest='network_only', action='store_true',
|
||||||
help="fetch only, don't update working tree")
|
help="fetch only, don't update working tree")
|
||||||
@ -80,6 +83,9 @@ revision is temporarily needed.
|
|||||||
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 >>sys.stderr, 'error: cannot combine -n and -d'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if opt.network_only and opt.local_only:
|
||||||
|
print >>sys.stderr, 'error: cannot combine -n and -l'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
rp = self.manifest.repoProject
|
rp = self.manifest.repoProject
|
||||||
rp.PreSync()
|
rp.PreSync()
|
||||||
@ -93,6 +99,8 @@ revision is temporarily needed.
|
|||||||
project.PostRepoUpgrade()
|
project.PostRepoUpgrade()
|
||||||
|
|
||||||
all = self.GetProjects(args, missing_ok=True)
|
all = self.GetProjects(args, missing_ok=True)
|
||||||
|
|
||||||
|
if not opt.local_only:
|
||||||
fetched = self._Fetch(rp, mp, *all)
|
fetched = self._Fetch(rp, mp, *all)
|
||||||
|
|
||||||
if rp.HasChanges:
|
if rp.HasChanges:
|
||||||
|
Loading…
Reference in New Issue
Block a user