From d14550bdc675b8842c92f8576cc5f6fd46714f3b Mon Sep 17 00:00:00 2001 From: mhagger Date: Mon, 4 Apr 2011 12:07:36 +0000 Subject: [PATCH] Count trunk as possible parent of branches from a vendor branch. Patch by: Jon Foster Edited by: me With help from: James Blackburn This is related to, but only a partial improvement to, the problem covered by issue #54. From Jon's email: 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). git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5335 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/symbol_statistics.py | 6 ++++++ run-tests.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cvs2svn_lib/symbol_statistics.py b/cvs2svn_lib/symbol_statistics.py index c0380eee..352f7b48 100644 --- a/cvs2svn_lib/symbol_statistics.py +++ b/cvs2svn_lib/symbol_statistics.py @@ -141,6 +141,12 @@ class _Stats: # revision where the branch is rooted: register(parent_cvs_rev.lod) + 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) + # Any other branches that are rooted at the same revision and # were committed earlier than the branch are also possible # parents: diff --git a/run-tests.py b/run-tests.py index 352b4a12..19a3d4b4 100755 --- a/run-tests.py +++ b/run-tests.py @@ -1201,8 +1201,10 @@ class SimpleTags(Cvs2SvnTestCase): # 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 (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'), )) @@ -4145,7 +4147,7 @@ test_list = [ include_empty_directories_no_prune, exclude_symbol_default, add_on_branch2, - XFail(branch_from_vendor_branch), + branch_from_vendor_branch, strange_default_branch, move_parent, ] -- 2.11.4.GIT