[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [sage-devel] Re: git and gerrit Christopher Swenson Tue Feb 21 08:00:50 2012


I forwarded this thread to Shawn Pearce, the primary author of gerrit, and
have included his response below.


---------- Forwarded message ----------
From: Shawn Pearce <[EMAIL PROTECTED]>
Date: Tue, Feb 21, 2012 at 15:16
Subject: Re: [sage-devel] Re: git and gerrit
To: Christopher Swenson <[EMAIL PROTECTED]>
Cc: Christopher Swenson <[EMAIL PROTECTED]>

Inline below, feel free to forward this.

> ---------- Forwarded message ----------
> From: Jason Grout <[EMAIL PROTECTED]>
> Date: Thu, Feb 16, 2012 at 09:19
> Subject: [sage-devel] Re: git and gerrit
> However, if I have a "topic" I'd like to commit, and all the commits
> should be reviewed as a package together, or if I'm collaborating with
> others on a branch, then it is incredibly convenient to look at patchsets
> a topic-branch level (ala github) rather than the individual commit level,
> like gerrit seems to be insisting.

Currently the topic branch author can include a topic name when
pushing their changes to Gerrit, e.g. "git push review
work:refs/for/master/my-topic" will upload the changes for the master
branch, with the topic label of my-topic. Reviews can click on the
"my-topic" label, or use a search query like "status:open
topic:my-topic" to find open changes with this label and review them.

Kitware has been working on topic branch support, where a topic branch
is a more fundamental concept in Gerrit that can be reviewed and
submitted as a unit. Unfortunately this work is still in progress and
has not made it to a release version yet.

>  It seems that the only way to get a
> topic-level view of things in gerrit is to insist that you squash all the
> commits into one commit, which is usually bad, in my opinion.

If the commits are going to be preserved in history, they should be
reviewed individually to ensure each commit is consistent on its own.
If it isn't, it shouldn't be in the history, and should therefore be
squashed together with something else, or removed altogether.
Reviewing the topic branch as a diff of its tip commit against the
common ancestor doesn't really provide a way to review each commit. So
it hasn't really been supported by Gerrit.

If you really need the overall diff in order to get a sense of what
the change is, you can fetch the tip commit from Gerrit and then run
`git diff` on your workstation to glance over the entire diff. Yes you
lose the ability to comment on individual chunks of code. But we (the
Gerrit community) stand behind the notion that if a commit is
worthwhile to keep forever as part of the project history, then it is
worthwhile to review on its own, and it must stand on its own to
justify being included in the project. Thus, this topic branch overall
diff isn't as useful as it sounds.

> It is nice that gerrit preserves the history of each individual commit
> is reviewed.  Can this history be pushed or mirrored somewhere else (e.g.,
> can I clone the gerrit repository and get these fake ref/for/master
> branches?)

Yes. Each change is given its own refs/changes/... branch name in the
Gerrit repository. These can be mirrored elsewhere using stock Git
tools, or the replication feature that is built into Gerrit. Users can
see what branch name was assigned by looking at a patch set on the
change page in the web UI. For each patch set Gerrit generates a
number of Git commands that can be used to fetch the change using this
unique branch name, and then perform common actions against it (e.g.
checkout, pull, cherry-pick, diff).

To post to this group, send an email to [EMAIL PROTECTED]
To unsubscribe from this group, send an email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org