Commits

Anonymous committed 24f2385

reporegistry: mark .hgsub file for add when it is created

  • Participants
  • Parent commits 3758eb5
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/reporegistry.py

 
 import os
 
-from mercurial import error, hg, ui, util
+from mercurial import commands, error, hg, ui, util
 
 from tortoisehg.util import hglib, paths
 from tortoisehg.hgqt.i18n import _
 
                     # Read the current .hgsub file contents
                     lines = []
-                    if os.path.exists(repo.wjoin('.hgsub')):
+                    hasHgsub = os.path.exists(repo.wjoin('.hgsub'))
+                    if hasHgsub:
                         try:
                             fsub = repo.wopener('.hgsub', 'r')
                             lines = fsub.readlines()
                         fsub.write(linesep.join(lines))
                         fsub.close()
 
+                        if not hasHgsub:
+                            commands.add(ui.ui(), repo, '.hgsub')
+
                         qtlib.InfoMsgBox(
                             _('Subrepo added to .hgsub file'),
                             _('The selected subrepo:<br><br><i>%s</i><br><br>'