On 06/27/2011 10:08 AM, Mathias Bauer wrote:
On 25.06.2011 14:05, Jens-Heiner Rechtien wrote:
Hi Mathias,

On 06/23/2011 07:15 PM, Mathias Bauer wrote:
Hi,

I'm no svn expert, but I hope to find some here.

We still have a lot of work in so called child workspaces (in Mercurial
they are just an own repository that originates from the "main"
repository). When I thought about possible ways to move them to the
Apache repository, I had the idea that doing this as a patch might be
the easiest way:

- it's trivial to create a patch of a CWS containing all changes
- the patch does not have any copyright problems as all changes in it
are done by Oracle employees or by other developers under SCA
- changes on problematic files will just not apply if the file is not in
the basic svn repo of OOo

Sounds like a good idea, doesn't it?

But now I recognized that this idea was based on the wonderful feature
that the "git extended" diff format offers. It allows to have file
removal, addition or renaming (that includes moves in the tree) or file
attribute changes in the diff and by using "hg patch" (and not the patch
command of the OS) all these changes apply nicely in the target
repository.

I didn't find a support for this in svn, but maybe there is something
similar or comparable we could use.

Simply use "git apply". This tool applies git style patches to a working
directory which explicitly doesn't need to be a git repository as long
the --index option is not used. Nice tool, lots of possibility to fix
whitespace etc on the fly.
But that doesn't solve the problem that you have to add/remove files in
svn manually after using git apply, right? For some CWS this is the most
tedious part (refactoring, gbuildifying etc.).

Maybe using

svn status | grep '?' | sed 's/^.* /svn add /'

or so and something similar for "svn remove" should work, but perhaps
there's something built into svn that makes it easier?!

Adding is easy because it works recursive. Deleting is a bit more work. The real PITA is renaming ...

I would use the "git apply --summary" feature on a patch to get all the added, renamed and deleted files. A bit of scripting will probably be necessary.

Example:

$ hg export --git -r 3d41828c7d6b > patch
$ gitapply --summary patch
 rename sfx2/source/dialog/about.cxx => cui/source/dialogs/about.cxx (0%)
 create mode 100644 cui/source/dialogs/about.hrc
 rename svx/source/intro/iso.src => cui/source/dialogs/about.src (0%)
 rename sfx2/inc/about.hxx => cui/source/inc/about.hxx (0%)
 rename svx/source/intro/{intro_tmpl.hrc => about_ooo.hrc} (0%)
 rename svx/source/intro/{ooo.src => about_ooo.src} (0%)
$

You'll need the --force option of 'svn rename' and 'svn delete' after applying the patch.


I assume that tracking of moved files does not work anyway in svn (what
a PITA!), so the best one could get is a list of all missing and new files.

Regards,
Mathias


Regards,
   Heiner


--
Jens-Heiner Rechtien

Reply via email to