You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Geoff Richards <qe...@ungwe.org> on 2006/04/05 13:52:25 UTC

committing a rename with a delta editor

Hi,

I'm trying to commit a 'rename' (delete and copy) using a commit
editor, and I've got a few questions about how to do this:

 * Does it make any difference whether I delete the old file first,
   before adding a copy of it from the last revision, or add the
   copy first?

 * It doesn't seem to make any difference whether the paths I use
   to add or open files and directories start with a slash or not.
   Is there any reason I should or should not use '/trunk/blah' instead
   of 'trunk/blah'?

 * What form should the copyfrom_path value take?  In the docs it
   just says that it should be a path, but it seems to require a
   full URL.  When I try with just a path I get this:

   General filesystem error: Source url '/trunk/foo' is
   from different repository at test.pl line 125

(I'm doing this from Perl, but these things are probably applicable
more generally.)

Here's the code that generates the error above:

    $trunk_baton = $ed->open_directory('trunk', $root_baton, $cur_rev);
    $ed->delete_entry('trunk/foo', $cur_rev, $trunk_baton);
    my $bar_baton = $ed->add_file('trunk/bar', $trunk_baton,
                                  '/trunk/bar', $cur_rev);

Thanks.


-- 

--- Geoff Richards -------------><-------------- http://ungwe.org/ ---
"I tried to fling my shadow at the moon,
 The while my blood leapt with a wordless song."  --  Theodore Roethke

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

Re: committing a rename with a delta editor

Posted by Daniel Rall <dl...@collab.net>.
On Thu, 06 Apr 2006, C. Michael Pilato wrote:

> Daniel Rall wrote:
> > I've committed Geoff's patch as r19203, but given that Mike's research
> > shows that copyfrom_path is actually always a URI, I'm actually in
> > favor of doing the vtable function argument name change as well.
> > Anyone against?
> 
> Actually, I'm against.  Thus far, the copyfrom_path has always been a URI,
> but we only use that parameter *at all* in a select few places.  I see no
> reason to paint ourselves into that corner right now.  IMO, the docstring
> should state that the copyfrom_path is either a path relative to the root of
> the edit, or an absolute URL.

Thanks Mike, r19210.
-- 

Daniel Rall

Re: committing a rename with a delta editor

Posted by "C. Michael Pilato" <cm...@collab.net>.
Daniel Rall wrote:
> I've committed Geoff's patch as r19203, but given that Mike's research
> shows that copyfrom_path is actually always a URI, I'm actually in
> favor of doing the vtable function argument name change as well.
> Anyone against?

Actually, I'm against.  Thus far, the copyfrom_path has always been a URI,
but we only use that parameter *at all* in a select few places.  I see no
reason to paint ourselves into that corner right now.  IMO, the docstring
should state that the copyfrom_path is either a path relative to the root of
the edit, or an absolute URL.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Re: committing a rename with a delta editor

Posted by Daniel Rall <dl...@collab.net>.
On Wed, 05 Apr 2006, Geoff Richards wrote:
...
> > >  * What form should the copyfrom_path value take?  In the docs it
> > >    just says that it should be a path, but it seems to require a
> > >    full URL.  When I try with just a path I get this:
> > 
> > Looking at the code, I agree that it seems that the commit editors require
> > a URL.
> 
> In that case, can I suggest the attached patch against r19185 to clarify
> the docs.  Or perhaps it would be better to rename the argument to
> 'copyfrom_url'?

I've committed Geoff's patch as r19203, but given that Mike's research
shows that copyfrom_path is actually always a URI, I'm actually in
favor of doing the vtable function argument name change as well.
Anyone against?


...
> Index: subversion/include/svn_delta.h
> ===================================================================
> --- subversion/include/svn_delta.h	(revision 19185)
> +++ subversion/include/svn_delta.h	(working copy)
> @@ -590,9 +590,11 @@
>   * @a copyfrom_path and @a copyfrom_revision.  If @a copyfrom_path is
>   * non-@c NULL, then @a copyfrom_path and @a copyfrom_revision indicate where
>   * the file or directory should be copied from (to create the file
> - * or directory being added).  If @a copyfrom_path is @c NULL, then
> - * @a copyfrom_revision must be @c SVN_INVALID_REVNUM; it is invalid to
> - * pass a mix of valid and invalid copyfrom arguments.
> + * or directory being added).  In that case @a copyfrom_path must be the
> + * URL of a file inside the same repository as the new file or directory.
> + * If @a copyfrom_path is @c NULL, then @a copyfrom_revision must be
> + * @c SVN_INVALID_REVNUM; it is invalid to pass a mix of valid and invalid
> + * copyfrom arguments.
>   *
>   *
>   * <h3>Function Call Ordering</h3>
> 

Re: committing a rename with a delta editor

Posted by Geoff Richards <qe...@ungwe.org>.
On Wed, Apr 05, 2006 at 09:58:59AM -0400, C. Michael Pilato wrote:
> Geoff Richards wrote:
> > Hi,
> > 
> > I'm trying to commit a 'rename' (delete and copy) using a commit
> > editor, and I've got a few questions about how to do this:
> ...

thanks

> >  * What form should the copyfrom_path value take?  In the docs it
> >    just says that it should be a path, but it seems to require a
> >    full URL.  When I try with just a path I get this:
> 
> Looking at the code, I agree that it seems that the commit editors require
> a URL.

In that case, can I suggest the attached patch against r19185 to clarify
the docs.  Or perhaps it would be better to rename the argument to
'copyfrom_url'?


-- 

--- Geoff Richards -------------><-------------- http://ungwe.org/ ---
"I tried to fling my shadow at the moon,
 The while my blood leapt with a wordless song."  --  Theodore Roethke

Re: committing a rename with a delta editor

Posted by "C. Michael Pilato" <cm...@collab.net>.
Geoff Richards wrote:
> Hi,
> 
> I'm trying to commit a 'rename' (delete and copy) using a commit
> editor, and I've got a few questions about how to do this:
> 
>  * Does it make any difference whether I delete the old file first,
>    before adding a copy of it from the last revision, or add the
>    copy first?

Nope.  Copy sources always come from immutable locations (previous
revisions), and those (by definition) can't be deleted.  You can do these
operations in either order (copy+delete, delete+copy).

>  * It doesn't seem to make any difference whether the paths I use
>    to add or open files and directories start with a slash or not.
>    Is there any reason I should or should not use '/trunk/blah' instead
>    of 'trunk/blah'?

Doesn't matter a bit.

>  * What form should the copyfrom_path value take?  In the docs it
>    just says that it should be a path, but it seems to require a
>    full URL.  When I try with just a path I get this:

Looking at the code, I agree that it seems that the commit editors require a
URL.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand