[PATCH] Branches from a vendor branch

Jon Foster <[email protected]> Thu, 8 Apr 2010 17:51:08 +0100
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Hi,

Part of my repository history is:
- "cvs import" a new module, onto vendor branch VENDOR-BR
- Create a branch FOO-BR from r1.1.1.1 of all the files

cvs2svn wouldn't believe me when I told it that FOO-BR's parent was
trunk (using a symbol strategy rule).  It insisted that the parent
had to be VENDOR-BR, and I couldn't exclude VENDOR-BR.  A minimal
test case is included in the attached patch.

The attached patch allows me to migrate this branch/module
successfully.  When calculating parents for a branch, it checks if
the parent revision is a vendor revision like 1.1.1.1, and if so
then it notes trunk as a possible parent.

Since it changes the way possible parents are calculated, this patch
can change the parent which cvs2svn selects for a branch.  In the
cvs2svn test suite, this patch unexpectedly changes the behaviour of
the existing tests 14, 15, 16, and 17.  These all check the parent of
the B_FROM_INITIALS_BUT_ONE branch in the "main" test repository.
From looking at the CVS history, I don't think it's possible to tell
if the parent is really B_FROM_INITIALS, trunk, or "vendorbranch".
The old code made B_FROM_INITIALS the parent; the new code uses
trunk.  I think this is OK, and I've updated the tests accordingly.
(Looking at the README file, it looks like trunk is the real
parent).

Kind regards,

Jon


**********************************************************************
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Cabot Communications Ltd.

If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone.

Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232

Co. Registered in England number 02817269

Please contact the sender if you believe you have received this email in error.

**********************************************************************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

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

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn_vendor_branch_fix_patch.txt (text/plain, 3.8 KB)
Index: test-data/branch-from-vendor-branch-cvsrepos/branch-from-vendor-branch-symbol-hints.txt
===================================================================
--- test-data/branch-from-vendor-branch-cvsrepos/branch-from-vendor-branch-symbol-hints.txt	(revision 0)
+++ test-data/branch-from-vendor-branch-cvsrepos/branch-from-vendor-branch-symbol-hints.txt	(revision 0)
@@ -0,0 +1,7 @@
+# Columns:
+#project_id  symbol_name    conversion  symbol_path        preferred_parent_name
+0            .trunk.        trunk       trunk              .
+0            my-branch      branch      branches/my-branch .trunk.
+0            vendor-tag     exclude     .                  .
+0            vendor-branch  exclude     .                  .
+
Index: test-data/branch-from-vendor-branch-cvsrepos/data,v
===================================================================
--- test-data/branch-from-vendor-branch-cvsrepos/data,v	(revision 0)
+++ test-data/branch-from-vendor-branch-cvsrepos/data,v	(revision 0)
@@ -0,0 +1,63 @@
+head	1.1;
+branch	1.1.1;
+access;
+symbols
+	my-branch:1.1.1.1.0.2
+	vendor-tag:1.1.1.1
+	vendor-branch:1.1.1;
+locks; strict;
+comment	@# @;
+
+
+1.1
+date	2010.04.08.15.37.56;	author fosterj;	state Exp;
+branches
+	1.1.1.1;
+next	;
+commitid	2i5HeSdvL0B9s8uu;
+
+1.1.1.1
+date	2010.04.08.15.37.56;	author fosterj;	state Exp;
+branches
+	1.1.1.1.2.1;
+next	;
+commitid	2i5HeSdvL0B9s8uu;
+
+1.1.1.1.2.1
+date	2010.04.08.15.38.58;	author fosterj;	state Exp;
+branches;
+next	;
+commitid	eDJ6tPpuBwVxs8uu;
+
+
+desc
+@@
+
+
+1.1
+log
+@Initial revision
+@
+text
+@x
+@
+
+
+1.1.1.1
+log
+@Test import
+@
+text
+@@
+
+
+1.1.1.1.2.1
+log
+@Branch commit
+@
+text
+@d1 1
+a1 1
+y
+@
+
Index: cvs2svn_lib/symbol_statistics.py
===================================================================
--- cvs2svn_lib/symbol_statistics.py	(revision 5107)
+++ cvs2svn_lib/symbol_statistics.py	(working copy)
@@ -154,6 +154,11 @@
       if parent_symbol == symbol:
         break
       register(parent_symbol)
+    if parent_cvs_rev.ntdbr:
+      # If the parent revision is a vendor branch revision, and it
+      # existed when the vendor branch was the default branch, then
+      # trunk is a possible parent.
+      register(cvs_file_items.trunk)
 
   def register_tag_possible_parents(self, cvs_tag, cvs_file_items):
     """Register any possible parents of this symbol from CVS_TAG."""
Index: run-tests.py
===================================================================
--- run-tests.py	(revision 5107)
+++ run-tests.py	(working copy)
@@ -1205,9 +1205,15 @@
       ))
 
     # The same, as a branch
+    #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/proj/sub1/subsubB', 'D'),
+    #  ))
     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 /%(trunk)s:13)', 'A'),
       ('/%(branches)s/B_FROM_INITIALS_BUT_ONE/proj/sub1/subsubB', 'D'),
+      ('/%(branches)s/B_FROM_INITIALS_BUT_ONE/single-files', 'D'),
+      ('/%(branches)s/B_FROM_INITIALS_BUT_ONE/partial-prune', 'D'),
       ))
 
 
@@ -3852,7 +3858,15 @@
     ('/%(branches)s/BRANCH/file1', 'A'),
     ))
 
+@Cvs2SvnTestFunction
+def branch_from_vendor_branch():
+  "branch from vendor branch"
 
+  ensure_conversion(
+      'branch-from-vendor-branch',
+      symbol_hints_file='branch-from-vendor-branch-symbol-hints.txt',
+      )
+
 ########################################################################
 # Run the tests
 
@@ -4059,6 +4073,7 @@
     include_empty_directories_no_prune,
     exclude_symbol_default,
     add_on_branch2,
+    branch_from_vendor_branch,
     ]
 
 if __name__ == '__main__':