Closed Bug 1203686 Opened 9 years ago Closed 9 years ago

Add git support to mach try's "find files changed in the current branch" feature

Categories

(Testing :: General, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: chmanchester, Assigned: chmanchester)

References

Details

Attachments

(1 file)

There's a plausible approach thanks to :jgraham based on git branch -a --contains and git ref-list, but according to http://marc.info/?l=git&m=143218896817198&w=2 and other threads on the list both of these commands are likely to fail on repositories like mozilla-central, where subsequent commits frequently have non-increasing commit dates. There are probably a few more ideas that might work, we can discuss here.
My current idea is: Get all branches with git branch -a. For each branch that isn't the current branch, find git merge-base HEAD $branch. Run git log --topo-order and iterate over the results in order and find the first commit that's also a merge-base. Run git diff --name-only with this commit. It's very slow, but I can't think of a way it would break.
git merge-base HEAD $(git branch -a) might actually work to find the right base commit for the diff
(with the asterisk removed from git branch -a)
Err, another shortcoming of git branch -a: it shows symbolic refs like "remotes/origin/HEAD -> origin/master"
Thanks glandium, I didn't notice merge-base works with more than two commits. Filtering the output of for-each-ref should work instead of git branch -a.
Bug 1203686 - Add git support to mach try's ability to find files changes on the current branch. r=jgraham
Attachment #8668573 - Flags: review?(james)
Assignee: nobody → cmanchester
Comment on attachment 8668573 [details] MozReview Request: Bug 1203686 - Add git support to mach try's ability to find files changes on the current branch. r=jgraham https://reviewboard.mozilla.org/r/20983/#review18869 ::: testing/tools/autotry/autotry.py:339 (Diff revision 1) > + args = ['git', 'diff', '--name-only', 'HEAD', base_commit] Probably better to do this with -z and split on null. ::: testing/tools/autotry/autotry.py:418 (Diff revision 1) > hg_args = [ For consistency I would mildly prefer if we had both git and hg implementations in their own method and this method. ::: testing/tools/autotry/autotry.py:427 (Diff revision 1) > return subprocess.check_output(hg_args).splitlines() Shouldn't this have some friendly error message if it fails?
Attachment #8668573 - Flags: review?(james)
https://reviewboard.mozilla.org/r/20983/#review18869 > Shouldn't this have some friendly error message if it fails? If a single invocation of hg log fails, I would think the cause would be obvious, but sure.
Comment on attachment 8668573 [details] MozReview Request: Bug 1203686 - Add git support to mach try's ability to find files changes on the current branch. r=jgraham Bug 1203686 - Add git support to mach try's ability to find files changes on the current branch. r=jgraham
Attachment #8668573 - Flags: review?(james)
Attachment #8668573 - Flags: review?(james) → review+
Comment on attachment 8668573 [details] MozReview Request: Bug 1203686 - Add git support to mach try's ability to find files changes on the current branch. r=jgraham https://reviewboard.mozilla.org/r/20983/#review18887
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: