Merge branch 'trws-git-tag-support' into develop
This commit is contained in:
		| @@ -417,12 +417,18 @@ def fetch(self): | |||||||
|             # If we want a particular branch ask for it. |             # If we want a particular branch ask for it. | ||||||
|             if self.branch: |             if self.branch: | ||||||
|                 args.extend(['--branch', self.branch]) |                 args.extend(['--branch', self.branch]) | ||||||
|  |             elif self.tag and self.git_version >= ver('1.8.5.2'): | ||||||
|  |                     args.extend(['--branch', self.tag]) | ||||||
|  |  | ||||||
|             # Try to be efficient if we're using a new enough git. |             # Try to be efficient if we're using a new enough git. | ||||||
|             # This checks out only one branch's history |             # This checks out only one branch's history | ||||||
|             if self.git_version > ver('1.7.10'): |             if self.git_version > ver('1.7.10'): | ||||||
|                 args.append('--single-branch') |                 args.append('--single-branch') | ||||||
|  |  | ||||||
|  |             # Yet more efficiency, only download a 1-commit deep tree | ||||||
|  |             if self.git_version >= ver('1.7.1'): | ||||||
|  |                 args.extend(['--depth','1']) | ||||||
|  |  | ||||||
|             args.append(self.url) |             args.append(self.url) | ||||||
|             self.git(*args) |             self.git(*args) | ||||||
|             self.stage.chdir_to_source() |             self.stage.chdir_to_source() | ||||||
| @@ -430,7 +436,11 @@ def fetch(self): | |||||||
|             # For tags, be conservative and check them out AFTER |             # For tags, be conservative and check them out AFTER | ||||||
|             # cloning.  Later git versions can do this with clone |             # cloning.  Later git versions can do this with clone | ||||||
|             # --branch, but older ones fail. |             # --branch, but older ones fail. | ||||||
|             if self.tag: |             if self.tag and self.git_version < ver('1.8.5.2'): | ||||||
|  |                 # 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) |                 self.git('checkout', self.tag) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -57,8 +57,13 @@ def __call__(self, *args, **kwargs): | |||||||
|         """Run the executable with subprocess.check_output, return output.""" |         """Run the executable with subprocess.check_output, return output.""" | ||||||
|         return_output = kwargs.get("return_output", False) |         return_output = kwargs.get("return_output", False) | ||||||
|         fail_on_error = kwargs.get("fail_on_error", True) |         fail_on_error = kwargs.get("fail_on_error", True) | ||||||
|  |         ignore_errors = kwargs.get("ignore_errors", ()) | ||||||
|         error         = kwargs.get("error", sys.stderr) |         error         = kwargs.get("error", sys.stderr) | ||||||
|  |  | ||||||
|  |         # if they just want to ignore one error code, make it a tuple. | ||||||
|  |         if isinstance(ignore_errors, int): | ||||||
|  |             ignore_errors = (ignore_errors,) | ||||||
|  |  | ||||||
|         quoted_args = [arg for arg in args if re.search(r'^"|^\'|"$|\'$', arg)] |         quoted_args = [arg for arg in args if re.search(r'^"|^\'|"$|\'$', arg)] | ||||||
|         if quoted_args: |         if quoted_args: | ||||||
|             tty.warn("Quotes in command arguments can confuse scripts like configure.", |             tty.warn("Quotes in command arguments can confuse scripts like configure.", | ||||||
| @@ -85,7 +90,8 @@ def __call__(self, *args, **kwargs): | |||||||
|             out, err = proc.communicate() |             out, err = proc.communicate() | ||||||
|             self.returncode = proc.returncode |             self.returncode = proc.returncode | ||||||
|  |  | ||||||
|             if fail_on_error and proc.returncode != 0: |             rc = proc.returncode | ||||||
|  |             if fail_on_error and rc != 0 and (rc not in ignore_errors): | ||||||
|                 raise ProcessError("Command exited with status %d:" |                 raise ProcessError("Command exited with status %d:" | ||||||
|                                    % proc.returncode, cmd_line) |                                    % proc.returncode, cmd_line) | ||||||
|             if return_output: |             if return_output: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin