diff options
-rw-r--r-- | git_command.py | 2 | ||||
-rw-r--r-- | project.py | 31 |
2 files changed, 26 insertions, 7 deletions
diff --git a/git_command.py b/git_command.py index 71b464c6..fe1e48d6 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -286,6 +286,7 @@ class GitCommand(object): | |||
286 | objdir=None, | 286 | objdir=None, |
287 | verify_command=False, | 287 | verify_command=False, |
288 | add_event_log=True, | 288 | add_event_log=True, |
289 | log_as_error=True, | ||
289 | ): | 290 | ): |
290 | if project: | 291 | if project: |
291 | if not cwd: | 292 | if not cwd: |
@@ -362,6 +363,7 @@ class GitCommand(object): | |||
362 | "ReturnCode": str(e.git_rc) | 363 | "ReturnCode": str(e.git_rc) |
363 | if e.git_rc is not None | 364 | if e.git_rc is not None |
364 | else None, | 365 | else None, |
366 | "IsError": log_as_error, | ||
365 | } | 367 | } |
366 | ) | 368 | ) |
367 | event_log.ErrorEvent( | 369 | event_log.ErrorEvent( |
@@ -205,7 +205,9 @@ class ReviewableBranch(object): | |||
205 | "--", | 205 | "--", |
206 | ) | 206 | ) |
207 | try: | 207 | try: |
208 | self._commit_cache = self.project.bare_git.rev_list(*args) | 208 | self._commit_cache = self.project.bare_git.rev_list( |
209 | *args, log_as_error=self.base_exists | ||
210 | ) | ||
209 | except GitError: | 211 | except GitError: |
210 | # We weren't able to probe the commits for this branch. Was it | 212 | # We weren't able to probe the commits for this branch. Was it |
211 | # tracking a branch that no longer exists? If so, return no | 213 | # tracking a branch that no longer exists? If so, return no |
@@ -1593,7 +1595,9 @@ class Project(object): | |||
1593 | # See if we can perform a fast forward merge. This can happen if our | 1595 | # See if we can perform a fast forward merge. This can happen if our |
1594 | # branch isn't in the exact same state as we last published. | 1596 | # branch isn't in the exact same state as we last published. |
1595 | try: | 1597 | try: |
1596 | self.work_git.merge_base("--is-ancestor", HEAD, revid) | 1598 | self.work_git.merge_base( |
1599 | "--is-ancestor", HEAD, revid, log_as_error=False | ||
1600 | ) | ||
1597 | # Skip the published logic. | 1601 | # Skip the published logic. |
1598 | pub = False | 1602 | pub = False |
1599 | except GitError: | 1603 | except GitError: |
@@ -2304,15 +2308,26 @@ class Project(object): | |||
2304 | # if revision (sha or tag) is not present then following function | 2308 | # if revision (sha or tag) is not present then following function |
2305 | # throws an error. | 2309 | # throws an error. |
2306 | self.bare_git.rev_list( | 2310 | self.bare_git.rev_list( |
2307 | "-1", "--missing=allow-any", "%s^0" % self.revisionExpr, "--" | 2311 | "-1", |
2312 | "--missing=allow-any", | ||
2313 | "%s^0" % self.revisionExpr, | ||
2314 | "--", | ||
2315 | log_as_error=False, | ||
2308 | ) | 2316 | ) |
2309 | if self.upstream: | 2317 | if self.upstream: |
2310 | rev = self.GetRemote().ToLocal(self.upstream) | 2318 | rev = self.GetRemote().ToLocal(self.upstream) |
2311 | self.bare_git.rev_list( | 2319 | self.bare_git.rev_list( |
2312 | "-1", "--missing=allow-any", "%s^0" % rev, "--" | 2320 | "-1", |
2321 | "--missing=allow-any", | ||
2322 | "%s^0" % rev, | ||
2323 | "--", | ||
2324 | log_as_error=False, | ||
2313 | ) | 2325 | ) |
2314 | self.bare_git.merge_base( | 2326 | self.bare_git.merge_base( |
2315 | "--is-ancestor", self.revisionExpr, rev | 2327 | "--is-ancestor", |
2328 | self.revisionExpr, | ||
2329 | rev, | ||
2330 | log_as_error=False, | ||
2316 | ) | 2331 | ) |
2317 | return True | 2332 | return True |
2318 | except GitError: | 2333 | except GitError: |
@@ -3612,7 +3627,7 @@ class Project(object): | |||
3612 | self.update_ref("-d", name, old) | 3627 | self.update_ref("-d", name, old) |
3613 | self._project.bare_ref.deleted(name) | 3628 | self._project.bare_ref.deleted(name) |
3614 | 3629 | ||
3615 | def rev_list(self, *args, **kw): | 3630 | def rev_list(self, *args, log_as_error=True, **kw): |
3616 | if "format" in kw: | 3631 | if "format" in kw: |
3617 | cmdv = ["log", "--pretty=format:%s" % kw["format"]] | 3632 | cmdv = ["log", "--pretty=format:%s" % kw["format"]] |
3618 | else: | 3633 | else: |
@@ -3626,6 +3641,7 @@ class Project(object): | |||
3626 | capture_stdout=True, | 3641 | capture_stdout=True, |
3627 | capture_stderr=True, | 3642 | capture_stderr=True, |
3628 | verify_command=True, | 3643 | verify_command=True, |
3644 | log_as_error=log_as_error, | ||
3629 | ) | 3645 | ) |
3630 | p.Wait() | 3646 | p.Wait() |
3631 | return p.stdout.splitlines() | 3647 | return p.stdout.splitlines() |
@@ -3653,7 +3669,7 @@ class Project(object): | |||
3653 | """ | 3669 | """ |
3654 | name = name.replace("_", "-") | 3670 | name = name.replace("_", "-") |
3655 | 3671 | ||
3656 | def runner(*args, **kwargs): | 3672 | def runner(*args, log_as_error=True, **kwargs): |
3657 | cmdv = [] | 3673 | cmdv = [] |
3658 | config = kwargs.pop("config", None) | 3674 | config = kwargs.pop("config", None) |
3659 | for k in kwargs: | 3675 | for k in kwargs: |
@@ -3674,6 +3690,7 @@ class Project(object): | |||
3674 | capture_stdout=True, | 3690 | capture_stdout=True, |
3675 | capture_stderr=True, | 3691 | capture_stderr=True, |
3676 | verify_command=True, | 3692 | verify_command=True, |
3693 | log_as_error=log_as_error, | ||
3677 | ) | 3694 | ) |
3678 | p.Wait() | 3695 | p.Wait() |
3679 | r = p.stdout | 3696 | r = p.stdout |