Re: CVS2GIT possible parents of Tags / Branches

James Blackburn <[email protected]> Wed, 25 Aug 2010 17:12:48 +0100
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel,gmane.comp.version-control.subversion.tortoisesvn.user
Message-ID <AANLkTimc5_=mytEbTLHh7Sa43Mcpf682uFoSV+J7Fm75__38413.9825044715$1282752777$gmane$org@mail.gmail.com>
Attached is a potential patch for the issue; as I don't have the best handle
on what's going on, feedback would be appreciated!

When building the cvs symbol information, _process_ntdbrs annotates branch
symbols which would be visible on head with ntdbr=True.  This step occurs
before the register_tag_possible_parents.  The patch simply adds Trunk as a
possible parent when it see ntdbr = True.

This seems to have a positive effect on the example I posted earlier (the
produced symbol out file looks sane), however it does perturb the tests...

Taking a look at the first failure (14), README has:

  2.  Then tagged everyone with T_ALL_INITIAL_FILES.

  3.  Then tagged everyone except sub1/subsubB/default with
      T_ALL_INITIAL_FILES_BUT_ONE.

  4.  Then created branch B_FROM_INITIALS on everyone.

  5.  Then created branch B_FROM_INITIALS_BUT_ONE on everyone except
      /sub1/subsubB/default.

Before my patch, the SVN repo has:

Creating Subversion r14 (copying to branch 'B_FROM_INITIALS')
Creating Subversion r15 (copying to tag 'T_ALL_INITIAL_FILES')
Creating Subversion r16 (copying to tag 'T_ALL_INITIAL_FILES_BUT_ONE')
Creating Subversion r17 (copying to branch 'B_FROM_INITIALS_BUT_ONE')

After my patch:

Creating Subversion r14 (copying to tag 'T_ALL_INITIAL_FILES')
Creating Subversion r15 (copying to tag 'T_ALL_INITIAL_FILES_BUT_ONE')
Creating Subversion r16 (copying to branch 'B_FROM_INITIALS')
Creating Subversion r17 (copying to branch 'B_FROM_INITIALS_BUT_ONE')

Which seems to be closer to README.

I'll have a look at the other failures, however it would be interesting to
know whether the change is in principle good or whether I've missed
something fundamental.

Cheers,
James

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2651271

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2git.patch (application/octet-stream, 1 KB)
### Eclipse Workspace Patch 1.0
#P cvs2svn-dev
Index: cvs2svn_lib/symbol_statistics.py
===================================================================
--- cvs2svn_lib/symbol_statistics.py	(revision 5248)
+++ cvs2svn_lib/symbol_statistics.py	(working copy)
@@ -167,11 +167,19 @@
     # revision where the branch is rooted:
     register(parent_cvs_rev.lod)
 
+    # If the parent_cvs_rev is visible on trunk (ntdbr) then we 
+    # should consider trunk as a valid parent for the tag.
+    ntdbr = parent_cvs_rev.ntdbr
+    if ntdbr:
+      register(cvs_file_items.trunk)
+
     # Branches that are rooted at the same revision are also
     # possible parents:
     for branch_id in parent_cvs_rev.branch_ids:
       parent_symbol = cvs_file_items[branch_id].symbol
-      register(parent_symbol)
+      # Ensure we don't add Trunk more than once for ntdbr revs
+      if not ntdbr or not isinstance(parent_symbol, Trunk):
+        register(parent_symbol)
 
   def is_ghost(self):
     """Return True iff this lod never really existed."""