Patch for uninitialization of merge tracking given a head URL.

Cheers,
Raman


Log message:

Add the uninit command, which removes merge tracking information for a
given head URL.

* svnmerge.py: Added uninit to command table.
  (action_uninit): New method for uninitialization of merge tracking.

* svnmerge_test.py
  (TestCase_TestRepo.testUninit): New test case.

Patch by: Raman Gupta <[EMAIL PROTECTED]>
Review by: ??
Index: svnmerge_test.py
===================================================================
--- svnmerge_test.py	(revision 6073)
+++ svnmerge_test.py	(working copy)
@@ -562,6 +562,25 @@
         p = self.getproperty()
         self.assertEqual("/trunk:1-6", p)
 
+    def testUninit(self):
+        self.svnmerge2(["init", self.test_repo_url + "/branches/test-branch"])
+
+        self.launch("svn commit -F svnmerge-commit-message.txt",
+                    match=r"Committed revision")
+
+        self.svnmerge2(["init", self.test_repo_url + "/branches/testYYY-branch"])
+
+        self.launch("svn commit -F svnmerge-commit-message.txt",
+                    match=r"Committed revision")
+
+        p = self.getproperty()
+        self.assertEqual("/branches/test-branch:1-13 /branches/testYYY-branch:1-14", p)
+
+        self.svnmerge2(["uninit", "--head", self.test_repo_url + "/branches/testYYY-branch"])
+
+        p = self.getproperty()
+        self.assertEqual("/branches/test-branch:1-13", p)
+
     def testCheckInitializeEverything(self):
         self.svnmerge2(["init", self.test_repo_url + "/trunk"])
         p = self.getproperty()
Index: svnmerge.py
===================================================================
--- svnmerge.py	(revision 6073)
+++ svnmerge.py	(working copy)
@@ -1186,7 +1186,30 @@
         f.close()
         report('wrote commit message to "%s"' % opts["commit-file"])
 
+def action_uninit(branch_dir, branch_props):
+    """Uninit HEAD URL."""
+    # Check branch directory is ready for being modified
+    check_dir_clean(branch_dir)
 
+    # If the head-path already has an entry in the svnmerge-integrated
+    # property, simply error out.
+    if not branch_props.has_key(opts["head-path"]):
+        error('%s does not contain merge tracking information for %s' \
+                % (opts["head-path"], branch_dir))
+
+    branch_props.pop(opts["head-path"])
+
+    # Set property
+    set_merge_props(branch_dir, branch_props)
+
+    # Write out commit message if desired
+    if opts["commit-file"]:
+        f = open(opts["commit-file"], "w")
+        print >>f, 'Removed merge tracking for "%s" for ' % NAME
+        print >>f, '%s' % opts["head-url"]
+        f.close()
+        report('wrote commit message to "%s"' % opts["commit-file"])
+
 ###############################################################################
 # Command line parsing -- options and commands management
 ###############################################################################
@@ -1635,6 +1658,14 @@
     [
         "-f", "-r", "-S", # import common opts
     ]),
+
+    "uninit": (action_uninit,
+    "uninit [OPTION...] [HEAD]",
+    """Remove merge tracking information for HEAD on the current working
+    directory.""",
+    [
+        "-f", "-S", # import common opts
+    ]),
 }
 
 
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge

Reply via email to