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

Re: log -g on moved file results in "File not found" error

From: Paul Burba <ptburba_at_gmail.com>
Date: Fri, 9 May 2008 11:55:13 -0400

On Fri, May 9, 2008 at 4:40 AM, Marc Strapetz <marc.strapetz_at_syntevo.com> wrote:
> After moving a file in a branch and merging the branch back to trunk, a
> subsequent log -g on the trunk file fails with "svn: File not found" error.
> The problem can be reproduced by following script (it assumes an empty
> repository and should be executed in an empty directory):
>
> mkdir import
> printf "1\n2\n3\n4\n5" > import/file.txt
>
> svn import import svn://localhost/test/trunk -m "Initial import"
> svn mkdir svn://localhost/test/branches -m "Created branches directory"
> svn cp svn://localhost/test/trunk \
> svn://localhost/test/branches/b1 -m "Created branch b1"
> svn co svn://localhost/test/trunk trunk
> svn co svn://localhost/test/branches/b1 b1
> svn move b1/file.txt b1/file.copy.txt
> svn ci b1 -m "Moved file.txt to file.copy.txt"
>
> svn up trunk
> svn merge svn://localhost/test/branches/b1 trunk
> svn ci trunk -m "Merged changes from b1"
>
> # Now, following log fails:
> svn log -g svn://localhost/test/trunk/file.copy.txt

Hmmm, I wonder if this is what Mike had in mind when wrote this TODO
comment in libsvn_repos/logs.c:do_logs():

          /* If we're including merged revisions, we need to calculate
             the mergeinfo deltas committed in this revision to our
             various paths. */
          if (include_merged_revisions)
            {
              apr_array_header_t *cur_paths =
                apr_array_make(iterpool, paths->nelts, sizeof(const char *));

              /* Get the current paths of our history objects so we can
                 query mergeinfo. */
              /* ### TODO: Should this be ignoring depleted history items? */
              for (i = 0; i < histories->nelts; i++)
                {
                  struct path_info *info = APR_ARRAY_IDX(histories, i,
                                                         struct path_info *);
                  APR_ARRAY_PUSH(cur_paths, const char *) = info->path->data;
                }
              SVN_ERR(get_merged_rev_mergeinfo(&mergeinfo, fs, cur_paths,
                                               current, iterpool));
              has_children = (apr_hash_count(mergeinfo) > 0);
            }

The attached patch answers "yes" to that question and seems to fix
Marc's problem:

C:\SVN\sandbox>svn log -g file:///SVN/sandbox/test/trunk/file.copy.txt
------------------------------------------------------------------------
r5 | pburba | 2008-05-09 08:55:32 -0400 (Fri, 09 May 2008) | 1 line

Merged changes from b1
------------------------------------------------------------------------
r4 | pburba | 2008-05-09 08:54:18 -0400 (Fri, 09 May 2008) | 1 line

Moved file.txt to file.copy.txt
------------------------------------------------------------------------
r3 | pburba | 2008-05-09 08:52:47 -0400 (Fri, 09 May 2008) | 1 line

Created branch b1
------------------------------------------------------------------------
r1 | pburba | 2008-05-09 08:51:39 -0400 (Fri, 09 May 2008) | 1 line

------------------------------------------------------------------------

Hyrum / Mike, I haven't delved much into the log -g code, does this
look like the right direction to you all?

Now I know this patch is still flawed, because if do_logs() is
processing multiple PATHS then if *any* of those paths are deleted
this patch doesn't follow any merges into the other paths.

Not sure if it is better to call get_merged_rev_mergeinfo() separately
for each individual path or try to tweak
get_merged_rev_mergeinfo()'s helper get_combined_mergeinfo() to handle
this gracefully...any thoughts appreciated.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-05-09 17:55:43 CEST

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