[Svnmerge] Using svnmerge in a subdirectory

Thomas Heller theller at ctypes.org
Fri Oct 20 00:16:07 PDT 2006


Giovanni Bajo schrieb:
> Thomas Heller wrote:
> 
>> Ok, so it needs some options.  But how? I'm afraid I cannot
>> understand the help it gives:
> 
> Hi Thomas. What is exactly you do not understand? I wrote that help so it's
> clear to me; I'd need some guidance to fix it!

Giovanni,

I think I got it in the meantime.  But let me explain why I was confused:

1. 'svnmerge init' told me:
  svnmerge: no copyfrom info available. Explicit head argument (-S/--head) required.
But 'svnmerge help init' does not mention a -S/--head command line switch.

2. IIRC I then tried several variations of 'svnmerge init <directory>', but 
got the same error message as above.  Now that I try this again it seems that
(at least on Windows), absolute paths to directories of a trunk checkout seem to work
but relative paths do not.

3. The 'svn help' commands use the terminology 'PATH' for a working directory, and
URL for a url.  'svnmerge init help' mentions HEAD, I did not understand what I had to
specify there.

> 
> The command line format is this:
> 
>>   usage: svnmerge init [OPTION...] [HEAD]
> 
> The summary of the command is pretty clear I guess:
> 
>>   Initialize merge tracking from HEAD on the current working
>> directory.
> 
> Now, there are two cases. Either HEAD is specified, or it is not specified. If
> it is specificed:
> 
>>   If HEAD is specified, all the revisions in HEAD are marked as
>> already merged; if this is not correct, you can use
>>   --revision to specify the exact list of already-merged revisions.
> 
> So, if you specify an URL as HEAD, it means "initialize merge tracking against
> HEAD, and assume that the branch is up-to-date: all the revisions currently in
> HEAD have already been merged". If this is not true, you will need --revision
> to tell which revisions have been already merged.
> 
> In your case, I assume that you want to merge something from the trunk into the
> release25-maint branch. What you want to say is: "I never merged anything in
> this directoy since it was created (the branch point)". Now this is exactly
> what happens when HEAD is omitted. In fact the help says:
> 
>>   If HEAD is omitted, then it is computed from the "svn cp" history
>> of the current working directory (searching back for the branch
>> point); in this case, svnmerge assumes that no revision has been
>> integrated yet since the branch point (unless you teach it with
>> --revision).

Being a long-time CVS user, I still have to get up to speed with svn.
In the docs and books I have read so far, the authors always talk of the importance
of mentioning in the commit messages which revisions from the trunk have been merged
into the branch.  I think svnmerge can help with this, instead of having to browse
though 'svn log' output the merges are tracked in a property.

> So this is exactly what you want. The problem is that the "svn cp" was done at
> top-level, and svnmerge.py is confused by this. I consider this a bug (or a
> missing feature) in svnmerge.py. It should be able to support this case (HEAD
> omitted) even from within a subdirectory of the one that was copied.
> 
> Right now, the best you can do is to explicitally specify the HEAD URL (which
> would be something like "[...]/trunk/Modules/_ctypes") *and*
> specify --revision=1-XXX, where XXX is the branch-point (the revision at which
> the release25-maint branch was created). You can find out the branchpoint with
> "svn log --stop-on-copy"; [...]

Yes, that's what I had done yesterday night.  It would be nice if svnmerge would be
fixed (or enhanced) to find the head url and the branch point out itself even in a
subdirectory; one place where it fails in in the get_copyfrom() function, where
'out' contains this:

<path
   copyfrom-path="/python/trunk"
   copyfrom-rev="51332"
   action="A">/python/branches/release25-maint</path>
</paths>

but 'repos_path' is '/python/branches/release25-maint/Modules/_ctypes', so 

        m = re.search(r'(<path\s[^>]*action="A"[^>]*>%s</path>)'
                      % re.escape(repos_path), out)

does not find a match.

> If this whole message is confusing for you, I'm probably abusing some
> terminology you do not know. I suggest you then first read the svnmerge.py wiki
> page which should give you a basic idea, and then get back to this message. If
> the confusion persists, slap me and I'll try to explain better :)
> 
> Giovanni Bajo

Now that I have sucessfully started I think svnmerge can help me a lot.

Thanks,
Thomas




More information about the Svnmerge mailing list