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

Re: New code: svnpatch

From: John Goerzen <jgoerzen_at_complete.org>
Date: 2003-04-03 15:02:54 CEST

Rafael Garcia-Suarez <raphel.garcia-suarez@hexaflux.com> writes:

> Good first attempt at a naive implementation ;-)

Thanks, but I think you're wrong on all three counts :-)

> There are a few problems :
> It doesn't appear to handle removed/added directories. (patch(1)
> automatically deletes dirs when all files in them have been
> removed by a patch. Recursively.)

It will notice that directories are gone, and will run svn rm on them
accordingly. Same goes for svn add. Both those commands work on
directories as well as files. I tested this with early versions of
the 2.4.0 Linux kernel tree where they added a new directory for
ReiserFS. It worked fine.

As far as patch removing directories, I don't think it will actually
do this because of the .svn directory in each one. So that is a known
weak spot of this system.

> It doesn't check the exit status of patch(1).

That's what this code is for:

        if not os.WIFEXITED(waitval):
            raise ValueError, "Command did not exit successfully"
        if os.WEXITSTATUS(waitval):
            raise ValueError, "Command returned status %d" % \
                  os.WEXITSTATUS(waitval)

I did test it, and it does work. The "raise" raises a Python
exception, and since I do not catch that exception, it causes the
program to terminate.

> It will erroneously add *.{orig,rej} files.

No. Patch will exit with a nonzero status if it creates any of those,
and svnpatch makes no changes if this occurs. That is, running
svnpatch in this case is functionally identical to running patch.

-- John

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 3 15:44:34 2003

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

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