You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Freek Dijkstra <pu...@macfreek.nl> on 2007/07/13 13:32:53 UTC

merge two local working copies

Hi,

I find myself doing to following a lot:
1. Check out a repository, make changes at work
2. Manually see what I changed, and copy those to my home computer
3. Go home
4. Continue editing at home
5. Do a commit

So I do not commit at step 2, and update at home. That would of course
be a lot easier for me! The reason I do so clumsy is because my
yet-unfinished change would break stuff of a few colleagues.

Is there a smarter way to do this, than to manually do a diff -r --brief
and copy the changed files between my two local computers? I looked at
svn merge, but that only seems to be able to merge changes between two
revision to a local working copy. What I want is to merge the difference
between HEAD and whatever I had at the working copy at work to the
working copy at home.

Regards,
Freek

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 13, 2007, at 08:32, Freek Dijkstra wrote:

> I find myself doing to following a lot:
> 1. Check out a repository, make changes at work
> 2. Manually see what I changed, and copy those to my home computer
> 3. Go home
> 4. Continue editing at home
> 5. Do a commit
>
> So I do not commit at step 2, and update at home. That would of course
> be a lot easier for me! The reason I do so clumsy is because my
> yet-unfinished change would break stuff of a few colleagues.
>
> Is there a smarter way to do this, than to manually do a diff -r -- 
> brief
> and copy the changed files between my two local computers? I looked at
> svn merge, but that only seems to be able to merge changes between two
> revision to a local working copy. What I want is to merge the  
> difference
> between HEAD and whatever I had at the working copy at work to the
> working copy at home.

Everybody else has suggested you commit your changes to a temporary  
branch. But the first thing that popped into my head was: just take  
the working copy home. Copy your working copy from work onto a USB  
stick or iPod or laptop, bring it home, continue working, commit when  
you're ready.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Freek Dijkstra <pu...@macfreek.nl>.
Just a big thanks for all the suggestions!

Freek

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Karl Fogel <kf...@red-bean.com>.
Eric Hanchrow <of...@blarg.net> writes:
> You know, that's true, but I've done it a couple of times and wound up
> _very_ confused.  I can't remember why.  I dimly recall Ben
> Collins-Sussman (one of the developers) agreeing that it's a bad idea.

I recommend you first copy your working copy BASE revisions to a
branch, switch to the branch, and commit them.  That way you get
something that's much easier to diff (the other way, it's still
possible to get a diff of your changes, but it takes more work,
because you don't have a clean changeset to work with).

So:

   $ svn cp -rBASE -m "Create experiment branch." . http://.../branches/blah/
   $ svn switch http://.../branches/blah/
   $ svn st -q
    [... make sure your local changes are still there ...]
   $ svn ci -m "My experimental changes."

I haven't tested that, but it should work.

-Karl

-- 
Subversion support & consulting  <>  http://producingoss.com/consulting.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Eric Hanchrow <of...@blarg.net>.
>>>>> "Troy" == Troy Curtis <tr...@gmail.com> writes:

    Troy> And easier way to do this (and still make sure you don't
    Troy> pick up any changes from trunk that you don't want yet) is
    Troy> to simply copy your working copy straight into the task
    Troy> branch.  

You know, that's true, but I've done it a couple of times and wound up
_very_ confused.  I can't remember why.  I dimly recall Ben
Collins-Sussman (one of the developers) agreeing that it's a bad idea.

-- 
I write [from 5 AM to 7 AM] to discover what I think.  After
all, the bars aren't open that early.
        -- Daniel Boorstin, former Librarian of Congress

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Troy Curtis Jr <tr...@gmail.com>.
On 7/13/07, Eric Hanchrow <of...@blarg.net> wrote:
> >>>>> "Jason" == Jason Winnebeck <jp...@rit.edu> writes:
>
>     Jason> What I don't know is the ideal commands if modifications
>     Jason> are already made
>
> If I'm understanding you correctly, your situation looks like this:
>
> * you check out a wc
>
> * hack hack hack
>
> * time to go home
>
> * "Boy I wish there were an easy way to get these uncommitted changes
>   to my home machine ... but since I'm hacking on the trunk, not a
>   branch, I'm screwed".
>
> At this point, you can make a branch anyway!  Just figure out what the
> "base" revision is of your wc -- that is, the revision that you
> checked out:
>
>     $ svn info | egrep ^Revision
>     Revision: 1234
>
> Now make an after-the-fact branch _of that revision_:
>
>     $ svn cp -r1234 svn://server/repos/path/to/trunk
>     svn://server/repos/path/to/branches/private-at-home-hacking-branch
>
> Switch your wc to it:
>
>     $ svn switch
>     svn://server/repos/path/to/branches/private-at-home-hacking-branch .
>
> You will _not_ get any conflicts.
>
> Commit, go home, check out that branch, and continue hacking.
>
> --
> Rarely do we find men who willingly engage in hard, solid
> thinking.  There is an almost universal quest for easy answers
> and half-baked solutions.  Nothing pains some people more
> than having to think.
>         -- Martin Luther King, Jr.
>         from "Strength to Love," 1963.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

And easier way to do this (and still make sure you don't pick up any
changes from trunk that you don't want yet) is to simply copy your
working copy straight into the task branch.  Using Erics naming
conventions:

svn cp . svn://server/repos/path/to/branches/private-at-home-hacking-branch

I also presume that you won't actually need to switch your working
copy at work...just merge into it when you get back the next day.  Any
changes you made before will merge cleanly because they are the exact
same change.

Troy

-- 
"Beware of spyware. If you can, use the Firefox browser." - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: merge two local working copies

Posted by Eric Hanchrow <of...@blarg.net>.
>>>>> "Jason" == Jason Winnebeck <jp...@rit.edu> writes:

    Jason> What I don't know is the ideal commands if modifications
    Jason> are already made

If I'm understanding you correctly, your situation looks like this:

* you check out a wc

* hack hack hack

* time to go home

* "Boy I wish there were an easy way to get these uncommitted changes
  to my home machine ... but since I'm hacking on the trunk, not a
  branch, I'm screwed".

At this point, you can make a branch anyway!  Just figure out what the
"base" revision is of your wc -- that is, the revision that you
checked out:

    $ svn info | egrep ^Revision
    Revision: 1234

Now make an after-the-fact branch _of that revision_:

    $ svn cp -r1234 svn://server/repos/path/to/trunk
    svn://server/repos/path/to/branches/private-at-home-hacking-branch

Switch your wc to it:

    $ svn switch
    svn://server/repos/path/to/branches/private-at-home-hacking-branch .

You will _not_ get any conflicts.

Commit, go home, check out that branch, and continue hacking.

-- 
Rarely do we find men who willingly engage in hard, solid
thinking.  There is an almost universal quest for easy answers
and half-baked solutions.  Nothing pains some people more
than having to think.
        -- Martin Luther King, Jr.
        from "Strength to Love," 1963.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: merge two local working copies

Posted by Jason Winnebeck <jp...@rit.edu>.
What you could do is create a "private" branch where you check in
changes often and at will, then when you are ready you merge your
private branch back into the trunk, and then delete your private branch.
Branching in SVN has been made easy, and I believe one of the
motivations for this is to handle your specific case.

See http://svnbook.red-bean.com/nightly/en/svn.branchmerge.using.html

The problem with the book is that it assumes that you know what you need
before you need it. What I don't know is the ideal commands if
modifications are already made, as I'm still pretty new to SVN. I don't
know if you have to (or should) make a copy of trunk, then switch to it,
then commit, or if you can copy+modify at the same time (but I think if
you do that you'll have a hard time merging back to trunk?)

Does anyone know the ideal/easiest sequence of commands to take
modifications you've already started, then merge back? Is this the best
way?

svn cp http://example.com/svn/Project/trunk
http://example.com/svn/Project/branches/my-uber-branch
(remember revision number "X" here)
svn switch http://example.com/svn/Project/branches/my-uber-branch
svn commit (initial modifications)
... do more mods
svn switch http://example.com/svn/Project/trunk
svn merge from branch@X to branch@HEAD to WC
svn commit -m "Merged from my private uber branch"
svn rm http://example.com/svn/Project/branches/my-uber-branch

Jason

-----Original Message-----
From: Freek Dijkstra [mailto:public@macfreek.nl] 


Hi,

I find myself doing to following a lot:
1. Check out a repository, make changes at work
2. Manually see what I changed, and copy those to my home computer
3. Go home
4. Continue editing at home
5. Do a commit

So I do not commit at step 2, and update at home. That would of course
be a lot easier for me! The reason I do so clumsy is because my
yet-unfinished change would break stuff of a few colleagues.

Is there a smarter way to do this, than to manually do a diff -r --brief
and copy the changed files between my two local computers? I looked at
svn merge, but that only seems to be able to merge changes between two
revision to a local working copy. What I want is to merge the difference
between HEAD and whatever I had at the working copy at work to the
working copy at home.

Regards,
Freek

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: merge two local working copies

Posted by "Anne M. Hammond" <ha...@txcorp.com>.
Can you
Create a branch
Check in your changes at work to the branch
Go home, check out the branch
Continue to work in that branch
Then merge that branch into the trunk


Anne M. Hammond - Systems / Network Administration - Tech-X Corp
                   hammond_at_txcorp.com 720-974-1840

On Fri, 13 Jul 2007, Freek Dijkstra wrote:

> Hi,
>
> I find myself doing to following a lot:
> 1. Check out a repository, make changes at work
> 2. Manually see what I changed, and copy those to my home computer
> 3. Go home
> 4. Continue editing at home
> 5. Do a commit
>
> So I do not commit at step 2, and update at home. That would of course
> be a lot easier for me! The reason I do so clumsy is because my
> yet-unfinished change would break stuff of a few colleagues.
>
> Is there a smarter way to do this, than to manually do a diff -r --brief
> and copy the changed files between my two local computers? I looked at
> svn merge, but that only seems to be able to merge changes between two
> revision to a local working copy. What I want is to merge the difference
> between HEAD and whatever I had at the working copy at work to the
> working copy at home.
>
> Regards,
> Freek
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org