--- a/mercurial/cmdutil.py Wed Nov 15 15:51:58 2006 -0600
+++ b/mercurial/cmdutil.py Wed Nov 15 15:51:58 2006 -0600
@@ -238,18 +238,19 @@
class changeset_printer(object):
'''show changeset information when templating not requested.'''
- def __init__(self, ui, repo, patch, buffered):
+ def __init__(self, ui, repo, patch, brinfo, buffered):
self.ui = ui
self.repo = repo
self.buffered = buffered
self.patch = patch
+ self.brinfo = brinfo
if buffered:
self.ui = uibuffer(ui)
def flush(self, rev):
return self.ui.flush(rev)
- def show(self, rev=0, changenode=None, brinfo=None, copies=None):
+ def show(self, rev=0, changenode=None, copies=None):
'''show a single changeset or file revision'''
if self.buffered:
self.ui.mark(rev)
@@ -288,9 +289,10 @@
for parent in parents:
self.ui.write(_("parent: %d:%s\n") % parent)
- if brinfo and changenode in brinfo:
- br = brinfo[changenode]
- self.ui.write(_("branch: %s\n") % " ".join(br))
+ if self.brinfo:
+ br = self.repo.branchlookup([changenode])
+ if br:
+ self.ui.write(_("branch: %s\n") % " ".join(br[changenode]))
if self.ui.debugflag:
self.ui.write(_("manifest: %d:%s\n") %
@@ -339,8 +341,8 @@
class changeset_templater(changeset_printer):
'''format changeset information.'''
- def __init__(self, ui, repo, patch, mapfile, buffered):
- changeset_printer.__init__(self, ui, repo, patch, buffered)
+ def __init__(self, ui, repo, patch, brinfo, mapfile, buffered):
+ changeset_printer.__init__(self, ui, repo, patch, brinfo, buffered)
self.t = templater.templater(mapfile, templater.common_filters,
cache={'parent': '{rev}:{node|short} ',
'manifest': '{rev}:{node|short}',
@@ -350,7 +352,7 @@
'''set template string to use'''
self.t.cache['changeset'] = t
- def show(self, rev=0, changenode=None, brinfo=None, copies=[], **props):
+ def show(self, rev=0, changenode=None, copies=[], **props):
'''show a single changeset or file revision'''
if self.buffered:
self.ui.mark(rev)
@@ -428,9 +430,11 @@
if branch:
return showlist('branch', [branch], plural='branches', **args)
# add old style branches if requested
- if brinfo and changenode in brinfo:
- return showlist('branch', brinfo[changenode],
- plural='branches', **args)
+ if self.brinfo:
+ br = self.repo.branchlookup([changenode])
+ if changenode in br:
+ return showlist('branch', br[changenode],
+ plural='branches', **args)
def showparents(**args):
parents = [[('rev', log.rev(p)), ('node', hex(p))]
@@ -555,6 +559,11 @@
"""
# options
patch = opts.get('patch')
+ br = None
+ if opts.get('branches'):
+ ui.warn(_("the --branches option is deprecated, "
+ "please use 'hg branches' instead\n"))
+ br = True
tmpl = opts.get('template')
mapfile = None
if tmpl:
@@ -576,10 +585,10 @@
or templater.templatepath(mapfile))
if mapname: mapfile = mapname
try:
- t = changeset_templater(ui, repo, patch, mapfile, buffered)
+ t = changeset_templater(ui, repo, patch, br, mapfile, buffered)
except SyntaxError, inst:
raise util.Abort(inst.args[0])
if tmpl: t.use_template(tmpl)
return t
- return changeset_printer(ui, repo, patch, buffered)
+ return changeset_printer(ui, repo, patch, br, buffered)
--- a/mercurial/commands.py Wed Nov 15 15:51:58 2006 -0600
+++ b/mercurial/commands.py Wed Nov 15 15:51:58 2006 -0600
@@ -703,7 +703,7 @@
# create the right base
# XXX: nodesbetween / changegroup* should be "fixed" instead
o = []
- has = {nullid: None}
+ has = {nullid: None}
for n in base:
has.update(repo.changelog.reachable(n))
if revs:
@@ -1434,14 +1434,9 @@
heads = repo.heads(repo.lookup(opts['rev']))
else:
heads = repo.heads()
- br = None
- if opts['branches']:
- ui.warn(_("the --branches option is deprecated, "
- "please use 'hg branches' instead\n"))
- br = repo.branchlookup(heads)
displayer = cmdutil.show_changeset(ui, repo, opts)
for n in heads:
- displayer.show(changenode=n, brinfo=br)
+ displayer.show(changenode=n)
def identify(ui, repo):
"""print information about the working copy
@@ -1672,10 +1667,6 @@
getchange = util.cachefunc(lambda r:repo.changectx(r).changeset())
changeiter, matchfn = walkchangerevs(ui, repo, pats, getchange, opts)
- if opts['branches']:
- ui.warn(_("the --branches option is deprecated, "
- "please use 'hg branches' instead\n"))
-
if opts['limit']:
try:
limit = int(opts['limit'])
@@ -1745,10 +1736,6 @@
if miss:
continue
- br = None
- if opts['branches']:
- br = repo.branchlookup([repo.changelog.node(rev)])
-
copies = []
if opts.get('copies') and rev:
mf = getchange(rev)[0]
@@ -1756,7 +1743,7 @@
rename = getrenamed(fn, rev, mf)
if rename:
copies.append((fn, rename[0]))
- displayer.show(rev, changenode, brinfo=br, copies=copies)
+ displayer.show(rev, changenode, copies=copies)
elif st == 'iter':
if count == limit: break
if displayer.flush(rev):
@@ -1850,7 +1837,7 @@
continue
displayer.show(changenode=n)
-def parents(ui, repo, file_=None, rev=None, branches=None, **opts):
+def parents(ui, repo, file_=None, rev=None, **opts):
"""show the parents of the working dir or revision
Print the working directory's parent revisions.
@@ -1875,15 +1862,10 @@
else:
p = repo.dirstate.parents()
- br = None
- if branches is not None:
- ui.warn(_("the --branches option is deprecated, "
- "please use 'hg branches' instead\n"))
- br = repo.branchlookup(p)
displayer = cmdutil.show_changeset(ui, repo, opts)
for n in p:
if n != nullid:
- displayer.show(changenode=n, brinfo=br)
+ displayer.show(changenode=n)
def paths(ui, repo, search=None):
"""show definition of symbolic path names
@@ -2501,13 +2483,7 @@
Show the tip revision.
"""
- n = repo.changelog.tip()
- br = None
- if opts['branches']:
- ui.warn(_("the --branches option is deprecated, "
- "please use 'hg branches' instead\n"))
- br = repo.branchlookup([n])
- cmdutil.show_changeset(ui, repo, opts).show(changenode=n, brinfo=br)
+ cmdutil.show_changeset(ui, repo, opts).show(repo.changelog.count()-1)
def unbundle(ui, repo, fname, **opts):
"""apply a changegroup file
@@ -2574,8 +2550,7 @@
if len(found) > 1:
repo.ui.warn(_("Found multiple heads for %s\n") % branch)
for x in found:
- cmdutil.show_changeset(ui, repo, {}).show(
- changenode=x, brinfo=br)
+ cmdutil.show_changeset(ui, repo, {}).show(changenode=x)
raise util.Abort("")
if len(found) == 1:
node = found[0]