if item.revno == revno:
return item.revision
croak("{0} has no revno {1}".format(self.name, revno))
- def resolve(self, ctx):
- "Resolve a revision spec that may contain tags into revnos."
- if ctx.is_empty():
- return ctx
- if type(ctx.start) == type(""):
- if ctx.start in self.symbols:
- ctx.start = self.symbols[ctx.start]
- else:
- croak("can't resolve symbol {0} in {1}".format(ctx.start,self.name))
- if type(ctx.end) == type(""):
- if ctx.end in self.symbols:
- ctx.end = self.symbols[ctx.end]
- else:
- croak("can't resolve symbol {0} in {1}".format(ctx.end, self.name))
- if ctx.end > len(self):
- croak("{0} has no {1} revision".format(self.name, ctx.end))
- return ctx
def isbranch(self, symbol):
"Is this a branch symbol?"
return ".0." in symbol
def __contains__(self, i):
"Does the spec contain the given revno?"
return i >= self.start and (self.end is None or i <= self.end)
+ def resolve(self, metadata):
+ "Resolve a revision spec that may contain tags into revnos."
+ if self.is_empty():
+ return self
+ if type(self.start) == type(""):
+ if self.start in metadata.symbols:
+ self.start = metadata.symbols[self.start]
+ else:
+ croak("can't resolve symbol {0} in {1}".format(self.start,metadata.name))
+ if type(self.end) == type(""):
+ if self.end in metadata.symbols:
+ self.end = metadata.symbols[self.end]
+ else:
+ croak("can't resolve symbol {0} in {1}".format(self.end, metadata.name))
+ if self.end > len(metadata):
+ croak("{0} has no {1} revision".format(metadata.name, self.end))
def add_method(*args):
"Register a file into src control."
croak("%s is not registered." % arg)
else:
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
if ctx.is_empty():
ctx.start = metadata.tip().revno
if not comment:
for arg in ctx.args:
sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
for item in metadata:
if ctx.is_empty() or item.revno in ctx:
# Must allow enough room for revno and date
for arg in ctx.args:
sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
for item in metadata:
if ctx.is_empty() or item.revno in ctx:
sys.stdout.write("%-4d | %s\n%s" % (item.revno, item.date, item.log))
croak("checkout needs an empty or singleton revision spec")
for arg in ctx.args:
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
if ctx.is_empty():
ctx.start = metadata.tip().revno
revision = ""
ctx = CommandContext("cat", args)
for arg in ctx.args:
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
if ctx.is_empty():
ctx.select_all(metadata)
with backend.lifter(arg):
diffspec1 = diffspec2 = ""
if not ctx.is_empty():
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
diffspec1 += metadata.revno_to_rcs(ctx.start)
if ctx.is_range():
diffspec2 += metadata.revno_to_rcs(ctx.end)
metadata = History(arg)
# Semantics differs between tags and branches here
if legend == "tag":
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
if name in metadata.symbols:
croak("%s %s already set." % (legend, name))
if ctx.is_empty():
else:
perms = "100644"
metadata = History(arg)
- metadata.resolve(ctx)
+ ctx.resolve(metadata)
if ctx.is_empty():
ctx.select_all(metadata)
with backend.lifter(arg):