# # # patch "tracvc/mtn/automate.py" # from [cddf03c360177a4888e6c37ceb621bd530817cc2] # to [d731080c4d4937f8026740125c6b71976810e1a2] # ============================================================ --- tracvc/mtn/automate.py cddf03c360177a4888e6c37ceb621bd530817cc2 +++ tracvc/mtn/automate.py d731080c4d4937f8026740125c6b71976810e1a2 @@ -1,9 +1,9 @@ Trac Plugin for Monotone #!/usr/bin/env python # -*- coding: utf-8 -*- """ Trac Plugin for Monotone -Copyright 2006, 2007 Thomas Moschny (address@hidden) +Copyright 2006 - 2008 Thomas Moschny (address@hidden) {{{ This program is free software; you can redistribute it and/or modify @@ -177,14 +177,16 @@ class MTN(object): def roots(self): """Returns a list of all root revisions.""" - # FIXME: we should have an automate command for that. if self.roots_cache: return self.roots_cache - roots = [] - for line in self.automate.command("graph").splitlines(): - rev_and_parents = line.split(' ') - if len(rev_and_parents) == 1: - roots.append(rev_and_parents[0]) + if self.min_interface_version('4.3'): + roots = self.automate.command("roots").splitlines() + else: + roots = [] + for line in self.automate.command("graph").splitlines(): + rev_and_parents = line.split(' ') + if len(rev_and_parents) == 1: + roots.append(rev_and_parents[0]) self.roots_cache = roots return roots @@ -337,6 +339,9 @@ class MTN(object): "interface_version").strip() return self.interface_version + def min_interface_version(self, v): + return natsort_key(self.get_interface_version()) \ + >= natsort_key(v) class Changeset(object): """Represents a monotone changeset in parsed form."""