Commits

Anonymous committed 58fd62a

fileview: show target revision first for modified subrepos

This is a port to stable of 2f730e81b07aef458beeeb8b227c30f949b46732, whose
description was as follows:

Until now when showing subrepo change information on the revision history
widget we were showing the source ("From:") revision first, followed by the
target ("To:") revision. If the size of the revision history widget was small
the user would only see the "From" information, which is less important thatn
the "To" information.

This patch changes the order in which that info is shown.
As a side effect, is improves the handling of invalid subrepos a bit, although
further improvements will be made on a later patch.

  • Participants
  • Parent commits 150a847
  • Branches stable

Comments (0)

Files changed (1)

tortoisehg/hgqt/fileview.py

                     opts = {'date':None, 'user':None, 'rev':[sfrom]}
                     subabspath = os.path.join(repo.root, subrelpath)
                     missingsub = not os.path.isdir(subabspath)
+                    sfromlog = ''
                     def isinitialrevision(rev):
                         return all([el == '0' for el in rev])
                     if isinitialrevision(sfrom):
                     else:
                         sstatedesc = 'changed'
 
-                        out.append(_('Revision has changed from:') + u'\n\n')
+                        out.append(_('Revision has changed to:') + u'\n\n')
                         if missingsub:
-                            out.append(hglib.tounicode(_('changeset: %s') % sfrom + '\n'))
+                            sfromlog = _('changeset: %s') % sfrom + u'\n\n'
                         else:
                             _ui.pushbuffer()
                             commands.log(_ui, srepo, **opts)
-                            out.append(hglib.tounicode(_ui.popbuffer()))
+                            sfromlog = hglib.tounicode(_ui.popbuffer())
+                        if sfromlog:
+                            sfromlog = _('From:') + u'\n' + sfromlog
 
-                        out.append(_('To:') + u'\n')
                     if missingsub:
                         stolog = _('changeset: %s') % sto + '\n\n'
-                        stolog += _('Subrepository not found in working directory.') + '\n'
-                        stolog += _('Further subrepository revision information cannot be retrieved.') + '\n'
+                        sfromlog += _('Subrepository not found in working directory.') + '\n'
+                        sfromlog += _('Further subrepository revision information cannot be retrieved.') + '\n'
                     else:
                         opts['rev'] = [sto]
                         _ui.pushbuffer()
                         stolog = _ui.popbuffer()
 
                     if not stolog:
-                        stolog = _('Initial revision')
+                        stolog = _('Initial revision') + u'\n'
                     out.append(hglib.tounicode(stolog))
 
+                    if sfromlog:
+                        out.append(hglib.tounicode(sfromlog))
+
                     return out, sstatedesc
 
                 srev = ctx.substate.get(wfile, subrepo.nullstate)[1]