You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Scott Pederick <sc...@solidstrategies.com.au> on 2007/06/27 15:02:10 UTC
Export entire changed files for zip patch
Hi,
I've been hunting around on the forums and google for the past couple of
days and haven't got closer to my goal.
I'm working on a number of php projects that I want to generate a zip
that contains the files changed from one version to another. This makes
it easy to apply, especially when you only have ftp access.
So far I've been able to generate a list of the files that have changed:
svn diff -r PREV:HEAD --summarize | sed -e "s/^[AM].*//pi" | sort | uniq
> files.txt
I then loop through the list to export the files from svn to a temporary
location so I can zip it up. I can export the files into one directory
but I'm having trouble re-creating the directory structure to start with.
Before I continue to bang my head against this one, does anyone know of
any pre-existing scripts of the like that solve this problem? I know I'm
not alone in this but I can't find any solutions that help with this
bit. At this point I'm assuming that I'm looking for the wrong thing or
in the wrong direction.
Any help will be most greatly appreciated.
Thanks in advance,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Scott Pederick <sc...@solidstrategies.com.au>.
Hi Nathan,
I take your point - it probably wouldn't be such a bad thing to package
up the entire revision. My thinking was that I didn't want to re-upload
things that really, really haven't changed - in particular the images
associated with the site. The site I'm currently working on is ~52Mb
with ~6,000 files so without an uber-uplink that's frustrating
(especially the ftp chatter for lots of small files). I could transfer
it to the site compressed (~13Mb) and decompress using a web file
manager but that'd just be another step with another login.
As it stands my recent changed files from the previous revision is ~2Mb
uncompressed and only 25 files. This makes it far more manageable to
distribute and upload.
Cheers,
Scott
Nathan Nobbe wrote:
> I was suggesting to 'lug around the whole revision' as i dont see that
> as a large issue.
> i tarred up nearly 200,000 lines of php source this morning and its
> only about 15 MB using
> gzip compression.
> On the sdlc thing, i was suggesting that creating tags and 'lugging
> them around' is the svn way
> but thats based on my somewhat moderate experience w/ svn thus far.
> from my perspective just
> tagging a revision and pushing it out to the servers is the most
> straightforward approach.
> and you can definitely push that over ftp.
> the only reason i can see for pushing out the differences and patching
> the source is if you have slim
> transfer requirements to the servers themselves or a ton of source to
> push; which maybe you do, i
> dont know.
> patching live code against differences is cool and all, but i thought
> you were looking for something simple.
>
> -nathan
>
> On 6/28/07, *Scott Pederick* <scott@solidstrategies.com.au
> <ma...@solidstrategies.com.au>> wrote:
>
> Hi Nathan,
> > just guessing a bit; as i havent used this myself; but isnt this
> what
> > patch <http://en.wikipedia.org/wiki/Patch_%28Unix%29> is for?
> > basically the flow here is to diff the to repositories; dump the
> diff
> > of each file in the repo to a diff file.
> > then recursively apply the diff files to the target source base
> using
> > patch.
> > you would still need to handle adding new files and removing deleted
> > files though.
> The problem is I can't use patch - the app is stored as php source and
> is only accessible via ftp. The only way to upload it is to upload
> each
> of the files that have changed. Rather than having to lug around the
> entire revision, I want to be able to package up just the changed
> files
> in an archive. You this extract the archive, upload it over the
> top of
> the existing source since the directory structure is maintained
> and the
> web app is patched.
> > in order to get a listing of the files that have changed between 2
> > components of the repository (typically a development branch and
> the
> > trunk)
> > svn diff -x -w svn+ssh://user@repohost/trunk
> > svn+ssh://user@localhost/branch-wc | grep '+++'
> > svn diff -x -w svn+ssh://suer@repohost/trunk
> > svn+ssh://user@localhost/branch-wc | grep '\-\-\-'
> >
> > so, in my mind i would start out by using those commands to
> generate a
> > list of files then iterate over the list producing the diff files.
> > note here, im assuming the diff output from svn is compatible w/
> gnu
> > diff (because thats what patch takes as input).
> >
> > you will have to have some client-side script to handle the merging;
> > no matter what the implementation, so
> > if you are deploying the php to windows and unix(ish) machines you
> > will likely have to maintain separate scripts for both platforms.
> >
> > why not just use a tagging approach and push out revisions of the
> > source? i think this would be a more direct solution and very
> easy to
> > implement.
> > also, i think tagging is more in tune w/ the svn way of facilitating
> > sdlc (imho).
> Not sure what you mean by this but that probably has more to do
> with my
> understanding of svn. Even if the release is tagged, it doesn't
> make it
> any easier to get the list of changed files but just a different
> checkpoint to generate a "patch" (ie. archive of changed files)
> against.
>
> Sorry if I haven't understood entirely what you meant but the main
> problem is that I only have ftp access to these shared hosting
> environments. Thanks for the reply.
>
> Cheers,
>
> Scott
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Nathan Nobbe <qu...@gmail.com>.
Scott,
I was suggesting to 'lug around the whole revision' as i dont see that as a
large issue.
i tarred up nearly 200,000 lines of php source this morning and its only
about 15 MB using
gzip compression.
On the sdlc thing, i was suggesting that creating tags and 'lugging them
around' is the svn way
but thats based on my somewhat moderate experience w/ svn thus far. from my
perspective just
tagging a revision and pushing it out to the servers is the most
straightforward approach.
and you can definitely push that over ftp.
the only reason i can see for pushing out the differences and patching the
source is if you have slim
transfer requirements to the servers themselves or a ton of source to push;
which maybe you do, i
dont know.
patching live code against differences is cool and all, but i thought you
were looking for something simple.
-nathan
On 6/28/07, Scott Pederick <sc...@solidstrategies.com.au> wrote:
>
> Hi Nathan,
> > just guessing a bit; as i havent used this myself; but isnt this what
> > patch <http://en.wikipedia.org/wiki/Patch_%28Unix%29> is for?
> > basically the flow here is to diff the to repositories; dump the diff
> > of each file in the repo to a diff file.
> > then recursively apply the diff files to the target source base using
> > patch.
> > you would still need to handle adding new files and removing deleted
> > files though.
> The problem is I can't use patch - the app is stored as php source and
> is only accessible via ftp. The only way to upload it is to upload each
> of the files that have changed. Rather than having to lug around the
> entire revision, I want to be able to package up just the changed files
> in an archive. You this extract the archive, upload it over the top of
> the existing source since the directory structure is maintained and the
> web app is patched.
> > in order to get a listing of the files that have changed between 2
> > components of the repository (typically a development branch and the
> > trunk)
> > svn diff -x -w svn+ssh://user@repohost/trunk
> > svn+ssh://user@localhost/branch-wc | grep '+++'
> > svn diff -x -w svn+ssh://suer@repohost/trunk
> > svn+ssh://user@localhost/branch-wc | grep '\-\-\-'
> >
> > so, in my mind i would start out by using those commands to generate a
> > list of files then iterate over the list producing the diff files.
> > note here, im assuming the diff output from svn is compatible w/ gnu
> > diff (because thats what patch takes as input).
> >
> > you will have to have some client-side script to handle the merging;
> > no matter what the implementation, so
> > if you are deploying the php to windows and unix(ish) machines you
> > will likely have to maintain separate scripts for both platforms.
> >
> > why not just use a tagging approach and push out revisions of the
> > source? i think this would be a more direct solution and very easy to
> > implement.
> > also, i think tagging is more in tune w/ the svn way of facilitating
> > sdlc (imho).
> Not sure what you mean by this but that probably has more to do with my
> understanding of svn. Even if the release is tagged, it doesn't make it
> any easier to get the list of changed files but just a different
> checkpoint to generate a "patch" (ie. archive of changed files) against.
>
> Sorry if I haven't understood entirely what you meant but the main
> problem is that I only have ftp access to these shared hosting
> environments. Thanks for the reply.
>
> Cheers,
>
> Scott
>
Re: Export entire changed files for zip patch
Posted by Scott Pederick <sc...@solidstrategies.com.au>.
Hi Nathan,
> just guessing a bit; as i havent used this myself; but isnt this what
> patch <http://en.wikipedia.org/wiki/Patch_%28Unix%29> is for?
> basically the flow here is to diff the to repositories; dump the diff
> of each file in the repo to a diff file.
> then recursively apply the diff files to the target source base using
> patch.
> you would still need to handle adding new files and removing deleted
> files though.
The problem is I can't use patch - the app is stored as php source and
is only accessible via ftp. The only way to upload it is to upload each
of the files that have changed. Rather than having to lug around the
entire revision, I want to be able to package up just the changed files
in an archive. You this extract the archive, upload it over the top of
the existing source since the directory structure is maintained and the
web app is patched.
> in order to get a listing of the files that have changed between 2
> components of the repository (typically a development branch and the
> trunk)
> svn diff -x -w svn+ssh://user@repohost/trunk
> svn+ssh://user@localhost/branch-wc | grep '+++'
> svn diff -x -w svn+ssh://suer@repohost/trunk
> svn+ssh://user@localhost/branch-wc | grep '\-\-\-'
>
> so, in my mind i would start out by using those commands to generate a
> list of files then iterate over the list producing the diff files.
> note here, im assuming the diff output from svn is compatible w/ gnu
> diff (because thats what patch takes as input).
>
> you will have to have some client-side script to handle the merging;
> no matter what the implementation, so
> if you are deploying the php to windows and unix(ish) machines you
> will likely have to maintain separate scripts for both platforms.
>
> why not just use a tagging approach and push out revisions of the
> source? i think this would be a more direct solution and very easy to
> implement.
> also, i think tagging is more in tune w/ the svn way of facilitating
> sdlc (imho).
Not sure what you mean by this but that probably has more to do with my
understanding of svn. Even if the release is tagged, it doesn't make it
any easier to get the list of changed files but just a different
checkpoint to generate a "patch" (ie. archive of changed files) against.
Sorry if I haven't understood entirely what you meant but the main
problem is that I only have ftp access to these shared hosting
environments. Thanks for the reply.
Cheers,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Eli Carter <el...@commprove.com>.
On Wednesday 27 June 2007, Nathan Nobbe wrote:
> just guessing a bit; as i havent used this myself; but isnt this what
> patch<http://en.wikipedia.org/wiki/Patch_%28Unix%29>is for?
> basically the flow here is to diff the to repositories; dump the diff of
> each file in the repo to a diff file.
> then recursively apply the diff files to the target source base using patch.
> you would still need to handle adding new files and removing deleted files
> though.
>
> in order to get a listing of the files that have changed between 2
> components of the repository (typically a development branch and the trunk)
> svn diff -x -w svn+ssh://user@repohost/trunk
svn+ssh://user@localhost/branch-wc
> | grep '+++'
> svn diff -x -w svn+ssh://suer@repohost/trunk
svn+ssh://user@localhost/branch-wc
> | grep '\-\-\-'
You'd probably rather use 'diffstat'.
> so, in my mind i would start out by using those commands to generate a list
> of files then iterate over the list producing the diff files.
svn diff will give you the diff over all the files; no need to build it up
yourself.
> note here, im assuming the diff output from svn is compatible w/ gnu diff
> (because thats what patch takes as input).
It's almost compatible. You'll run into problems when patching binary files.
svn diff --diff-cmd diff -x -au --force
may work better.
And adding/removing files may have issues; I haven't double-checked that yet.
Have fun,
Eli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Nathan Nobbe <qu...@gmail.com>.
just guessing a bit; as i havent used this myself; but isnt this what
patch<http://en.wikipedia.org/wiki/Patch_%28Unix%29>is for?
basically the flow here is to diff the to repositories; dump the diff of
each file in the repo to a diff file.
then recursively apply the diff files to the target source base using patch.
you would still need to handle adding new files and removing deleted files
though.
in order to get a listing of the files that have changed between 2
components of the repository (typically a development branch and the trunk)
svn diff -x -w svn+ssh://user@repohost/trunk svn+ssh://user@localhost/branch-wc
| grep '+++'
svn diff -x -w svn+ssh://suer@repohost/trunk svn+ssh://user@localhost/branch-wc
| grep '\-\-\-'
so, in my mind i would start out by using those commands to generate a list
of files then iterate over the list producing the diff files.
note here, im assuming the diff output from svn is compatible w/ gnu diff
(because thats what patch takes as input).
you will have to have some client-side script to handle the merging; no
matter what the implementation, so
if you are deploying the php to windows and unix(ish) machines you will
likely have to maintain separate scripts for both platforms.
why not just use a tagging approach and push out revisions of the source? i
think this would be a more direct solution and very easy to implement.
also, i think tagging is more in tune w/ the svn way of facilitating sdlc
(imho).
-nathan
On 6/27/07, Ryan Schmidt <su...@ryandesign.com> wrote:
>
> On Jun 27, 2007, at 10:02, Scott Pederick wrote:
>
> > I'm working on a number of php projects that I want to generate a
> > zip that contains the files changed from one version to another.
> > This makes it easy to apply, especially when you only have ftp access.
> >
> > So far I've been able to generate a list of the files that have
> > changed:
> >
> > svn diff -r PREV:HEAD --summarize | sed -e "s/^[AM].*//pi" | sort |
> > uniq > files.txt
> >
> > I then loop through the list to export the files from svn to a
> > temporary location so I can zip it up. I can export the files into
> > one directory but I'm having trouble re-creating the directory
> > structure to start with.
>
> Oh? How so? "basename" and "mkdir -p" should be your friend...
>
> Your sed is surely wrong, though; it looks like you're asking it to
> match lines that begin with "A" or "M", delete the entire contents
> line, and print the blank line, which is surely not what you want...
>
> I'd say you probably want something more like:
>
> sed -n -E -e "s/^[AM].{6}//p"
>
> -n: don't print by default
> -E: use modern regex syntax
> -e: use the following regex
>
> (At least, those flags are accurate for my BSD sed. With GNU sed it
> may be different.)
>
> Then search for lines starting with "A" or "M", followed by any 6
> characters, delete those 7 characters, and print the rest of the line.
>
> > Before I continue to bang my head against this one, does anyone
> > know of any pre-existing scripts of the like that solve this
> > problem? I know I'm not alone in this but I can't find any
> > solutions that help with this bit. At this point I'm assuming that
> > I'm looking for the wrong thing or in the wrong direction.
>
> Not aware of any existing script, but people do ask for this
> functionality on this list with surprising regularity, so probably
> someone has already written a script.
>
> How were you planning on handling deletions, by the way?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
Re: Export entire changed files for zip patch
Posted by Scott Pederick <sc...@solidstrategies.com.au>.
Hi Joe,
Good idea - would have saved me having to put a lots of windows batch
file knowledge into my brain. :)
Scott
Joe Franklin wrote:
> Scott,
> FWIW, I did something along the same lines (on Windows, too, using the
> Cygwin utils), except I used the generated files.txt as input into tar
> and then un-tarred the file and it created the needed directory
> structure. That saved me the step of parsing out the directories and
> creating each.
>
> jf
>
>
>> -----Original Message-----
>> From: Scott Pederick [mailto:scott@solidstrategies.com.au]
>> Sent: Thursday, June 28, 2007 5:38 AM
>> To: Ryan Schmidt
>> Cc: users@subversion.tigris.org
>> Subject: Re: Export entire changed files for zip patch
>>
>>
>>
>>>> I'm working on a number of php projects that I want to generate a
>>>>
> zip
>
>>>> that contains the files changed from one version to another. This
>>>> makes it easy to apply, especially when you only have ftp access.
>>>>
>>>> So far I've been able to generate a list of the files that have
>>>>
>> changed:
>>
>>>> svn diff -r PREV:HEAD --summarize | sed -e "s/^[AM].*//pi" | sort |
>>>> uniq > files.txt
>>>>
>>>> I then loop through the list to export the files from svn to a
>>>> temporary location so I can zip it up. I can export the files into
>>>> one directory but I'm having trouble re-creating the directory
>>>> structure to start with.
>>>>
>>> Oh? How so? "basename" and "mkdir -p" should be your friend...
>>>
>> Ah ha ha. Of course! I'm spending most of my time in Windows using
>> compiled unix tools - all my command-line intelligence has atrophied
>>
> in
>
>> the face of batch files. :)
>>
>>> Your sed is surely wrong, though; it looks like you're asking it to
>>> match lines that begin with "A" or "M", delete the entire contents
>>> line, and print the blank line, which is surely not what you want...
>>>
>>> I'd say you probably want something more like:
>>>
>>> sed -n -E -e "s/^[AM].{6}//p"
>>>
>>> -n: don't print by default
>>> -E: use modern regex syntax
>>> -e: use the following regex
>>>
>>> (At least, those flags are accurate for my BSD sed. With GNU sed it
>>> may be different.)
>>>
>>> Then search for lines starting with "A" or "M", followed by any 6
>>> characters, delete those 7 characters, and print the rest of the
>>>
> line.
>
>> Much better - thanks again.
>>
>>>> Before I continue to bang my head against this one, does anyone
>>>>
> know
>
>>>> of any pre-existing scripts of the like that solve this problem? I
>>>> know I'm not alone in this but I can't find any solutions that help
>>>> with this bit. At this point I'm assuming that I'm looking for the
>>>> wrong thing or in the wrong direction.
>>>>
>>> Not aware of any existing script, but people do ask for this
>>> functionality on this list with surprising regularity, so probably
>>> someone has already written a script.
>>>
>>> How were you planning on handling deletions, by the way?
>>>
>> Aside from a changleog, there's no particularly good way to handle
>> deletions using this method. The gain in simplicity of distribution
>> unfortunately loses functionality. The ultimate solution would be to
>>
> use
>
>> svn itself as a distribution method but that's not an option.
>>
>> Thanks again for your help - it was driving me crazy.
>>
>> If anyone else wants a windows batch file to do this, the following
>> worked for me (with great help from sed, sort and uniq):
>>
>> @ECHO OFF
>> SETLOCAL DISABLEDELAYEDEXPANSION
>>
>> REM Location of sed, sort and uniq
>> SET TOOLS=d:\utils\unix\usr\local\wbin
>>
>> REM SVN root
>> SET SVN=svn://localhost/myproject/trunk/public
>>
>> REM Patch path
>> SET PATCH=.\temp
>>
>> REM Working copy root
>> SET WC=d:\projects\web\myproject\public
>>
>> REM Convert backslashes to double backslahes for quoted sed expression
>> SET WCQ=%WC:\=\\%
>>
>> echo Creating changed files list
>> REM Remove lines without an filename extension (assumed to be
>>
> directories)
>
>> REM Extract the root path from the filename
>> svn diff -r PREV:HEAD --summarize %WC% | %TOOLS%\sed -e "/[.]/!d" |
>> %TOOLS%\sed -e "s/^[AM].* %WCQ%//pi" | %TOOLS%\sort | %TOOLS%\uniq >
>> files.txt
>>
>> echo Creating directory listing
>> %TOOLS%\sed -e "s,[^\\]*$,,;s,\\$,,;s,^$,.," files.txt | %TOOLS%\sort
>>
> |
>
>> %TOOLS%\uniq > directories.txt
>>
>> echo Clearing patch directory
>> IF NOT EXIST %PATCH% GOTO NOPATCHDIR
>> rmdir /q /s %PATCH%
>> :NOPATCHDIR
>>
>> echo Creating patch directories
>> REM Enable auto-creation of parent directories
>> SETLOCAL ENABLEEXTENSIONS
>> FOR /F %%B in (directories.txt) do (
>> mkdir %PATCH%\%%B
>> )
>> ENDLOCAL
>>
>> echo Exporting changed files
>> SETLOCAL ENABLEDELAYEDEXPANSION
>>
>> FOR /F %%A in (files.txt) do (
>> REM Changes the backslashes to forward slashes for the svn:// url
>> SET FILE=%%A%
>> SET URL=!FILE:\=/!
>>
>> REM Export the file from the repository to the patch directory
>> svn export %SVN%/%URL% %PATCH%\%%A
>> )
>>
>> ENDLOCAL
>>
>> echo Cleaning up...
>> del files.txt
>> del directories.txt
>>
>> :end
>> echo Done.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: users-help@subversion.tigris.org
>>
>
> -----------------------------------------
> The information contained in this e-mail message is intended only
> for the personal and confidential use of the recipient(s) named
> above. This message may be an attorney-client communication and/or
> work product and as such is privileged and confidential. If the
> reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are
> hereby notified that you have received this document in error and
> that any review, dissemination, distribution, or copying of this
> message is strictly prohibited. If you have received this
> communication in error, please notify us immediately by e-mail, and
> delete the original message.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Scott Pederick <sc...@solidstrategies.com.au>.
>> I'm working on a number of php projects that I want to generate a zip
>> that contains the files changed from one version to another. This
>> makes it easy to apply, especially when you only have ftp access.
>>
>> So far I've been able to generate a list of the files that have changed:
>>
>> svn diff -r PREV:HEAD --summarize | sed -e "s/^[AM].*//pi" | sort |
>> uniq > files.txt
>>
>> I then loop through the list to export the files from svn to a
>> temporary location so I can zip it up. I can export the files into
>> one directory but I'm having trouble re-creating the directory
>> structure to start with.
>
> Oh? How so? "basename" and "mkdir -p" should be your friend...
Ah ha ha. Of course! I'm spending most of my time in Windows using
compiled unix tools - all my command-line intelligence has atrophied in
the face of batch files. :)
>
> Your sed is surely wrong, though; it looks like you're asking it to
> match lines that begin with "A" or "M", delete the entire contents
> line, and print the blank line, which is surely not what you want...
>
> I'd say you probably want something more like:
>
> sed -n -E -e "s/^[AM].{6}//p"
>
> -n: don't print by default
> -E: use modern regex syntax
> -e: use the following regex
>
> (At least, those flags are accurate for my BSD sed. With GNU sed it
> may be different.)
>
> Then search for lines starting with "A" or "M", followed by any 6
> characters, delete those 7 characters, and print the rest of the line.
Much better - thanks again.
>> Before I continue to bang my head against this one, does anyone know
>> of any pre-existing scripts of the like that solve this problem? I
>> know I'm not alone in this but I can't find any solutions that help
>> with this bit. At this point I'm assuming that I'm looking for the
>> wrong thing or in the wrong direction.
>
> Not aware of any existing script, but people do ask for this
> functionality on this list with surprising regularity, so probably
> someone has already written a script.
>
> How were you planning on handling deletions, by the way?
Aside from a changleog, there's no particularly good way to handle
deletions using this method. The gain in simplicity of distribution
unfortunately loses functionality. The ultimate solution would be to use
svn itself as a distribution method but that's not an option.
Thanks again for your help - it was driving me crazy.
If anyone else wants a windows batch file to do this, the following
worked for me (with great help from sed, sort and uniq):
@ECHO OFF
SETLOCAL DISABLEDELAYEDEXPANSION
REM Location of sed, sort and uniq
SET TOOLS=d:\utils\unix\usr\local\wbin
REM SVN root
SET SVN=svn://localhost/myproject/trunk/public
REM Patch path
SET PATCH=.\temp
REM Working copy root
SET WC=d:\projects\web\myproject\public
REM Convert backslashes to double backslahes for quoted sed expression
SET WCQ=%WC:\=\\%
echo Creating changed files list
REM Remove lines without an filename extension (assumed to be directories)
REM Extract the root path from the filename
svn diff -r PREV:HEAD --summarize %WC% | %TOOLS%\sed -e "/[.]/!d" |
%TOOLS%\sed -e "s/^[AM].* %WCQ%//pi" | %TOOLS%\sort | %TOOLS%\uniq >
files.txt
echo Creating directory listing
%TOOLS%\sed -e "s,[^\\]*$,,;s,\\$,,;s,^$,.," files.txt | %TOOLS%\sort |
%TOOLS%\uniq > directories.txt
echo Clearing patch directory
IF NOT EXIST %PATCH% GOTO NOPATCHDIR
rmdir /q /s %PATCH%
:NOPATCHDIR
echo Creating patch directories
REM Enable auto-creation of parent directories
SETLOCAL ENABLEEXTENSIONS
FOR /F %%B in (directories.txt) do (
mkdir %PATCH%\%%B
)
ENDLOCAL
echo Exporting changed files
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F %%A in (files.txt) do (
REM Changes the backslashes to forward slashes for the svn:// url
SET FILE=%%A%
SET URL=!FILE:\=/!
REM Export the file from the repository to the patch directory
svn export %SVN%/%URL% %PATCH%\%%A
)
ENDLOCAL
echo Cleaning up...
del files.txt
del directories.txt
:end
echo Done.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Export entire changed files for zip patch
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 27, 2007, at 10:02, Scott Pederick wrote:
> I'm working on a number of php projects that I want to generate a
> zip that contains the files changed from one version to another.
> This makes it easy to apply, especially when you only have ftp access.
>
> So far I've been able to generate a list of the files that have
> changed:
>
> svn diff -r PREV:HEAD --summarize | sed -e "s/^[AM].*//pi" | sort |
> uniq > files.txt
>
> I then loop through the list to export the files from svn to a
> temporary location so I can zip it up. I can export the files into
> one directory but I'm having trouble re-creating the directory
> structure to start with.
Oh? How so? "basename" and "mkdir -p" should be your friend...
Your sed is surely wrong, though; it looks like you're asking it to
match lines that begin with "A" or "M", delete the entire contents
line, and print the blank line, which is surely not what you want...
I'd say you probably want something more like:
sed -n -E -e "s/^[AM].{6}//p"
-n: don't print by default
-E: use modern regex syntax
-e: use the following regex
(At least, those flags are accurate for my BSD sed. With GNU sed it
may be different.)
Then search for lines starting with "A" or "M", followed by any 6
characters, delete those 7 characters, and print the rest of the line.
> Before I continue to bang my head against this one, does anyone
> know of any pre-existing scripts of the like that solve this
> problem? I know I'm not alone in this but I can't find any
> solutions that help with this bit. At this point I'm assuming that
> I'm looking for the wrong thing or in the wrong direction.
Not aware of any existing script, but people do ask for this
functionality on this list with surprising regularity, so probably
someone has already written a script.
How were you planning on handling deletions, by the way?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org