make git fetching quite (#3180)
also output repo and branch/commit/tag in one line
This commit is contained in:
parent
6461737bba
commit
61d01a71dd
@ -597,25 +597,33 @@ def fetch(self):
|
|||||||
tty.msg("Already fetched %s" % self.stage.source_path)
|
tty.msg("Already fetched %s" % self.stage.source_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
args = []
|
args = ''
|
||||||
if self.commit:
|
if self.commit:
|
||||||
args.append('at commit %s' % self.commit)
|
args = 'at commit %s' % self.commit
|
||||||
elif self.tag:
|
elif self.tag:
|
||||||
args.append('at tag %s' % self.tag)
|
args = 'at tag %s' % self.tag
|
||||||
elif self.branch:
|
elif self.branch:
|
||||||
args.append('on branch %s' % self.branch)
|
args = 'on branch %s' % self.branch
|
||||||
tty.msg("Trying to clone git repository:", self.url, *args)
|
tty.msg("Trying to clone git repository: %s %s" % (self.url, args))
|
||||||
|
|
||||||
if self.commit:
|
if self.commit:
|
||||||
# Need to do a regular clone and check out everything if
|
# Need to do a regular clone and check out everything if
|
||||||
# they asked for a particular commit.
|
# they asked for a particular commit.
|
||||||
self.git('clone', self.url)
|
if spack.debug:
|
||||||
|
self.git('clone', self.url)
|
||||||
|
else:
|
||||||
|
self.git('clone', '--quiet', self.url)
|
||||||
self.stage.chdir_to_source()
|
self.stage.chdir_to_source()
|
||||||
self.git('checkout', self.commit)
|
if spack.debug:
|
||||||
|
self.git('checkout', self.commit)
|
||||||
|
else:
|
||||||
|
self.git('checkout', '--quiet', self.commit)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Can be more efficient if not checking out a specific commit.
|
# Can be more efficient if not checking out a specific commit.
|
||||||
args = ['clone']
|
args = ['clone']
|
||||||
|
if not spack.debug:
|
||||||
|
args.append('--quiet')
|
||||||
|
|
||||||
# If we want a particular branch ask for it.
|
# If we want a particular branch ask for it.
|
||||||
if self.branch:
|
if self.branch:
|
||||||
@ -652,12 +660,19 @@ def fetch(self):
|
|||||||
# pull --tags returns a "special" error code of 1 in
|
# pull --tags returns a "special" error code of 1 in
|
||||||
# older versions that we have to ignore.
|
# older versions that we have to ignore.
|
||||||
# see: https://github.com/git/git/commit/19d122b
|
# see: https://github.com/git/git/commit/19d122b
|
||||||
self.git('pull', '--tags', ignore_errors=1)
|
if spack.debug:
|
||||||
self.git('checkout', self.tag)
|
self.git('pull', '--tags', ignore_errors=1)
|
||||||
|
self.git('checkout', self.tag)
|
||||||
|
else:
|
||||||
|
self.git('pull', '--quiet', '--tags', ignore_errors=1)
|
||||||
|
self.git('checkout', '--quiet', self.tag)
|
||||||
|
|
||||||
# Init submodules if the user asked for them.
|
# Init submodules if the user asked for them.
|
||||||
if self.submodules:
|
if self.submodules:
|
||||||
self.git('submodule', 'update', '--init')
|
if spack.debug:
|
||||||
|
self.git('submodule', 'update', '--init')
|
||||||
|
else:
|
||||||
|
self.git('submodule', '--quiet', 'update', '--init')
|
||||||
|
|
||||||
def archive(self, destination):
|
def archive(self, destination):
|
||||||
super(GitFetchStrategy, self).archive(destination, exclude='.git')
|
super(GitFetchStrategy, self).archive(destination, exclude='.git')
|
||||||
@ -665,8 +680,12 @@ def archive(self, destination):
|
|||||||
@_needs_stage
|
@_needs_stage
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.stage.chdir_to_source()
|
self.stage.chdir_to_source()
|
||||||
self.git('checkout', '.')
|
if spack.debug:
|
||||||
self.git('clean', '-f')
|
self.git('checkout', '.')
|
||||||
|
self.git('clean', '-f')
|
||||||
|
else:
|
||||||
|
self.git('checkout', '--quiet', '.')
|
||||||
|
self.git('clean', '--quiet', '-f')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "[git] %s" % self.url
|
return "[git] %s" % self.url
|
||||||
|
Loading…
Reference in New Issue
Block a user