Visual Studio / git / Cygwin workflow question

196 views
Skip to first unread message

ahendr...@chromium.org

unread,
Nov 5, 2010, 2:02:39 PM11/5/10
to Chromium-dev
Is anyone else using the combination of Visual Studio, git and Cygwin
to work on Chrome?

If so:

- What is your workflow like?
- How well does it work for you? Are you ever stalled?
- How are you set up? Specifically,
- Source code: Do you have multiple directories checked out, and
switch between them? What are the gotchas? How do you sync between
them?
- Git: Do branches that track other branches?
- Visual Studio: Do you have multiple copies running at once? Do
you use Visual Assist X, or any other Add-Ins?
- Etc.
- What problems do you run into using Cygwin, git and Windows
(especially 7)?

Here are some of the issues I run into (I'm using Windows 7):

- I basically only have one checkout directory that I normally use.
- If I don't unload the project in Visual Studio, sometimes git fails
when I try to switch branches. This causes a slowdown.
- Updating the depot_tools directory can only be done from a CMD
window, not Cygwin.

I'd also like to be able to work on another branch while the first is
building. I guess the way to do that is have multiple copies of
Visual Studio open to projects in different directories. Does that
mean I should have a different directory for each branch? If so, what
is the advantage of using git?

Thanks in advance,

Andy

Sam Kerner

unread,
Nov 5, 2010, 3:17:08 PM11/5/10
to ahendr...@chromium.org, Chromium-dev
On Fri, Nov 5, 2010 at 2:02 PM, ahendr...@chromium.org
<ahendr...@chromium.org> wrote:
> Is anyone else using the combination of Visual Studio, git and Cygwin
> to work on Chrome?
>
> If so:
>
> - What is your workflow like?
> - How well does it work for you?  Are you ever stalled?

I use git on windows because it works well for me on mac and linux.
I tried using git as I do on other platforms, switching between
branches while waiting on code reviews. This didn't work so well.
Switching branches often means having to rerun gclient sync, restart
visual studo, wait half an hour for a rebuild, and have visual studio
freeze when you right click on code because its code index is not up
to date. If you walk by my desk, and see a one button mouse plugged
in to my windows box, you know I just ran git pull --rebase && gclient
sync . It is easy to loose half a day switching branches with VS.

I don't want to go back to subversion, because I like being able to
commit parts of a change locally. So I use git on windows for at most
one change at a time. When I am waiting on a review, I usually work
on a mac or linux change. Multiple platforms are the way I manage to
avoid stalling.

> - How are you set up?  Specifically,
>  - Source code: Do you have multiple directories checked out, and
> switch between them?  What are the gotchas?  How do you sync between
> them?

I have a bare git repo set up on my linux box. I use it to push
changes from clients on all three platforms, and pull to another
platform. I tried pulling and pushing directly from one client to
another, but it got too confusing. I always commit from linux.

>  - Git: Do branches that track other branches?

I only track origin/trunk.

>  - Visual Studio: Do you have multiple copies running at once?

Is that possible? Restarting visual studio and waiting for the
rebuild it always decides it needs is too slow to be useful in
practice.

> Do you use Visual Assist X, or any other Add-Ins?

Never heard of them.

>  - Etc.
> - What problems do you run into using Cygwin, git and Windows
> (especially 7)?

Like anything that involves disk IO in cygwin, gclient is very very
slow. Syncing used to take 6 hours before I discovered 'gclient
-j10'. I got in the habit of start it before I go home at night.

Sometimes cygwin windows freeze. No idea why. My .bashrc cds into
git/src, so that killing a cygwin window and opening another requires
no typing.

Killing a command will often leave a cygwin hosted shell in a strange
state. I reflexively run 'stty sane' after control-c.

>
> Here are some of the issues I run into (I'm using Windows 7):
>
> - I basically only have one checkout directory that I normally use.
> - If I don't unload the project in Visual Studio, sometimes git fails
> when I try to switch branches.  This causes a slowdown.
> - Updating the depot_tools directory can only be done from a CMD
> window, not Cygwin.
>
> I'd also like to be able to work on another branch while the first is
> building.  I guess the way to do that is have multiple copies of
> Visual Studio open to projects in different directories.  Does that
> mean I should have a different directory for each branch?  If so, what
> is the advantage of using git?
>
> Thanks in advance,
>
> Andy
>

> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
>    http://groups.google.com/a/chromium.org/group/chromium-dev
>

Dirk Pranke

unread,
Nov 5, 2010, 5:35:17 PM11/5/10
to ahendr...@chromium.org, Chromium-dev
On Fri, Nov 5, 2010 at 11:02 AM, ahendr...@chromium.org
<ahendr...@chromium.org> wrote:
> Is anyone else using the combination of Visual Studio, git and Cygwin
> to work on Chrome?

Yes. My configuration is similar to Sam's, it sounds like.

>
> If so:
>
> - What is your workflow like?

I do most of my work on a Mac, so this may or may not be helpful.

> - How well does it work for you?  Are you ever stalled?

Having 4+ x 3 machines checkouts requires a lot of compiling, so, yes ...

> - How are you set up?  Specifically,
>  - Source code: Do you have multiple directories checked out, and
> switch between them?  What are the gotchas?  How do you sync between
> them?

Typically I have things set up so that I pull from chromium.org (and
webkit.org) onto my Mac, and then on my win and linux boxes I pull
from my mac. I usually have dual chrome/webkit checkouts, and I use
git-new-workdir to have one full checkout per branch, with usually
four checkouts total (tip of tree webkit, tip of tree chrome, and a
webkit working branch and a chrome working branch).

I try to be careful to never check out the same branch in multiple
checkouts, because that will cause horrible things to happen.

>  - Git: Do branches that track other branches?

I have just started playing around with tracking branches, so I can't
really give any feedback here.

>  - Visual Studio: Do you have multiple copies running at once?  Do
> you use Visual Assist X, or any other Add-Ins?

No. I actually do most of my editing in Vim, but that's because most
of my work these days is in Python. I don't use any add-ins.

>  - Etc.

> - What problems do you run into using Cygwin, git and Windows
> (especially 7)?

cygwin is definitely slower than native windows.

>
> Here are some of the issues I run into (I'm using Windows 7):
>
> - I basically only have one checkout directory that I normally use.
> - If I don't unload the project in Visual Studio, sometimes git fails
> when I try to switch branches.  This causes a slowdown.

This can be an issue, and of course visual studio will want to reload
the solutions anyway, which is annoying.

> - Updating the depot_tools directory can only be done from a CMD
> window, not Cygwin.
>

Haven't had this problem, but my depot_tools directory has so far
always been a straight svn checkout (not using git for it).

> I'd also like to be able to work on another branch while the first is
> building.  I guess the way to do that is have multiple copies of
> Visual Studio open to projects in different directories.  Does that
> mean I should have a different directory for each branch?  If so, what
> is the advantage of using git?
>

As above, you definitely need should not have the same branch in two
directories if you try to use git new-work-dir. Git new-work-dir will
keep a single repository for the machine though. The main advantages
of using git remain: merging is really really easy, and you can do
local commits.

-- Dirk

Scott Hess

unread,
Nov 5, 2010, 6:06:54 PM11/5/10
to ske...@google.com, ahendr...@chromium.org, Chromium-dev
On Fri, Nov 5, 2010 at 12:17 PM, Sam Kerner <ske...@google.com> wrote:
> On Fri, Nov 5, 2010 at 2:02 PM, ahendr...@chromium.org
> <ahendr...@chromium.org> wrote:
>> - How are you set up?  Specifically,
>>  - Source code: Do you have multiple directories checked out, and
>> switch between them?  What are the gotchas?  How do you sync between
>> them?
>
>   I have a bare git repo set up on my linux box.  I use it to push
> changes from clients on all three platforms, and pull to another
> platform.  I tried pulling and pushing directly from one client to
> another, but it got too confusing.  I always commit from linux.

In the real world, one flow used to collaborate between developers is
for each developer to have private and public git repos. You pull
from the other developer's public repo to your private repo, and push
from your private repo to your public repo. This works alright for
me, changes loop around with conflicts always handled as part of a
pull (since the push is a mirror, it always works). I usually do
prefetches from the main chromium repo so that I don't have to pull a
few weeks of changes down my DSL link and then push them back up to
some other repo.

-scott

Matt Perry

unread,
Nov 5, 2010, 6:10:41 PM11/5/10
to ahendr...@chromium.org, Chromium-dev
On Fri, Nov 5, 2010 at 11:02 AM, ahendr...@chromium.org <ahendr...@chromium.org> wrote:
Is anyone else using the combination of Visual Studio, git and Cygwin
to work on Chrome?

I am. I actually do successfully switch between branches and work on multiple different CLs at once (or single changes that span multiple CLs), so maybe my setup will be useful to you. I use 2 main tricks that make life less painful than the "obvious" git workflow.


Trick 1: use a separate machine (or at least a separate checkout) as commit queue.

My configuration:
- Windows box with Cygwin and git. Single checkout. This is my main dev machine.
- Linux box with git. Single checkout. This is my commit-queue machine (and dev machine for linux-specific work). I send all my reviews and commit the final result from this machine.

Workflow:
- When I start a new CL, I check out a fresh branch on my windows box based on the origin:
     win> git checkout -b newChange origin
- I work on it for a while, committing as I go. When I'm ready to send for review, I log in to my linux box and grab the CL into a clean branch there, and send it up:
     linux> git checkout -b newChange origin
     linux> git pull win newChange
     linux> git fetch && git merge origin; # I avoid rebasing, merging seems to handle merges better for me
     linux> git cl upload
     linux> git try
- Now I have to wait for review, so I can start a new CL on my windows box:
     win> git checkout -b change2 origin; # (can also base it off newChange if it's a single change broken into many CLs)

The advantage of using a separate machine as a commit queue is that I can switch between branches on the commit-queue without worrying about updating filestamps and having to rebuild on my dev machine. I have to switch branches much more often when sending things up for review and/or committing. (You could also accomplish the same with a separate checkout on the same machine, but this has the additional advantage that I can test that it builds on linux too.)


Trick 2: Switching branches on the dev machine.

Switching branches on the dev machine is tricky. You want to avoid running gclient sync as much as possible. You also want to avoid switching to a really old branch, since it'll touch a ton of files that you'll have to rebuild. To illustrate my point, consider this workflow:
    git fetch && git merge origin
    git checkout -b foo origin
    ... commit a bunch of changes.
    git checkout bar;  # BAD NEWS
That last command is bad because branch "bar" hasn't been updated against the new origin yet. It could be many days old, in which case you have to merge to origin and possibly run gclient sync again, and a ton of files will be touched and have to be rebuilt. To avoid that, create a new branch based on origin and just merge in bar's changes:
    git branch -m bar barOLD
    git checkout -b bar origin
    git merge barOLD
    git branch -D bar
Now just the files that actually differ between branches "foo" and "bar" will be touched, and there will be much less rebuilding. I've set up a git alias to do this. From my .gitconfig:
[alias]
    branchswitch = !sh -c 'git br -m $1 "$1"0 && git co -b $1 `git base` && git merge "$1"0 && git br -D "$1"0' -
    br = branch
    co = checkout

Scott Byer

unread,
Nov 8, 2010, 2:49:40 PM11/8/10
to ahendr...@chromium.org, Chromium-dev
I do.  I'm a branching fiend - disk space is cheap, and I find that pipelining patches across multiple branches can really help hide the huge overhead of carefully landing a patch.

My work flow consists of having one trunk working directory, making it easy to pull trunk without having to deal with being off in branches, then I have a few working directories (git-new-workdir) mostly based off of trunk (and set to tracking it), sometimes two levels down if need be.  The big gotcha is remembering the shared stash, but I find the overall workflow easier than doing full clones for working directories.

To make a new workdir (which I don't do too often - once a patch is landed, I typically recycle the working dir where I developed that patch), I use git-new-workdir, copy over the .gclient file, and get a gclient sync going.

When I want to pull down from trunk, I also rebase my other 'active' working directories up to trunk at that point (being careful about the shared stash).  I find that doing all the git stuff in batches like that helps things go faster, keeping more of the essentially shared .git directory in the I/O cache.

I often run two VSes at once - typically if I'm trying to decide if I introduced something, one compiling and running trunk, one in a patch working dir.  I don't ever have both building at once.  VS isn't good at that.  I try and strip VS down (I can't get IS to turn off completely anymore :-( ), as I don't use it as an editor - I've always found it's editor painful.  I use Emacs for that.  I have a VB macro that copies the compile output and sends it to Emacs for easy compile error fixing (though I really want to re-write it in Python.  I have a Perl version hanging around somewhere that works, but really, I'm trying to go cold turkey on the Perl these days).

I don't have many problems.  I use bash shells from within Emacs (ok, ok, no good job control on Windows in that case), I can update depot_tools from there, no problem.  The only thing I end up having to go out to a naked bash shell for is using git cl (I mean to try and figure out a fix for that when I get a less busy day).  I try and fix bigger depot_tools issues with cygwin when I hit them.

-Scott

On Fri, Nov 5, 2010 at 11:02 AM, ahendr...@chromium.org <ahendr...@chromium.org> wrote:

Evan Martin

unread,
Nov 8, 2010, 2:58:25 PM11/8/10
to scot...@chromium.org, ahendr...@chromium.org, Chromium-dev
On Mon, Nov 8, 2010 at 11:49 AM, Scott Byer <scot...@chromium.org> wrote:
> I often run two VSes at once - typically if I'm trying to decide if I
> introduced something, one compiling and running trunk, one in a patch
> working dir.  I don't ever have both building at once.  VS isn't good at
> that.  I try and strip VS down (I can't get IS to turn off completely
> anymore :-( ), as I don't use it as an editor - I've always found it's
> editor painful.  I use Emacs for that.  I have a VB macro that copies the
> compile output and sends it to Emacs for easy compile error fixing (though I
> really want to re-write it in Python.  I have a Perl version hanging around
> somewhere that works, but really, I'm trying to go cold turkey on the Perl
> these days).

Out of curiosity, have you tried running builds from the command line?

Scott Byer

unread,
Nov 8, 2010, 4:28:29 PM11/8/10
to Evan Martin, ahendr...@chromium.org, Chromium-dev
Not yet, I need to.  I've done it in the past - usually by putting together a veneer Makefile.  But I'd probably still hop into VS for debugging.  It's not too bad for that.

-Scott

Evan Martin

unread,
Nov 8, 2010, 4:55:17 PM11/8/10
to scot...@chromium.org, ahendr...@chromium.org, Chromium-dev
I've linked to (and wrote a one-sentence summary of) this thread to a
"Windows > Workflow" section of wiki:
http://code.google.com/p/chromium/wiki/UsingGit#Workflow

It would not hurt my feelings -- no, it would *please* me -- if you
replaced my text with anything more helpful.

Dirk Pranke

unread,
Nov 8, 2010, 5:04:16 PM11/8/10
to ev...@chromium.org, scot...@chromium.org, ahendr...@chromium.org, Chromium-dev
On Mon, Nov 8, 2010 at 11:58 AM, Evan Martin <ev...@chromium.org> wrote:

I do builds from the command line (invoking devenv from cygwin), but
never multiple at once.

-- Dirk

Reply all
Reply to author
Forward
0 new messages