You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Thomas Hruska <th...@cubiclesoft.com> on 2006/07/19 23:58:08 UTC

SVNCopy - move/copy/sync WCs...

A couple days ago I proposed a feature enhancement to TortoiseSVN and 
was initially rejected outright.  Put simply, this moves/copies/syncs a 
WC very quickly between a PC and a laptop over a network without 
incurring a version increase on the central repository.  I developed the 
following (free) tool called SVNCopy that accomplishes that purpose:

http://www.cubiclesoft.com/Unrelated/SVNCopy.zip

It apparently works well enough that TSVN developers recommended that I 
forward my request to this list because it does some version-dependent 
things to achieve its overall performance.  The program itself has 
_default_ dependencies on TortoiseMerge, XCOPY, and the NT series of 
Windows (NT/2000/XP), but please just recognize this as a 
proof-of-concept tool and not a set of requirements.

This tool allows me to copy just the files of a large WC to my laptop in 
3 seconds or less from my PC - including all changes.  Then I can take 
this anywhere - a meeting, lunch, outside, a business trip, etc.  When I 
return, I use SVNCopy again to copy the WC back to the PC from the 
laptop - again only taking a couple seconds.  Neither of these 
operations consumes a revision.

If someone accidentally edits both WCs, SVNCopy attempts to merge/sync 
the two WCs before performing the main operation.  Essentially, it is 
unlikely to fail in even accidental editing scenarios.

I'm willing to share my source code if this is a feature you guys are 
interested in developing into an API that will be able to trickle down 
to TSVN.  A couple of commercial companies that I've approached that use 
TSVN are quite interested in SVNCopy and a number of developers are 
already using it.  Essentially, SVNCopy makes it possible to create 
"mobile WCs".

Given that this is just a proof-of-concept tool and is already 
moderately popular, I would love to see something similar show up in 
Subversion and ultimately TortoiseSVN as an official feature.

--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

Safe C++ Design Principles (First Edition)
Learn how to write memory leak-free, secure,
portable, and user-friendly software.

Learn more and view a sample chapter:
http://www.CubicleSoft.com/SafeCPPDesign/

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

Re: SVNCopy - move/copy/sync WCs...

Posted by Thomas Hruska <th...@cubiclesoft.com>.
David James wrote:
> On 7/19/06, Thomas Hruska <th...@cubiclesoft.com> wrote:
>> This tool allows me to copy just the files of a large WC to my laptop in
>> 3 seconds or less from my PC - including all changes.  Then I can take
>> this anywhere - a meeting, lunch, outside, a business trip, etc.  When I
>> return, I use SVNCopy again to copy the WC back to the PC from the
>> laptop - again only taking a couple seconds.  Neither of these
>> operations consumes a revision.
>>
>> If someone accidentally edits both WCs, SVNCopy attempts to merge/sync
>> the two WCs before performing the main operation.  Essentially, it is
>> unlikely to fail in even accidental editing scenarios.
>>
>> I'm willing to share my source code if this is a feature you guys are
>> interested in developing into an API that will be able to trickle down
>> to TSVN.  A couple of commercial companies that I've approached that use
>> TSVN are quite interested in SVNCopy and a number of developers are
>> already using it.  Essentially, SVNCopy makes it possible to create
>> "mobile WCs".
>>
>> Given that this is just a proof-of-concept tool and is already
>> moderately popular, I would love to see something similar show up in
>> Subversion and ultimately TortoiseSVN as an official feature.
> 
> Thomas,
> 
> This sounds like a very useful tool! How does it work?
> 
> Do you sync the raw files only, or do you also sync the working copy
> metadata (i.e. the files in the .svn metadirs)? How do you identify
> which files are modified in the WC, and in the .svn dirs? For files
> which are identified as modified, do you simply copy them over, or do
> you do block-by-block synchronization ala rsync?
> 
> You mentioned that your tool supports automatic merging of WCs that
> are edited on both machines. How do you deal with the case where the
> same file is modified on both machines?
> 
> Cheers,
> 
> David

The readme.txt file describes most of the process and the program 
describes what it is doing as it does it.

The first version of SVNCopy did a 'svn revert' on the destination and 
then 'svn stat' on the source.  Then each .svn directory that had 
changes (according to 'svn stat') was 'xcopy'ed from the source to the 
destination along with a straight copy from source to destination.  What 
makes this really fast is I skip copying the 'text-base' directory and 
make the assumption that the source and destination are the same 
revision.  Essentially, only the actual changes to the WC are copied.

Several people told me that the first version was a "dangerous" tool 
should someone forget to move the WC back to the PC from the laptop. 
So, for the second version, I 'svn revert' the source once all 
operations are done and verified.  This allows the program to detect 
changes to the original source when the WC is moved back to the PC. 
Changes are classified into different groups.  If the same file is 
modified on both computers, TortoiseMerge (by default - see SVNMerge.txt 
for configuring the diff/merge tool) is started up to resolve any 
differences between the text-base and the files on the two computers. 
All changes are saved to the source WC.  Changes in this part of the 
code don't actually touch the .svn directories.   I make calls to 'svn 
add' and 'svn delete' to let Subversion handle the necessary 
modifications.  After adding these modifications, several people got 
quite interested and excited in the prospect of a "mobile WC".

As I said, I'm willing to share the source code.  As such, I've attached 
the source to this e-mail.  The devs on the list will quickly tell that 
this isn't the entire source code (i.e. it won't compile) but the basic 
gist of its operation should be readily understandable (it is only 350 
lines of code with sufficient comments - and I'm available to explain 
anything).  The important thing is that most of the operations are 
already done by Subversion itself (revert, stat, add, delete).  The only 
point of contention is the direct manipulation of the .svn directories. 
  It doesn't touch 'entries' at all (although I had thought about doing 
that until I found 'svn stat').  Note that this is just a 
proof-of-concept program - I may have missed something important but it 
seems to work fine for Subversion v1.3.x for the various people using it 
but I've heard that v1.4 changes the way .svn directories work, which 
means SVNCopy might break a WC or the program might simply not work at 
all or the changes aren't relevant and SVNCopy would continue working 
fine.  However, it would be best if this were an actual API/command in 
Subversion itself.  The concept of a "mobile WC" is what will get me out 
from in front my computer indoors to my laptop outdoors.  However, I see 
the potential for tons of different uses for mobile WCs.

(BTW, I don't seem to be receiving mail from this list.  If you send me 
questions, be sure to CC me on it so that it will get to my in-box.)

--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

Safe C++ Design Principles (First Edition)
Learn how to write memory leak-free, secure,
portable, and user-friendly software.

Learn more and view a sample chapter:
http://www.CubicleSoft.com/SafeCPPDesign/

Re: SVNCopy - move/copy/sync WCs...

Posted by David James <dj...@collab.net>.
On 7/19/06, Thomas Hruska <th...@cubiclesoft.com> wrote:
> This tool allows me to copy just the files of a large WC to my laptop in
> 3 seconds or less from my PC - including all changes.  Then I can take
> this anywhere - a meeting, lunch, outside, a business trip, etc.  When I
> return, I use SVNCopy again to copy the WC back to the PC from the
> laptop - again only taking a couple seconds.  Neither of these
> operations consumes a revision.
>
> If someone accidentally edits both WCs, SVNCopy attempts to merge/sync
> the two WCs before performing the main operation.  Essentially, it is
> unlikely to fail in even accidental editing scenarios.
>
> I'm willing to share my source code if this is a feature you guys are
> interested in developing into an API that will be able to trickle down
> to TSVN.  A couple of commercial companies that I've approached that use
> TSVN are quite interested in SVNCopy and a number of developers are
> already using it.  Essentially, SVNCopy makes it possible to create
> "mobile WCs".
>
> Given that this is just a proof-of-concept tool and is already
> moderately popular, I would love to see something similar show up in
> Subversion and ultimately TortoiseSVN as an official feature.

Thomas,

This sounds like a very useful tool! How does it work?

Do you sync the raw files only, or do you also sync the working copy
metadata (i.e. the files in the .svn metadirs)? How do you identify
which files are modified in the WC, and in the .svn dirs? For files
which are identified as modified, do you simply copy them over, or do
you do block-by-block synchronization ala rsync?

You mentioned that your tool supports automatic merging of WCs that
are edited on both machines. How do you deal with the case where the
same file is modified on both machines?

Cheers,

David

-- 
David James -- http://www.cs.toronto.edu/~james

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