Giovanni Bajo wrote:
> Raman Gupta wrote:
>
>> Giovanni Bajo wrote:
>>> Raman Gupta <[EMAIL PROTECTED]> wrote:
>>>
>>>>> +
>>>>> + branch_props.pop(opts["head-path"])
>>> With "del" here instead of pop, you get a +1 from me.
>> Hmm, del doesn't seem to work:
>>
>> $ ./svnmerge_test.py
>> Traceback (most recent call last):
>> File "./svnmerge_test.py", line 25, in ?
>> import svnmerge
>> File "/home/raman/svn-client-side/svnmerge.py", line 1205
>> branch_props.del(opts["head-path"])
>> ^
>> SyntaxError: invalid syntax
>
> del branch_props[opts["head_path"]]
Ahh, ok. I knew there had to be a way to do it without popping, but
I was looking for methods on dictionary objects. Thanks.
Attached v3 of the patch, and new log message:
Add the uninit command, which removes merge tracking information for a given
head URL. This is useful if multiple heads are being tracked -- without
uninit, this situation requires the new property value to be manually set by
the user via svn propset.
* svnmerge.py: Added uninit to command table.
(action_uninit): New method for uninitialization of merge tracking info.
* svnmerge_test.py
(TestCase_TestRepo.testUninit): New test case.
(TestCase_TestRepo.testUninitForce): New test case.
Patch by: Raman Gupta <[EMAIL PROTECTED]>
Review by: Daniel Rall <[EMAIL PROTECTED]>
Giovanni Bajo <[EMAIL PROTECTED]>
Cheers,
Raman
Index: svnmerge.py
===================================================================
--- svnmerge.py (revision 19599)
+++ svnmerge.py (working copy)
@@ -1191,7 +1191,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))
+
+ del branch_props[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
###############################################################################
@@ -1640,6 +1663,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
+ ]),
}
Index: svnmerge_test.py
===================================================================
--- svnmerge_test.py (revision 19599)
+++ svnmerge_test.py (working copy)
@@ -456,7 +456,10 @@
def getproperty(self):
out = svnmerge.launch("svn pg %s ." % svnmerge.opts["prop"])
- return out[0].strip()
+ if len(out) == 0:
+ return None
+ else:
+ return out[0].strip()
def testNoWc(self):
os.mkdir("foo")
@@ -562,6 +565,56 @@
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", "--source", self.test_repo_url + "/branches/testYYY-branch"])
+
+ p = self.getproperty()
+ self.assertEqual("/branches/test-branch:1-13", p)
+
+ self.launch("svn commit -F svnmerge-commit-message.txt",
+ match=r"Committed revision")
+
+ self.svnmerge2(["uninit", "--source", self.test_repo_url + "/branches/test-branch"])
+
+ p = self.getproperty()
+ self.assertEqual(None, p)
+
+ def testUninitForce(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)
+
+ open("test1", "a").write("foo")
+
+ self.svnmerge("uninit --source " + self.test_repo_url + "/branches/testYYY-branch",
+ error=True, match=r"clean")
+
+ self.svnmerge("uninit -F --source " + 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()
_______________________________________________
Svnmerge mailing list
[email protected]
http://www.orcaware.com/mailman/listinfo/svnmerge