diff options
author | Denis Davydov <davydden@gmail.com> | 2017-03-25 01:37:47 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-03-24 17:37:47 -0700 |
commit | 61d01a71dd775eca0679c205390229b5d35624d9 (patch) | |
tree | 9c3cc0c2f6adc45c55c1b5e5f790d2eb44de488b /lib | |
parent | 6461737bba24e9a66c09e9b60e9c9148a9406e49 (diff) | |
download | spack-61d01a71dd775eca0679c205390229b5d35624d9.tar.gz spack-61d01a71dd775eca0679c205390229b5d35624d9.tar.bz2 spack-61d01a71dd775eca0679c205390229b5d35624d9.tar.xz spack-61d01a71dd775eca0679c205390229b5d35624d9.zip |
make git fetching quite (#3180)
also output repo and branch/commit/tag in one line
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index eadcef85f3..d510db568f 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -597,25 +597,33 @@ class GitFetchStrategy(VCSFetchStrategy): tty.msg("Already fetched %s" % self.stage.source_path) return - args = [] + args = '' if self.commit: - args.append('at commit %s' % self.commit) + args = 'at commit %s' % self.commit elif self.tag: - args.append('at tag %s' % self.tag) + args = 'at tag %s' % self.tag elif self.branch: - args.append('on branch %s' % self.branch) - tty.msg("Trying to clone git repository:", self.url, *args) + args = 'on branch %s' % self.branch + tty.msg("Trying to clone git repository: %s %s" % (self.url, args)) if self.commit: # Need to do a regular clone and check out everything if # 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.git('checkout', self.commit) + if spack.debug: + self.git('checkout', self.commit) + else: + self.git('checkout', '--quiet', self.commit) else: # Can be more efficient if not checking out a specific commit. args = ['clone'] + if not spack.debug: + args.append('--quiet') # If we want a particular branch ask for it. if self.branch: @@ -652,12 +660,19 @@ class GitFetchStrategy(VCSFetchStrategy): # pull --tags returns a "special" error code of 1 in # older versions that we have to ignore. # see: https://github.com/git/git/commit/19d122b - self.git('pull', '--tags', ignore_errors=1) - self.git('checkout', self.tag) + if spack.debug: + 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. 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): super(GitFetchStrategy, self).archive(destination, exclude='.git') @@ -665,8 +680,12 @@ class GitFetchStrategy(VCSFetchStrategy): @_needs_stage def reset(self): self.stage.chdir_to_source() - self.git('checkout', '.') - self.git('clean', '-f') + if spack.debug: + self.git('checkout', '.') + self.git('clean', '-f') + else: + self.git('checkout', '--quiet', '.') + self.git('clean', '--quiet', '-f') def __str__(self): return "[git] %s" % self.url |