changeset 13779:c13bfa451656

convert/mtn: convert suspended branches as closed branches Monotone treats branch closing ("suspending") in a similar manner to how we do in mercurial - a cert is added to a revision that marks the branch to be hidden. If a subsequent commit is made, the branch is effectively reopened.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 25 Mar 2011 15:49:43 -0400
parents 46c3043253fb
children bc7b5d1c1999
files hgext/convert/monotone.py tests/test-convert-mtn.t
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/monotone.py	Sun Mar 27 13:34:20 2011 +0200
+++ b/hgext/convert/monotone.py	Fri Mar 25 15:49:43 2011 -0400
@@ -291,14 +291,18 @@
         return data, attr
 
     def getcommit(self, rev):
-        certs   = self.mtngetcerts(rev)
+        extra = {}
+        certs = self.mtngetcerts(rev)
+        if certs.get('suspend') == certs["branch"]:
+            extra['close'] = '1'
         return commit(
             author=certs["author"],
             date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")),
             desc=certs["changelog"],
             rev=rev,
             parents=self.mtnrun("parents", rev).splitlines(),
-            branch=certs["branch"])
+            branch=certs["branch"],
+            extra=extra)
 
     def gettags(self):
         tags = {}
--- a/tests/test-convert-mtn.t	Sun Mar 27 13:34:20 2011 +0200
+++ b/tests/test-convert-mtn.t	Fri Mar 25 15:49:43 2011 -0400
@@ -207,6 +207,10 @@
   $ mtn ci -m divergentdirmove2
   mtn: beginning commit on branch 'com.selenic.test'
   mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6
+
+test suspending (closing a branch)
+
+  $ mtn suspend 4a736634505795f17786fffdf2c9cbf5b11df6f6 2> /dev/null
   $ cd ..
 
 convert incrementally
@@ -355,3 +359,10 @@
   dir8-2/a
   dir9-2/b
   e
+
+check branch closing
+
+  $ hg branches -a
+  $ hg branches -c
+  com.selenic.test              13:* (closed) (glob)
+