Re: CVS2GIT possible parents of Tags / Branches

James Blackburn <[email protected]> Wed, 25 Aug 2010 18:22:11 +0100
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel,gmane.comp.version-control.subversion.tortoisesvn.user
Message-ID <[email protected]>
The attached patch fixes up the tests as well.  The failures were in
main-cvsrepos/proj, and all due to the choice of trunk for the symbol parent
rather than a branch / tag symbol.
AFAICS the delta is now more in-line with the list of steps given in
main-cvsrepos/proj/README.

All other tests look good, I guess there still needs to add a specific test
for bug 54.

Feedback appreciated.

Cheers,
James
On 25 August 2010 17:12, James Blackburn <[email protected]> wrote:

> 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=2651287

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn.patch (application/octet-stream, 3.8 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."""
Index: run-tests.py
===================================================================
--- run-tests.py	(revision 5248)
+++ run-tests.py	(working copy)
@@ -1180,11 +1180,11 @@
       ('/%(trunk)s/proj/sub3/default', 'A'),
       ))
 
-    fromstr = ' (from /%(branches)s/B_FROM_INITIALS:14)'
+    fromstr = ' (from /%(trunk)s:13)'
 
     # Tag on rev 1.1.1.1 of all files in proj
-    conv.logs[14].check(sym_log_msg('B_FROM_INITIALS'), (
-      ('/%(branches)s/B_FROM_INITIALS (from /%(trunk)s:13)', 'A'),
+    conv.logs[16].check(sym_log_msg('B_FROM_INITIALS'), (
+      ('/%(branches)s/B_FROM_INITIALS'+fromstr, 'A'),
       ('/%(branches)s/B_FROM_INITIALS/single-files', 'D'),
       ('/%(branches)s/B_FROM_INITIALS/partial-prune', 'D'),
       ))
@@ -1193,18 +1193,22 @@
     log = conv.find_tag_log('T_ALL_INITIAL_FILES')
     log.check(sym_log_msg('T_ALL_INITIAL_FILES',1), (
       ('/%(tags)s/T_ALL_INITIAL_FILES'+fromstr, 'A'),
+      ('/%(tags)s/T_ALL_INITIAL_FILES/single-files', 'D'),
+      ('/%(tags)s/T_ALL_INITIAL_FILES/partial-prune', 'D'),
       ))
 
     # Tag on rev 1.1.1.1 of all files in proj, except one
     log = conv.find_tag_log('T_ALL_INITIAL_FILES_BUT_ONE')
     log.check(sym_log_msg('T_ALL_INITIAL_FILES_BUT_ONE',1), (
       ('/%(tags)s/T_ALL_INITIAL_FILES_BUT_ONE'+fromstr, 'A'),
+      ('/%(tags)s/T_ALL_INITIAL_FILES_BUT_ONE/single-files', 'D'),
+      ('/%(tags)s/T_ALL_INITIAL_FILES_BUT_ONE/partial-prune', 'D'),
       ('/%(tags)s/T_ALL_INITIAL_FILES_BUT_ONE/proj/sub1/subsubB', 'D'),
       ))
 
-    # The same, as a branch
+    # The same, as a B_FROM_INITIALS with sub-director removed
     conv.logs[17].check(sym_log_msg('B_FROM_INITIALS_BUT_ONE'), (
-      ('/%(branches)s/B_FROM_INITIALS_BUT_ONE'+fromstr, 'A'),
+      ('/%(branches)s/B_FROM_INITIALS_BUT_ONE (from /%(branches)s/B_FROM_INITIALS:16)', 'A'),
       ('/%(branches)s/B_FROM_INITIALS_BUT_ONE/proj/sub1/subsubB', 'D'),
       ))
 
@@ -1230,7 +1234,12 @@
 
   log = conv.find_tag_log('T_MIXED')
   log.check_changes((
-    ('/%(tags)s/T_MIXED (from /%(branches)s/B_MIXED:20)', 'A'),
+    ('/%(tags)s/T_MIXED (from /%(trunk)s:19)', 'A'),
+    ('/%(tags)s/T_MIXED/partial-prune', 'D'),
+    ('/%(tags)s/T_MIXED/single-files', 'D'),
+    ('/%(tags)s/T_MIXED/proj/sub2/subsubA '
+     '(from /%(trunk)s/proj/sub2/subsubA:13)', 'R'),
+    ('/%(tags)s/T_MIXED/proj/sub3 (from /%(trunk)s/proj/sub3:18)', 'R'),
     ))
 
 
@@ -1242,7 +1251,7 @@
 
   # A branch from the same place as T_MIXED in the previous test,
   # plus a file added directly to the branch
-  conv.logs[20].check(sym_log_msg('B_MIXED'), (
+  conv.logs[21].check(sym_log_msg('B_MIXED'), (
     ('/%(branches)s/B_MIXED (from /%(trunk)s:19)', 'A'),
     ('/%(branches)s/B_MIXED/partial-prune', 'D'),
     ('/%(branches)s/B_MIXED/single-files', 'D'),