|
|
Created:
6 years, 8 months ago by iannucci Modified:
6 years, 8 months ago CC:
chromium-reviews, Dirk Pranke, cmp-cc_chromium.org, M-A Ruel, iannucci+depot_tools_chromium.org, ilevy-cc_chromium.org Base URL:
https://chromium.googlesource.com/chromium/tools/depot_tools.git@master Visibility:
Public. |
DescriptionUse get_or_create_merge_base in git-cl-upload to correctly deal with rebased
upstreams.
In the event that users are NOT using the enhanced tooling, this is equivalent
to `git merge-base "@{u}" HEAD`. In the event that they are, this will catch
the case where their parent branch got rebased, but this branch hasn't been
rebased on the parent yet.
R=agable@chromium.org, szager@chromium.org
BUG=
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=261601
Patch Set 1 #Patch Set 2 : fix tests' #Messages
Total messages: 14 (0 generated)
lgtm
The CQ bit was checked by iannucci@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/224703002/1
The CQ bit was unchecked by commit-bot@chromium.org
Presubmit check for 224703002-1 failed and returned exit status 1. Running presubmit commit checks ... Checking out rietveld... Running save-description-on-failure.sh Running push-basic.sh Running upstream.sh Running submit-from-new-dir.sh Running abandon.sh Running submodule-merge-test.sh Running upload-local-tracking-branch.sh Running hooks.sh Running post-dcommit-hook-test.sh Running upload-stale.sh Running patch.sh Running basic.sh ** Presubmit ERRORS ** Pylint (94 files) (26.86s) failed ************* Module /b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py R0201:554,2:Changelist.GetCommonAncestorWithUpstream: Method could be a function tests/git_cl_test.py (0.46s) failed ...ERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) FERROR:root:@8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) F. ====================================================================== FAIL: test_gerrit_no_reviewer (__main__.TestGitCl) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/git_cl_test.py", line 620, in test_gerrit_no_reviewer []) File "tests/git_cl_test.py", line 608, in _run_gerrit_upload_test git_cl.main(['upload'] + upload_args) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 2536, in main return dispatcher.execute(OptionParser(), argv) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/subcommand.py", line 245, in execute return command(parser, args[1:]) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 1687, in CMDupload base_branch = cl.GetCommonAncestorWithUpstream() File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 555, in GetCommonAncestorWithUpstream return git_common.get_or_create_merge_base(git_common.current_branch()) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 273, in current_branch return run('rev-parse', '--abbrev-ref', 'HEAD') File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 465, in run return run_with_stderr(*cmd, **kwargs)[0] File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 497, in run_with_stderr proc = subprocess2.Popen(cmd, **kwargs) File "tests/git_cl_test.py", line 107, in _mocked_call self.fail(msg) AssertionError: @8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) ====================================================================== FAIL: test_gerrit_reviewer_multiple (__main__.TestGitCl) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/git_cl_test.py", line 633, in test_gerrit_reviewer_multiple ['reviewer@example.com', 'another@example.com']) File "tests/git_cl_test.py", line 608, in _run_gerrit_upload_test git_cl.main(['upload'] + upload_args) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 2536, in main return dispatcher.execute(OptionParser(), argv) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/subcommand.py", line 245, in execute return command(parser, args[1:]) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 1687, in CMDupload base_branch = cl.GetCommonAncestorWithUpstream() File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 555, in GetCommonAncestorWithUpstream return git_common.get_or_create_merge_base(git_common.current_branch()) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 273, in current_branch return run('rev-parse', '--abbrev-ref', 'HEAD') File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 465, in run return run_with_stderr(*cmd, **kwargs)[0] File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 497, in run_with_stderr proc = subprocess2.Popen(cmd, **kwargs) File "tests/git_cl_test.py", line 107, in _mocked_call self.fail(msg) AssertionError: @8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) ====================================================================== FAIL: test_gerrit_reviewers_cmd_line (__main__.TestGitCl) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/git_cl_test.py", line 626, in test_gerrit_reviewers_cmd_line ['foo@example.com']) File "tests/git_cl_test.py", line 608, in _run_gerrit_upload_test git_cl.main(['upload'] + upload_args) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 2536, in main return dispatcher.execute(OptionParser(), argv) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/subcommand.py", line 245, in execute return command(parser, args[1:]) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 1687, in CMDupload base_branch = cl.GetCommonAncestorWithUpstream() File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 555, in GetCommonAncestorWithUpstream return git_common.get_or_create_merge_base(git_common.current_branch()) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 273, in current_branch return run('rev-parse', '--abbrev-ref', 'HEAD') File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 465, in run return run_with_stderr(*cmd, **kwargs)[0] File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 497, in run_with_stderr proc = subprocess2.Popen(cmd, **kwargs) File "tests/git_cl_test.py", line 107, in _mocked_call self.fail(msg) AssertionError: @8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) ====================================================================== FAIL: test_gerrit_upload_without_change_id (__main__.TestGitCl) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/git_cl_test.py", line 614, in test_gerrit_upload_without_change_id []) File "tests/git_cl_test.py", line 608, in _run_gerrit_upload_test git_cl.main(['upload'] + upload_args) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 2536, in main return dispatcher.execute(OptionParser(), argv) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/subcommand.py", line 245, in execute return command(parser, args[1:]) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 1687, in CMDupload base_branch = cl.GetCommonAncestorWithUpstream() File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 555, in GetCommonAncestorWithUpstream return git_common.get_or_create_merge_base(git_common.current_branch()) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 273, in current_branch return run('rev-parse', '--abbrev-ref', 'HEAD') File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 465, in run return run_with_stderr(*cmd, **kwargs)[0] File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_common.py", line 497, in run_with_stderr proc = subprocess2.Popen(cmd, **kwargs) File "tests/git_cl_test.py", line 107, in _mocked_call self.fail(msg) AssertionError: @8 Expected: (['git', 'symbolic-ref', 'HEAD'],) Actual: (('git', 'rev-parse', '--abbrev-ref', 'HEAD'),) ====================================================================== FAIL: test_keep_find_copies (__main__.TestGitCl) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/git_cl_test.py", line 434, in test_keep_find_copies []) File "tests/git_cl_test.py", line 410, in _run_reviewer_test git_cl.main(['upload'] + upload_args) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.py", line 2536, in main return dispatcher.execute(OptionParser(), argv) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/subcommand.py", line 245, in execute return command(parser, args[1:]) File "/b/infra_internal/commit_queue/workdir/tools/depot_tools/git_cl.p… (message too large)
mox strikes again :(
On 2014/04/03 22:55:49, iannucci wrote: > mox strikes again :( why did HEADs turn into masters?
fixed the tests by mocking git_common.get_or_create_merge_base. I think this is justified since get_or_create_merge_base has its own tests (tests/git_common_test.py).
On 2014/04/04 00:21:15, agable wrote: > On 2014/04/03 22:55:49, iannucci wrote: > > mox strikes again :( > > why did HEADs turn into masters? Before it would take base(HEAD, @{u}), but since the merge base markers are keyed on branchname, I opted to use base(branch, @{u}). In practice this should be fine because you can't use git cl upload on a detached HEAD anyway: ➜ depot_tools git:(0a42737) git cl upload fatal: ref HEAD is not a symbolic ref Command "git symbolic-ref HEAD" failed. The reason the second one is 'master' and not 'origin/master' is because of test mockery.
lgtm
The CQ bit was checked by iannucci@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/224703002/20001
Message was sent while issue was closed.
Change committed as 261601 |