The unified diff between revisions [2596d25a..] and [58429606..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'mtn.py'
#
#
# patch "mtn.py"
# from [24bdc6cf0f2935b5768da503135c11c50f86e267]
# to [60dee430345a7183b092fd315c003468ffd86e33]
#
============================================================
--- mtn.py 24bdc6cf0f2935b5768da503135c11c50f86e267
+++ mtn.py 60dee430345a7183b092fd315c003468ffd86e33
@@ -43,7 +43,8 @@ class Revision(str):
# special case that must be handled: empty (initial) revision ID ''
str.__init__(v)
self.obj_type = "revision"
- if v != '' and not (revision_re_c.match(self) and len(self) == sha1_len):
+ self.is_empty = (v == '')
+ if not self.is_empty and not (revision_re_c.match(self) and len(self) == sha1_len):
raise MonotoneException("Not a valid revision ID: %s" % (repr(v)))
def abbrev(self):
return '[' + self[:8] + '..]'
@@ -139,9 +140,25 @@ class Automate(Runner):
return CleanRequest(self.__run(*args, **kwargs))
- def __run(self, command, args):
- enc = "l%d:%s" % (len(command), command)
- enc += ''.join(["%d:%s" % (len(x), x) for x in args]) + 'e'
+ def __run(self, command, args, **kwargs):
+ def str_with_len(l, s):
+ l.append(str(len(s)))
+ l.append(":")
+ l.append(s)
+ parts = []
+ for k in kwargs:
+ # can't use a '-' as a named function argument
+ kd = k.replace('_', '-')
+ parts.append("o")
+ str_with_len(parts, kd)
+ str_with_len(parts, kwargs[k])
+ parts.append("e")
+ parts.append("l")
+ str_with_len(parts, command)
+ for x in args:
+ str_with_len(parts, x)
+ parts.append("e")
+ enc = ''.join(parts)
# number of tries to get a working mtn going..
for i in xrange(2):
@@ -155,7 +172,6 @@ class Automate(Runner):
debug("exception writing to child process; attempting restart: %s" % format_exc())
self.stop()
- import sys
def read_result_packets():
buffer = ""
while True:
@@ -372,7 +388,7 @@ class Operations:
yield Tag(stanza[1], stanza[3], stanza[5], branches)
def branches(self):
- for line in (t.strip() for t in self.automate.run('branches', [])):
+ for line in (t.strip() for t in self.automate.run('branches', [], ignore_suspend_certs="")):
if not line:
continue
yield apply(Branch, (line,))