Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Issue 26109002: Add git-number script to calculate generation numbers for commits. (Closed)

Created:
7 years, 2 months ago by iannucci
Modified:
7 years ago
CC:
chromium-reviews, Dirk Pranke, cmp-cc_chromium.org, iannucci+depot_tools_chromium.org, ilevy-cc_chromium.org
Visibility:
Public.

Description

Add git-number script to calculate generation numbers for commits. Compatible with any git topology (multiple roots, weird branching/merging, etc.) I can't get it to be any faster (in python). Suggestions welcome :). On z600/linux, this takes 5.1s to calculate the initial count for 2e3de954ef0a (HEAD on src.git at the time of writing). Subsequent lookups take ~0.06s. For reference, this machine takes 3s to just list the revisions in sorted order without any additional processing (using rev-list). All calculations are stored in a git-notes-style ref with the exception that the leaf 'tree' object which would normally be stored in a git-notes world is replaced with a packed binary file which consists of records [hash int]. Each run of this script will create only 1 commit object on this internal ref which will have as its parents: * The previous git number commit * All of the target commits we calculated numbers for. This ref is then excluded on subsequent invocations of rev-list, which means that git-number will only ever process commit objects which it hasn't already calculated a value for. It also prevents you from attempting to number this special ref :). This implementation only has a 1-byte fanout which seems to be the best performance for the repos we're dealing with (i.e. on the order of 500k commit objects). Bumping this up to a 2-byte fanout became extremely slow (I suspect the internal caching structures I'm using are not efficient in this mode and could be improved). Using no fanout is slower than the 1 byte fanout for lookups by about 30%. R=agable@chromium.org, stip@chromium.org, szager@chromium.org BUG=280154, 309692, skia:1639 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=236035

Patch Set 1 #

Patch Set 2 : Parse all refs in one command. Reduces overhead when attempting to obtain numbers for multiple refs. #

Patch Set 3 : Make it work on windows. 9s for initial calculation/.3s for lookup on z620. #

Patch Set 4 : Remove silly author line :) #

Total comments: 81

Patch Set 5 : Address comments #

Patch Set 6 : Address comments (reupload!) #

Total comments: 10

Patch Set 7 : Address more formatting comments #

Patch Set 8 : Now with tests! #

Total comments: 38

Patch Set 9 : address comments #

Total comments: 21

Patch Set 10 : Address final comments? #

Total comments: 3

Patch Set 11 : ws #

Total comments: 21

Patch Set 12 : #

Total comments: 14

Patch Set 13 : fixes #

Total comments: 6

Patch Set 14 : more fixins #

Total comments: 26

Patch Set 15 #

Total comments: 16

Patch Set 16 : woot! working! #

Patch Set 17 : Add version checking for coverage module #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1427 lines, -5 lines) Patch
A + git-number View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -5 lines 0 comments Download
A git_common.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +301 lines, -0 lines 0 comments Download
A git_number.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +267 lines, -0 lines 0 comments Download
A testing_support/coverage_utils.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +69 lines, -0 lines 0 comments Download
A testing_support/git_test_utils.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +418 lines, -0 lines 0 comments Download
A tests/git_common_test.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +281 lines, -0 lines 0 comments Download
A tests/git_number_test.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +86 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (0 generated)
iannucci
7 years, 2 months ago (2013-10-05 05:55:14 UTC) #1
iannucci
Presumably, I will also want to eventually add the equivalent of `git describe` and `git ...
7 years, 2 months ago (2013-10-05 06:05:25 UTC) #2
iannucci
Also, here's a relevant SO question: http://stackoverflow.com/questions/6702821/git-commit-generation-numbers/6708132#6708132
7 years, 2 months ago (2013-10-05 06:06:57 UTC) #3
iannucci
I was thinking about adding some 'root' tracking logic to this, but it only solves ...
7 years, 2 months ago (2013-10-08 02:26:46 UTC) #4
iannucci
Can has review? Anyone? :P
7 years, 2 months ago (2013-10-21 17:36:38 UTC) #5
agable
On 2013/10/21 17:36:38, iannucci wrote: > Can has review? Anyone? :P On it.
7 years, 2 months ago (2013-10-21 17:43:19 UTC) #6
M-A Ruel
Are the tests coming in a follow up CL? Otherwise why so many trivial functions ...
7 years, 2 months ago (2013-10-21 17:56:43 UTC) #7
iannucci
On 2013/10/21 17:56:43, M-A Ruel wrote: > Are the tests coming in a follow up ...
7 years, 2 months ago (2013-10-21 18:04:05 UTC) #8
agable
https://codereview.chromium.org/26109002/diff/11001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/11001/git_common.py#newcode37 git_common.py:37: self.out_err = out_err output and out_err are never used. ...
7 years, 2 months ago (2013-10-21 20:16:41 UTC) #9
iannucci
No tests yet, but comments addressed. https://chromiumcodereview.appspot.com/26109002/diff/11001/git-number File git-number (right): https://chromiumcodereview.appspot.com/26109002/diff/11001/git-number#newcode24 git-number:24: PYTHONDONTWRITEBYTECODE=1 exec "$base_dir/python_bin/python.exe" ...
7 years, 2 months ago (2013-10-22 07:28:22 UTC) #10
M-A Ruel
https://chromiumcodereview.appspot.com/26109002/diff/11001/git-number File git-number (right): https://chromiumcodereview.appspot.com/26109002/diff/11001/git-number#newcode24 git-number:24: PYTHONDONTWRITEBYTECODE=1 exec "$base_dir/python_bin/python.exe" "$base_dir"/git_number.py "$@" On 2013/10/22 07:28:22, iannucci ...
7 years, 2 months ago (2013-10-24 13:23:03 UTC) #11
iannucci
Working on tests now. Formatting comments addressed (hopefully). https://codereview.chromium.org/26109002/diff/11001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/11001/git_common.py#newcode183 git_common.py:183: def ...
7 years, 2 months ago (2013-10-25 00:52:41 UTC) #12
iannucci
OK! PTAL, now with 100% code coverage
7 years, 1 month ago (2013-11-07 20:03:23 UTC) #13
M-A Ruel
https://chromiumcodereview.appspot.com/26109002/diff/197001/git-number File git-number (right): https://chromiumcodereview.appspot.com/26109002/diff/197001/git-number#newcode23 git-number:23: if [ -d "$base_dir/python_bin" -a $MINGW = 0 ]; ...
7 years, 1 month ago (2013-11-07 20:59:11 UTC) #14
iannucci
Thanks for the fast feedback. PTAL https://chromiumcodereview.appspot.com/26109002/diff/197001/git-number File git-number (right): https://chromiumcodereview.appspot.com/26109002/diff/197001/git-number#newcode23 git-number:23: if [ -d ...
7 years, 1 month ago (2013-11-07 21:44:56 UTC) #15
M-A Ruel
Sorry for the delay, I wasn't fully awake yesterday. https://chromiumcodereview.appspot.com/26109002/diff/347001/git_common.py File git_common.py (right): https://chromiumcodereview.appspot.com/26109002/diff/347001/git_common.py#newcode54 git_common.py:54: ...
7 years, 1 month ago (2013-11-08 19:32:22 UTC) #16
iannucci
https://codereview.chromium.org/26109002/diff/347001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/347001/git_common.py#newcode54 git_common.py:54: cache = {} On 2013/11/08 19:32:23, M-A Ruel wrote: ...
7 years, 1 month ago (2013-11-11 22:59:23 UTC) #17
iannucci
(PTAL; I think this is ready to go, unless anyone has more comments? :)
7 years, 1 month ago (2013-11-12 20:34:16 UTC) #18
M-A Ruel
I'm not warm to 'git-number' name, I'd prefer git-pseudorev or something like that. But I ...
7 years, 1 month ago (2013-11-12 21:13:40 UTC) #19
iannucci
On 2013/11/12 21:13:40, M-A Ruel wrote: > I'm not warm to 'git-number' name, I'd prefer ...
7 years, 1 month ago (2013-11-12 21:28:49 UTC) #20
iannucci
Can I land this yet? :(
7 years, 1 month ago (2013-11-13 17:56:04 UTC) #21
M-A Ruel
Sorry for the delays, I'm slow at larger code dumps (it's over 1400 lines). On ...
7 years, 1 month ago (2013-11-13 18:10:50 UTC) #22
iannucci
On 2013/11/13 18:10:50, M-A Ruel wrote: > Sorry for the delays, I'm slow at larger ...
7 years, 1 month ago (2013-11-13 18:19:19 UTC) #23
iannucci
On 2013/11/13 18:19:19, iannucci wrote: > On 2013/11/13 18:10:50, M-A Ruel wrote: > > Sorry ...
7 years, 1 month ago (2013-11-13 18:46:39 UTC) #24
M-A Ruel
https://codereview.chromium.org/26109002/diff/547001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/547001/git_common.py#newcode143 git_common.py:143: class ProgressPrinter(object): FTR, I prefer https://code.google.com/p/swarming/source/browse/utils/threading_utils.py?repo=client#396 which is very ...
7 years, 1 month ago (2013-11-13 19:54:59 UTC) #25
iannucci
https://codereview.chromium.org/26109002/diff/547001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/547001/git_common.py#newcode143 git_common.py:143: class ProgressPrinter(object): On 2013/11/13 19:55:00, M-A Ruel wrote: > ...
7 years, 1 month ago (2013-11-14 07:06:28 UTC) #26
M-A Ruel
https://codereview.chromium.org/26109002/diff/547001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/547001/git_common.py#newcode180 git_common.py:180: self._stream.write('\r'+s) On 2013/11/14 07:06:29, iannucci wrote: > On 2013/11/13 ...
7 years, 1 month ago (2013-11-14 17:27:23 UTC) #27
iannucci
https://codereview.chromium.org/26109002/diff/637001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/637001/git_common.py#newcode22 git_common.py:22: import subprocess2 On 2013/11/14 17:27:24, M-A Ruel wrote: > ...
7 years, 1 month ago (2013-11-15 02:12:57 UTC) #28
M-A Ruel
https://codereview.chromium.org/26109002/diff/757001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/757001/git_common.py#newcode205 git_common.py:205: raise Exception('one of %s does not seem to be ...
7 years, 1 month ago (2013-11-15 02:51:28 UTC) #29
iannucci
https://codereview.chromium.org/26109002/diff/757001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/757001/git_common.py#newcode205 git_common.py:205: raise Exception('one of %s does not seem to be ...
7 years, 1 month ago (2013-11-15 04:16:05 UTC) #30
iannucci
What do I need to do to land this? I'm getting antsy :)
7 years, 1 month ago (2013-11-15 22:13:25 UTC) #31
M-A Ruel
Getting near. Your code will be perfect. :) https://codereview.chromium.org/26109002/diff/797002/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/797002/git_common.py#newcode277 git_common.py:277: opts ...
7 years, 1 month ago (2013-11-15 22:37:05 UTC) #32
iannucci
https://chromiumcodereview.appspot.com/26109002/diff/797002/git_common.py File git_common.py (right): https://chromiumcodereview.appspot.com/26109002/diff/797002/git_common.py#newcode277 git_common.py:277: opts += ['-r'] On 2013/11/15 22:37:06, M-A Ruel wrote: ...
7 years, 1 month ago (2013-11-15 23:18:00 UTC) #33
M-A Ruel
Last series of issues. lgtm after that. https://codereview.chromium.org/26109002/diff/897001/git_common.py File git_common.py (right): https://codereview.chromium.org/26109002/diff/897001/git_common.py#newcode226 git_common.py:226: logging.debug('running: %s', ...
7 years, 1 month ago (2013-11-17 19:54:58 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/26109002/957001
7 years, 1 month ago (2013-11-18 05:38:34 UTC) #35
iannucci
https://chromiumcodereview.appspot.com/26109002/diff/897001/git_common.py File git_common.py (right): https://chromiumcodereview.appspot.com/26109002/diff/897001/git_common.py#newcode226 git_common.py:226: logging.debug('running: %s', ' '.join(repr(tok) for tok in cmd)) On ...
7 years, 1 month ago (2013-11-18 05:38:55 UTC) #36
commit-bot: I haz the power
Presubmit check for 26109002-957001 failed and returned exit status 1. Running presubmit commit checks ...
7 years, 1 month ago (2013-11-18 05:40:06 UTC) #37
iannucci
Aaand... that's a race in the coverage module (local repro, at least). Doesn't seem to ...
7 years, 1 month ago (2013-11-18 05:50:29 UTC) #38
iannucci
On 2013/11/18 05:50:29, iannucci wrote: > Aaand... that's a race in the coverage module (local ...
7 years, 1 month ago (2013-11-18 05:54:37 UTC) #39
iannucci
Ok, added version checking for the coverage module, so we can optionally have tests require ...
7 years, 1 month ago (2013-11-19 08:30:44 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/26109002/1037001
7 years, 1 month ago (2013-11-19 08:31:38 UTC) #41
commit-bot: I haz the power
Presubmit check for 26109002-1037001 failed and returned exit status 1. Running presubmit commit checks ...
7 years, 1 month ago (2013-11-19 08:33:12 UTC) #42
iannucci
> > ** Presubmit ERRORS ** > tests/git_number_test.py failed > ERROR: python-coverage (3.7) is required ...
7 years, 1 month ago (2013-11-19 08:34:08 UTC) #43
M-A Ruel
On 2013/11/18 05:54:37, iannucci wrote: > On 2013/11/18 05:50:29, iannucci wrote: > > Aaand... that's ...
7 years, 1 month ago (2013-11-19 14:06:01 UTC) #44
iannucci
On 2013/11/19 14:06:01, M-A Ruel wrote: > On 2013/11/18 05:54:37, iannucci wrote: > > On ...
7 years, 1 month ago (2013-11-19 18:24:02 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/iannucci@chromium.org/26109002/1037001
7 years, 1 month ago (2013-11-19 19:58:04 UTC) #46
commit-bot: I haz the power
7 years, 1 month ago (2013-11-19 20:01:01 UTC) #47
Message was sent while issue was closed.
Change committed as 236035

Powered by Google App Engine
This is Rietveld 408576698