def addRepo(self, group, root, row=-1): grp = group if grp == None: grp = self.allreposIndex() rgi = grp.internalPointer() if row < 0: row = rgi.childCount() # make sure all paths are properly normalized root = os.path.normpath(root) # Check whether the repo that we are adding is a subrepo # This check could be expensive, particularly for network repositories # Thus, only perform this check on network repos if the showNetworkSubrepos # flag is set itemIsSubrepo = False if self.showNetworkSubrepos \ or not paths.netdrive_status(root): outerrepopath = paths.find_root(os.path.dirname(root)) if outerrepopath: # Check whether repo we are adding is a subrepo of # its containing (outer) repo # This check is currently quite imperfect, since it # only checks the current repo revision outerrepo = hg.repository(ui.ui(), path=outerrepopath) relroot = util.normpath(root[len(outerrepopath) + 1:]) if relroot in outerrepo['.'].substate: itemIsSubrepo = True self.beginInsertRows(grp, row, row) if itemIsSubrepo: ri = SubrepoItem(root) else: ri = RepoItem(root) rgi.insertChild(row, ri) if not self.showSubrepos \ or (not self.showNetworkSubrepos and paths.netdrive_status(root)): self.endInsertRows() return invalidRepoList = ri.appendSubrepos() self.endInsertRows() if invalidRepoList: if invalidRepoList[0] == root: qtlib.WarningMsgBox( _('Could not get subrepository list'), _('It was not possible to get the subrepository list for ' 'the repository in:<br><br><i>%s</i>') % root) else: qtlib.WarningMsgBox( _('Could not open some subrepositories'), _('It was not possible to fully load the subrepository ' 'list for the repository in:<br><br><i>%s</i><br><br>' 'The following subrepositories may be missing, broken or ' 'on an inconsistent state and cannot be accessed:' '<br><br><i>%s</i>') % (root, "<br>".join(invalidRepoList)))
def addRepo(self, group, root, row=-1): grp = group if grp == None: grp = self.allreposIndex() rgi = grp.internalPointer() if row < 0: row = rgi.childCount() # make sure all paths are properly normalized root = os.path.normpath(root) # Check whether the repo that we are adding is a subrepo # This check could be expensive, particularly for network repositories # Thus, only perform this check on network repos if the showNetworkSubrepos # flag is set itemIsSubrepo = False if self.showNetworkSubrepos \ or not paths.netdrive_status(root): outerrepopath = paths.find_root(os.path.dirname(root)) if outerrepopath: # Check whether repo we are adding is a subrepo of # its containing (outer) repo # This check is currently quite imperfect, since it # only checks the current repo revision outerrepo = hg.repository(ui.ui(), path=outerrepopath) relroot = util.normpath(root[len(outerrepopath)+1:]) if relroot in outerrepo['.'].substate: itemIsSubrepo = True self.beginInsertRows(grp, row, row) if itemIsSubrepo: ri = SubrepoItem(root) else: ri = RepoItem(root) rgi.insertChild(row, ri) if not self.showSubrepos \ or (not self.showNetworkSubrepos and paths.netdrive_status(root)): self.endInsertRows() return invalidRepoList = ri.appendSubrepos() self.endInsertRows() if invalidRepoList: if invalidRepoList[0] == root: qtlib.WarningMsgBox(_('Could not get subrepository list'), _('It was not possible to get the subrepository list for ' 'the repository in:<br><br><i>%s</i>') % root) else: qtlib.WarningMsgBox(_('Could not open some subrepositories'), _('It was not possible to fully load the subrepository ' 'list for the repository in:<br><br><i>%s</i><br><br>' 'The following subrepositories may be missing, broken or ' 'on an inconsistent state and cannot be accessed:' '<br><br><i>%s</i>') % (root, "<br>".join(invalidRepoList)))
def addRepo(self, group, root, row=-1): grp = group if grp == None: grp = self.allreposIndex() rgi = grp.internalPointer() if row < 0: row = rgi.childCount() # Is the root of the repo that we want to add a subrepo contained # within a repo or subrepo? If so, assume it is an hg subrepo itemIsSubrepo = not paths.find_root(os.path.dirname(root)) is None self.beginInsertRows(grp, row, row) if itemIsSubrepo: ri = SubrepoItem(root) else: ri = RepoItem(root) rgi.insertChild(row, ri) if not self.showSubrepos \ or (not self.showNetworkSubrepos and paths.netdrive_status(root)): self.endInsertRows() return invalidRepoList = ri.appendSubrepos() self.endInsertRows() if invalidRepoList: if invalidRepoList[0] == root: qtlib.WarningMsgBox(_('Could not get subrepository list'), _('It was not possible to get the subrepository list for ' 'the repository in:<br><br><i>%s</i>') % root) else: qtlib.WarningMsgBox(_('Could not open some subrepositories'), _('It was not possible to fully load the subrepository ' 'list for the repository in:<br><br><i>%s</i><br><br>' 'The following subrepositories may be missing, broken or ' 'on an inconsistent state and cannot be accessed:' '<br><br><i>%s</i>') % (root, "<br>".join(invalidRepoList)))