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

Issue 1652007: gclient_scm.py: Make working with git more reliable (Closed)

Created:
10 years, 8 months ago by jaysoffian
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

gclient_scm.py: Make working with git more reliable I found including a git repo in my DEPS file to be unreliable, esp since I pinning to a specific commit. Whenever I changed the commit in the DEPS file, gclient would attempt to do a rebase and this was failing due to how rebase was being invoked. While investigating the problem, I decided it might be better to take a different approach. Namely, when cloning gclient should just checkout the working tree to a detached HEAD. In this way, gclient can more easily determine if the user has made any changes in the cloned repo. Future updates (as long as there are no changes) become a much simpler operation w/no need to invoke rebase. This is a series of five commits, but sadly, git cl will squash them into this single review. Here are the original commit messages: commit 8cd2213f006a6f4b3f6b8c448a1362b9410d47f1 Author: Jay Soffian <jaysoffian@gmail.com>; Date: Wed Apr 14 18:29:18 2010 -0400 Use rev-parse to determine current branch Git branch is a so-called porcelain and its output cannot be relied upon; use git rev-parse instead. gclient_scm.py | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) commit 1a09e04554acfa2671f9588ee9eef0bdbe677ed2 Author: Jay Soffian <jaysoffian@gmail.com>; Date: Wed Apr 14 22:16:53 2010 -0400 Detached HEAD does not always imply rebasing; use an _IsRebasing() function instead. gclient_scm.py | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) commit 45308a58c3f1e30b760f13abe3a6288267265fa8 Author: Jay Soffian <jaysoffian@gmail.com>; Date: Wed Apr 14 22:19:10 2010 -0400 Clarify comments to use common git terminology gclient_scm.py | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) commit 5e5a661b7dd9c83b2c9c35950f3267d15b7e840a Author: Jay Soffian <jaysoffian@gmail.com>; Date: Tue May 4 12:15:40 2010 -0400 Make CaptureStatus use GetUpstreamBranch() instead of assuming 'origin' scm.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) commit 42a8bfebd2e1b1be01025c1324d75920ac6eb0e1 Author: Jay Soffian <jaysoffian@gmail.com>; Date: Wed Apr 14 22:19:29 2010 -0400 Use a detached HEAD when checking out a tag or commit After cloning, if a tag or commit was specified, leave a detached HEAD. This way we can reliably detect if the user changed the working tree (since HEAD would no longer be detached). Further, this simplifies the code path when the dependency is updated to a new tag/commit. As long as HEAD is detached when we update, we simply checkout whatever we fetched w/o needing to worry about rebasing. gclient_scm.py | 126 +++++++++++++++++++++++++++++++------------- tests/gclient_scm_test.py | 6 +-- 2 files changed, 91 insertions(+), 41 deletions(-) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=48722

Patch Set 1 #

Total comments: 4

Patch Set 2 : incorporated feedback to patch set 1 #

Patch Set 3 : Incorporated feedback and rebased against HEAD #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -54 lines) Patch
M gclient_scm.py View 1 2 7 chunks +110 lines, -49 lines 0 comments Download
M scm.py View 1 chunk +5 lines, -1 line 0 comments Download
M tests/gclient_scm_test.py View 1 chunk +2 lines, -4 lines 1 comment Download

Messages

Total messages: 24 (0 generated)
jaysoffian
10 years, 8 months ago (2010-04-15 02:53:44 UTC) #1
Nasser Grainawi
Changing the default to a detached HEAD is a big workflow change as people will ...
10 years, 8 months ago (2010-04-15 15:15:05 UTC) #2
jaysoffian
On 2010/04/15 15:15:05, Nasser Grainawi wrote: > Changing the default to a detached HEAD is ...
10 years, 8 months ago (2010-04-15 15:22:04 UTC) #3
M-A Ruel
I didn't review the code, adding Evan to do an actual control flow analysis. http://codereview.chromium.org/1652007/diff/1/2 ...
10 years, 8 months ago (2010-04-15 16:25:07 UTC) #4
Evan Martin
I guess whoever wrote the rebase stuff in gclient would be a better reviewer; I ...
10 years, 8 months ago (2010-04-15 16:29:26 UTC) #5
jaysoffian
On Thu, Apr 15, 2010 at 12:29 PM, <evan@chromium.org> wrote: > I guess whoever wrote ...
10 years, 8 months ago (2010-04-15 16:39:21 UTC) #6
Evan Martin
On 2010/04/15 16:39:21, jaysoffian wrote: > On Thu, Apr 15, 2010 at 12:29 PM, <mailto:evan@chromium.org> ...
10 years, 8 months ago (2010-04-15 16:56:47 UTC) #7
jaysoffian
Other than these two nits, I'm not sure whether anything else is desired based on ...
10 years, 8 months ago (2010-04-19 22:29:07 UTC) #8
Nasser Grainawi
lgtm, but msb should take a look since he did the original rebase code (I ...
10 years, 8 months ago (2010-04-20 20:59:37 UTC) #9
Mandeep Singh Baines
LGTM
10 years, 8 months ago (2010-04-20 23:57:50 UTC) #10
Nasser Grainawi
On 2010/04/19 22:29:07, jaysoffian wrote: > Other than these two nits, I'm not sure whether ...
10 years, 8 months ago (2010-04-26 22:42:33 UTC) #11
jaysoffian
- Fixed broken test - Investigated Nasser's existing tree sync failure but cannot reproduce - ...
10 years, 7 months ago (2010-05-05 02:27:13 UTC) #12
Mandeep Singh Baines
On 2010/05/05 02:27:13, jaysoffian wrote: > - Fixed broken test > - Investigated Nasser's existing ...
10 years, 7 months ago (2010-05-05 16:23:06 UTC) #13
jaysoffian
> > - I decided to only detach HEAD for DEPS that specific a tag/commit. ...
10 years, 7 months ago (2010-05-05 16:38:05 UTC) #14
msb
On Wed, May 5, 2010 at 9:38 AM, <jaysoffian@gmail.com> wrote: >> > - I decided ...
10 years, 7 months ago (2010-05-05 17:06:19 UTC) #15
piman
People on this list may want to take a look at an alternative (didn't know ...
10 years, 7 months ago (2010-05-10 23:28:34 UTC) #16
Nasser Grainawi
I've been testing this out for over a week and I think it's pretty solid. ...
10 years, 7 months ago (2010-05-28 15:51:08 UTC) #17
M-A Ruel
It didn't apply cleanly here so I couldn't try it. I can rubberstamp it but ...
10 years, 7 months ago (2010-05-28 15:55:50 UTC) #18
Nasser Grainawi
maruel@chromium.org wrote: > It didn't apply cleanly here so I couldn't try it. I can ...
10 years, 7 months ago (2010-05-28 17:21:26 UTC) #19
M-A Ruel
Le 28 mai 2010 13:21, Nasser Grainawi <nasser@codeaurora.org> a écrit : > maruel@chromium.org wrote: >> ...
10 years, 7 months ago (2010-05-28 17:24:23 UTC) #20
Nasser Grainawi
Marc-Antoine Ruel wrote: > Le 28 mai 2010 13:21, Nasser Grainawi <nasser@codeaurora.org> a écrit : ...
10 years, 7 months ago (2010-05-28 17:27:19 UTC) #21
M-A Ruel
fake_repos.py, line 177 probably failed. Le 28 mai 2010 13:27, Nasser Grainawi <nasser@codeaurora.org> a écrit ...
10 years, 7 months ago (2010-05-28 17:30:01 UTC) #22
Mandeep Singh Baines
Rebased and tested this change. I get 5 failures for gclient_smoketest.py. We'll need to fix ...
10 years, 6 months ago (2010-06-02 04:30:18 UTC) #23
M-A Ruel
10 years, 6 months ago (2010-06-02 10:53:31 UTC) #24
On 2010/06/02 04:30:18, Mandeep Singh Baines wrote:
> Rebased and tested this change. I get 5 failures for gclient_smoketest.py.
We'll
> need to fix these before we can commit.
> 
> A few of the errors are of this variety:
> 
> self.assertEquals(13, len(out))
> 
> So these aren't really errors. Just the output text has changed.

Yes you can commit, I need to improve this part. I'm thinking about using a
regexp to split blocks of lines and count the number of blocks. I may need to
disable the % remaining status line to get more consistent results.

Powered by Google App Engine
This is Rietveld 408576698