# HG changeset patch
# User Antonio Muci <
a....@inwind.it>
# Date 1686161231 -7200
# Wed Jun 07 20:07:11 2023 +0200
# Node ID 8d6215213b256d401056118ba2fde989b271e84e
# Parent dec41ba937da893e81d6ad49d03e820e85c1094d
reporegistry: pop up if the repo is already in the registry or if it is not a repo
Fixes #5894 (
https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/5894)
diff --git a/tortoisehg/hgqt/reporegistry.py b/tortoisehg/hgqt/reporegistry.py
--- a/tortoisehg/hgqt/reporegistry.py
+++ b/tortoisehg/hgqt/reporegistry.py
@@ -584,9 +584,21 @@ class RepoRegistryView(QDockWidget):
m = self.tview.model()
assert m is not None
uroot = paths.find_root(path)
- if uroot and not m.isKnownRepoRoot(uroot, standalone=True):
- index = m.addRepo(uroot, parent=self.tview.currentIndex())
- self._scanAddedRepo(index)
+ if not uroot:
+ qtlib.WarningMsgBox(
+ _('Repository not found'),
+ _('The selected directory (%s) does not appear to be a mercurial repository' % path),
+ parent=self)
+ return
+ if m.isKnownRepoRoot(uroot, standalone=True):
+ qtlib.InfoMsgBox(
+ _('Repository already in registry'),
+ _('The selected repository (%s) is already present in the registry. Not adding it again.' % uroot),
+ parent=self)
+ return
+ # this is a new mercurial repo, let's add it to the registry
+ index = m.addRepo(uroot, parent=self.tview.currentIndex())
+ self._scanAddedRepo(index)
def addSubrepo(self):
'menu action handler for adding a new subrepository'