[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Export entire changed files for zip patch

From: Nathan Nobbe <quickshiftin_at_gmail.com>
Date: 2007-06-27 21:41:33 CEST

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 <subversion-2007b@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
>
>
Received on Wed Jun 27 21:41:52 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.