Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable fileview: use wctx.sub() to generate the subrepo instance

Changeset cbbbff2073ff

Parent 13a3819f604b

by Steve Borho

Changes to one file · Browse files at cbbbff2073ff Showing diff from parent 13a3819f604b Diff from another changeset...

 
572
573
574
 
 
 
 
 
 
 
 
575
576
577
578
579
580
581
582
583
 
601
602
603
604
605
606
 
 
 
 
607
608
609
 
572
573
574
575
576
577
578
579
580
581
582
583
584
 
 
 
 
585
586
587
 
605
606
607
 
 
 
608
609
610
611
612
613
614
@@ -572,12 +572,16 @@
  try:   from mercurial import subrepo, commands   assert(ctx.rev() is None) + srev = ctx.substate.get(wfile, subrepo.nullstate)[1] + sub = ctx.sub(wfile) + if isinstance(sub, subrepo.hgsubrepo): + srepo = sub._repo + sactual = srepo['.'].hex() + else: + self.error = _('Not a Mercurial subrepo, not previewable') + return   out = []   _ui = uimod.ui() - sroot = repo.wjoin(wfile) - srepo = hg.repository(_ui, path=sroot) - srev = ctx.substate.get(wfile, subrepo.nullstate)[1] - sactual = srepo['.'].hex()   _ui.pushbuffer()   commands.status(_ui, srepo)   data = _ui.popbuffer() @@ -601,9 +605,10 @@
  self.contents = u''.join(out)   self.flabel += _(' <i>(is a dirty sub-repository)</i>')   lbl = u' <a href="subrepo:%s">%s...</a>' - self.flabel += lbl % (hglib.tounicode(sroot), _('open')) - except (error.RepoError, util.Abort), e: - self.error = _('Not a Mercurial subrepo, not previewable') + self.flabel += lbl % (hglib.tounicode(srepo.root), _('open')) + except (EnvironmentError, error.RepoError, util.Abort), e: + self.error = _('Error previewing subrepo: %s') % \ + hglib.tounicode(str(e))   return     # TODO: elif check if a subdirectory (for manifest tool)