mercurial/cmdutil.py
changeset 25119 49c583ca48c4
parent 25100 d6e7ac651973
child 25147 fb7b9a765bb9
equal deleted inserted replaced
25118:e632a2429982 25119:49c583ca48c4
   448 
   448 
   449 def openrevlog(repo, cmd, file_, opts):
   449 def openrevlog(repo, cmd, file_, opts):
   450     """opens the changelog, manifest, a filelog or a given revlog"""
   450     """opens the changelog, manifest, a filelog or a given revlog"""
   451     cl = opts['changelog']
   451     cl = opts['changelog']
   452     mf = opts['manifest']
   452     mf = opts['manifest']
       
   453     dir = opts['dir']
   453     msg = None
   454     msg = None
   454     if cl and mf:
   455     if cl and mf:
   455         msg = _('cannot specify --changelog and --manifest at the same time')
   456         msg = _('cannot specify --changelog and --manifest at the same time')
       
   457     elif cl and dir:
       
   458         msg = _('cannot specify --changelog and --dir at the same time')
   456     elif cl or mf:
   459     elif cl or mf:
   457         if file_:
   460         if file_:
   458             msg = _('cannot specify filename with --changelog or --manifest')
   461             msg = _('cannot specify filename with --changelog or --manifest')
   459         elif not repo:
   462         elif not repo:
   460             msg = _('cannot specify --changelog or --manifest '
   463             msg = _('cannot specify --changelog or --manifest or --dir '
   461                     'without a repository')
   464                     'without a repository')
   462     if msg:
   465     if msg:
   463         raise util.Abort(msg)
   466         raise util.Abort(msg)
   464 
   467 
   465     r = None
   468     r = None
   466     if repo:
   469     if repo:
   467         if cl:
   470         if cl:
   468             r = repo.unfiltered().changelog
   471             r = repo.unfiltered().changelog
       
   472         elif dir:
       
   473             if 'treemanifest' not in repo.requirements:
       
   474                 raise util.Abort(_("--dir can only be used on repos with "
       
   475                                    "treemanifest enabled"))
       
   476             dirlog = repo.dirlog(file_)
       
   477             if len(dirlog):
       
   478                 r = dirlog
   469         elif mf:
   479         elif mf:
   470             r = repo.manifest
   480             r = repo.manifest
   471         elif file_:
   481         elif file_:
   472             filelog = repo.file(file_)
   482             filelog = repo.file(file_)
   473             if len(filelog):
   483             if len(filelog):