Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.3, 2.0.4, and 2.0.5

stable fileview: Improve description of subrepo changes

Subrepos can be shown as new, initialized, changed and removed. New, initialized
and changed subrepos can also be described as dirty in the working directory.

Changeset d2bb2cb704ce

Parent 462bed1ecf51

by Angel Ezquerra

Changes to one file · Browse files at d2bb2cb704ce Showing diff from parent 462bed1ecf51 Diff from another changeset...

 
611
612
613
 
614
 
 
 
 
615
 
616
617
618
 
621
622
623
624
625
 
 
 
 
 
626
627
628
629
 
 
 
 
 
 
 
 
 
 
630
631
632
633
634
 
635
636
637
 
644
645
646
647
 
 
648
649
650
651
652
653
654
655
 
 
 
 
 
 
656
 
 
657
658
659
 
 
 
660
661
662
 
611
612
613
614
615
616
617
618
619
620
621
622
623
624
 
627
628
629
 
 
630
631
632
633
634
635
636
 
 
637
638
639
640
641
642
643
644
645
646
647
 
 
 
 
648
649
650
651
 
658
659
660
 
661
662
663
 
 
 
 
 
 
 
664
665
666
667
668
669
670
671
672
673
 
 
674
675
676
677
678
679
@@ -611,8 +611,14 @@
  out = []   opts = {'date':None, 'user':None, 'rev':[sfrom]}   if not sfrom: + sstatedesc = 'new'   out.append(_('Subrepo initialized to revision:') + u'\n\n') + elif not sto: + sstatedesc = 'removed' + out.append(_('Subrepo removed from repository.') + u'\n\n') + return out, sstatedesc   else: + sstatedesc = 'changed'   out.append(_('Revision has changed from:') + u'\n\n')   _ui.pushbuffer()   commands.log(_ui, srepo, **opts) @@ -621,17 +627,25 @@
  opts['rev'] = [sto]   _ui.pushbuffer()   commands.log(_ui, srepo, **opts) - out.append(hglib.tounicode(_ui.popbuffer())) - return out + stolog = _ui.popbuffer() + if not stolog: + stolog = _('Initial revision') + out.append(hglib.tounicode(stolog)) + return out, sstatedesc     srev = ctx.substate.get(wfile, subrepo.nullstate)[1] - sub = ctx.sub(wfile) - if isinstance(sub, subrepo.hgsubrepo): + try: + 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 + except (util.Abort), e: + sub = ctx.p1().sub(wfile)   srepo = sub._repo - sactual = srepo['.'].hex() - else: - self.error = _('Not a Mercurial subrepo, not previewable') - return + sactual = ''   out = []   _ui = uimod.ui()   _ui.pushbuffer() @@ -644,19 +658,22 @@
  sstatedesc = 'changed'   if ctx.rev() is not None:   sparent = ctx.p1().substate.get(wfile, subrepo.nullstate)[1] - out += genSubrepoRevChangedDescription(sparent, srev) + subrepochange, sstatedesc = genSubrepoRevChangedDescription(sparent, srev) + out += subrepochange   else: - sstatedesc = 'dirty' - if srev == '': - sstatedesc = 'new' - out.append(_('New subrepository') + u'\n\n') - elif srev != sactual: - sstatedesc = 'changed' - out += genSubrepoRevChangedDescription(srev, sactual) + if srev != sactual: + subrepochange, sstatedesc = \ + genSubrepoRevChangedDescription(srev, sactual) + out += subrepochange + if data: + sstatedesc += ' and dirty'   self.contents = u''.join(out) + if not sactual: + sstatedesc = 'removed'   self.flabel += _(' <i>(is a %s sub-repository)</i>' % sstatedesc) - lbl = u' <a href="subrepo:%s">%s...</a>' - self.flabel += lbl % (hglib.tounicode(srepo.root), _('open')) + if sactual: + lbl = u' <a href="subrepo:%s">%s...</a>' + 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))