<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Futura Bk";
panose-1:2 11 5 2 2 2 4 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Futura Bk","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Yuriy,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It looks like this would automate a standard workflow that my group often uses: multiple commits, create “delivery”
branch, git merge --squash, git review. That looks really useful.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Having it be repeatable is a bonus.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Per last bullet of the implementation, I would not require not modifying current index/HEAD. A checkout back to
working branch can be done at the end, right?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="#1f497d" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Steve<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="3" color="#1f497d" face="Calibri"><span style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font size="2" face="Calibri"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
Yuriy Taraday [mailto:yorik.sar@gmail.com] <br>
<b><span style="font-weight:bold">Sent:</span></b> Monday, August 04, 2014 16:18<br>
<b><span style="font-weight:bold">To:</span></b> openstack-dev; openstack-infra<br>
<b><span style="font-weight:bold">Subject:</span></b> [OpenStack-Infra] [git-review] Supporting development in local branches<o:p></o:p></span></font></p>
</div>
</div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">Hello, git-review users!<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">I'd like to gather feedback on a feature I want to implement that might turn out useful for you.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">I like using Git for development. It allows me to keep track of current development process, it remembers everything I ever did with the code (and more).<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">I also really like using Gerrit for code review. It provides clean interfaces, forces clean histories (who needs to know that I changed one line of code in 3am on Monday?) and
allows productive collaboration.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">What I really hate is having to throw away my (local, precious for me) history for all change requests because I need to upload a change to Gerrit.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">That's why I want to propose making git-review to support the workflow that will make me happy. Imagine you could do smth like this:<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">0. create new local branch;<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">master: M--....</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">feature: *</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">1. start hacking, doing small local meaningful (to you) commits;<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">master: M--....</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">feature: A-B-...-C</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">2. since hacking takes tremendous amount of time (you're doing a Cool Feature (tm), nothing less) you need to update some code from master, so you're just merging master in
to your branch (i.e. using Git as you'd use it normally);<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
master: M--....-N-O-...</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \ \ \</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">feature: A-B-...-C-D-...</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">3. and now you get the first version that deserves to be seen by community, so you run 'git review', it asks you for desired commit message, and <poof, magic-magic> all changes
from your branch is uploaded to Gerrit as _one_ change request;<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
master: M--....-N-O-...</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \ \ \----E* <= uploaded</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">feature: A-B-...-C-D-...-E</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">4. you repeat steps 1 and 2 as much as you like;<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">5. and all consecutive calls to 'git review' will show you last commit message you used for upload and use it to upload new state of your local branch to Gerrit, as one change
request.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">Note that during this process git-review will never run rebase or merge operations. All such operations are done by user in local branch instead.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">Now, to the dirty implementations details.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">- Since suggested feature changes default behavior of git-review, it'll have to be explicitly turned on in config (review.shadow_branches? review.local_branches?). It should
also be implicitly disabled on master branch (or whatever is in .gitreview config).<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">- Last uploaded commit for branch <branch-name> will be kept in refs/review-branches/<branch-name>.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">- For every call of 'git review' it will find latest commit in gerrit/master (or remote and branch from .gitreview), create a new one that will have that commit as its parent
and a tree of current commit from local branch as its tree.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">- While creating new commit, it'll open an editor to fix commit message for that new commit taking it's initial contents from refs/review-branches/<branch-name> if it exists.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">- Creating this new commit might involve generating a temporary bare repo (maybe even with shared objects dir) to prevent changes to current index and HEAD while using bare
'git commit' to do most of the work instead of loads of plumbing commands.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">Note that such approach won't work for uploading multiple change request without some complex tweaks, but I imagine later we can improve it and support uploading several interdependent
change requests from several local branches. We can resolve dependencies between them by tracking latest merges (if branch myfeature-a has been merged to myfeature-b then change request from myfeature-b will depend on change request from myfeature-a):<o:p></o:p></span></font></p>
</div>
<div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><br>
master: M--....-N-O-...</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \ \ \---------E*</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">myfeature-a: A-B-...-C-D-...-E \</span></font><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""> \ \ J* <= uploaded</span></font><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New"">myfeature-b: F-...-G-I-J</span></font><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">This improvement would be implemented later if needed.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">I hope such feature seams to be useful not just for me and I'm looking forward to some comments on it.<o:p></o:p></span></font></p>
</div>
<div>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt"><o:p> </o:p></span></font></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">--
<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="2" face="Futura Bk"><span style="font-size:10.0pt">Kind regards, Yuriy.<o:p></o:p></span></font></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>