1. Ahmed Chaudhary
  2. thg

Commits

Adrian Buehlmann  committed 0278bb1 Merge

Merge with stable

  • Participants
  • Parent commits 686954b, ccba502
  • Branches default

Comments (0)

Files changed (16)

File icons/scalable/actions/hg-unbundle.svg

View file
Added
New image

File tortoisehg/hgqt/commit.py

View file
         # add our splitter where the docf used to be
         self.stwidget.split.addWidget(self.split)
         self.msgte = msgte
-        QShortcut(QKeySequence('Ctrl+Return'), self, self.commit).setContext(
-                  Qt.WidgetWithChildrenShortcut)
-        QShortcut(QKeySequence('Ctrl+Enter'), self, self.commit).setContext(
-                  Qt.WidgetWithChildrenShortcut)
+        if not self.hasmqbutton:
+            QShortcut(QKeySequence('Ctrl+Return'), self,
+                      self.commit).setContext(Qt.WidgetWithChildrenShortcut)
+            QShortcut(QKeySequence('Ctrl+Enter'), self,
+                      self.commit).setContext(Qt.WidgetWithChildrenShortcut)
 
     def mqSetupButton(self):
         ispatch = lambda r: 'qtip' in r.changectx('.').tags()
         mqtb.clicked.connect(self.mqPerformAction)
         self.mqButtonEnable.connect(mqtb.setEnabled)
         self.mqSetAction()
+        sc = QShortcut(QKeySequence('Ctrl+Return'), self, self.mqPerformAction)
+        sc.setContext(Qt.WidgetWithChildrenShortcut)
+        sc = QShortcut(QKeySequence('Ctrl+Enter'), self, self.mqPerformAction)
+        sc.setContext(Qt.WidgetWithChildrenShortcut)
         return mqtb
 
     @pyqtSlot(bool)

File tortoisehg/hgqt/filedata.py

View file
                     out = []
                     def getLog(_ui, srepo, opts):
                         _ui.pushbuffer()
-                        commands.log(_ui, srepo, **opts)
-                        return _ui.popbuffer()
+                        try:
+                            commands.log(_ui, srepo, **opts)
+                            logOutput = _ui.popbuffer()
+                        except error.ParseError, e:
+                            # Some mercurial versions have a bug that results in
+                            # saving a subrepo node id in the .hgsubstate file
+                            # which ends with a "+" character. If that is the
+                            # case, add a warning to the output, but try to
+                            # get the revision information anyway
+                            logOutput = ''
+                            for n, rev in enumerate(opts['rev']):
+                                if rev.endswith('+'):
+                                    logOutput += _('[WARNING] Invalid subrepo '
+                                        'revision ID:\n\t%s\n\n') % rev
+                                    opts['rev'][n] = rev[:-1]
+                            commands.log(_ui, srepo, **opts)
+                            logOutput += _ui.popbuffer()
+                        return logOutput
+                    
                     opts = {'date':None, 'user':None, 'rev':[sfrom]}
                     subabspath = os.path.join(repo.root, subrelpath)
                     missingsub = not os.path.isdir(subabspath)

File tortoisehg/hgqt/filelistmodel.py

View file
       'hg': 'hg',
       'git': 'thg-git-subrepo',
       'svn': 'thg-svn-subrepo',
+      'hgsubversion': 'thg-svn-subrepo',
       'empty': 'hg'
     }
     icOverlay = geticon('thg-subrepo')
     Model used for listing (modified) files of a given Hg revision
     """
     showMessage = pyqtSignal(QString)
-    
+
     def __init__(self, parent):
         QAbstractTableModel.__init__(self, parent)
         self._boldfont = parent.font()

File tortoisehg/hgqt/fileview.py

View file
     def setMode(self, action):
         'One of the mode toolbar buttons has been toggled'
         mode = action._mode
+        self._lostMode = mode
         if mode != self._mode:
             self._mode = mode
             self.actionNextDiff.setEnabled(False)
         if isinstance(filename, (unicode, QString)):
             filename = hglib.fromunicode(filename)
             status = hglib.fromunicode(status)
-        if self._filename == filename:
+        if filename and self._filename == filename:
             # Get the last visible line to restore it after reloading the editor
             lastScrollPosition = self.sci.firstVisibleLine()
         else:
             pass
 
     def _updateannotation(self, ctx, filename):
-        assert ctx.rev() is not None
+        if ctx.rev() is None:
+            return
         wsub, filename, ctx = hglib.getDeepestSubrepoContainingFile(filename, ctx)
         assert filename in ctx
         self.ctx = ctx

File tortoisehg/hgqt/manifestdialog.py

View file
             return
         self._rev = rev
         path = self.path
+        self.revChanged.emit(rev)
         self._setupmodel()
         ctx = self._repo[rev]
         if path and path in ctx:
     
     @pyqtSlot()
     def _updatecontent(self):
-        if True:
-            self.displayFile()
-        else:
-            self._fileview.setContext(self._repo[self._rev])
-            self._fileview.displayFile(self.path, self.status)
+        self.displayFile()
 
     @pyqtSlot()
     def _emitPathChanged(self):

File tortoisehg/hgqt/manifestmodel.py

View file
 
         self._repo = repo
         self._rev = rev
-        self._subinfo = {'substate': [], 'ctx': None}
+        self._subinfo = {}
 
         assert util.all(c in 'MARSC' for c in statusfilter)
         self._statusfilter = statusfilter
         if not path:
             return None, path
         for subpath in sorted(self._subinfo.keys())[::-1]:
-            if path.startswith(subpath):
+            if path.startswith(subpath + '/'):
                 return self._subinfo[subpath]['ctx'], path[len(subpath)+1:]
         return None, path
 
                         toprelpath = '/'.join([toproot, path])
                     else:
                         toprelpath = path
+                    toprelpath = util.pconvert(toprelpath)
                     self._subinfo[toprelpath] = \
                         {'substate': substate, 'ctx': None}
                     srev = substate[1]
             return roote
 
         # Clear the _subinfo
-        self._subinfo = {'substate': [], 'ctx': None}
+        self._subinfo = {}
         roote = _Entry()
         ctx = self._repo[self._rev]
 

File tortoisehg/hgqt/mq.py

View file
         self.msgSelectCombo.activated.connect(self.onMessageSelected)
         self.newCheckBox.toggled.connect(self.onNewModeToggled)
         self.qnewOrRefreshBtn.clicked.connect(self.onQNewOrQRefresh)
+        QShortcut(QKeySequence('Ctrl+Return'), self, self.onQNewOrQRefresh)
+        QShortcut(QKeySequence('Ctrl+Enter'), self, self.onQNewOrQRefresh)
 
         self.repo.configChanged.connect(self.onConfigChanged)
         self.repo.repositoryChanged.connect(self.onRepositoryChanged)

File tortoisehg/hgqt/repofilter.py

View file
         self._branchLabel.setMenu(self._branchMenu)
 
         self._branchCombo = QComboBox()
+        self._branchCombo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
         self._branchCombo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
-        self._branchCombo.setMinimumSize(100,0)
         self._branchCombo.currentIndexChanged.connect(self._emitBranchChanged)
         self._branchReloading = False
 
         self._branchCombo.addItem(self._allBranchesLabel)
         for branch in branches:
             self._branchCombo.addItem(branch)
+            self._branchCombo.setItemData(self._branchCombo.count() - 1, branch, Qt.ToolTipRole)
         self._branchLabel.setEnabled(self.filterEnabled and len(branches) > 1)
         self._branchCombo.setEnabled(self.filterEnabled and len(branches) > 1)
         self._branchReloading = False

File tortoisehg/hgqt/reporegistry.py

View file
     def addRepo(self, root):
         'workbench has opened a new repowidget, ensure it is in the registry'
         m = self.tview.model()
-        it = m.getRepoItem(root)
+        it = m.getRepoItem(root, lookForSubrepos=True)
         if it == None:
             m.addRepo(None, root, -1)
             self.updateSettingsFile()
         if self._activeTabRepo:
             self._activeTabRepo.setActive(False)
         m = self.tview.model()
-        it = m.getRepoItem(root)
+        it = m.getRepoItem(root, lookForSubrepos=True)
         if it:
             self._activeTabRepo = it
             it.setActive(True)
         for root in self.selitem.internalPointer().childRoots():
             self.openRepo.emit(hglib.tounicode(root), False)
 
-    def open(self):
+    def open(self, root=None):
         'open context menu action, open repowidget unconditionally'
-        root = self.selitem.internalPointer().rootpath()
-        repotype = self.selitem.internalPointer().repotype()
+        if root is None:
+            root = self.selitem.internalPointer().rootpath()
+            repotype = self.selitem.internalPointer().repotype()
+        else:
+            root = hglib.fromunicode(root)
+            if os.path.exists(os.path.join(root, '.hg')):
+                repotype = 'hg'
+            else:
+                repotype = 'unknown'
         if repotype == 'hg':
             self.openRepo.emit(hglib.tounicode(root), False)
         else:

File tortoisehg/hgqt/repotreeitem.py

View file
     def details(self):
         return ''
 
-    def getRepoItem(self, reporoot):
+    def getRepoItem(self, reporoot, lookForSubrepos=False):
         for c in self.childs:
-            ri = c.getRepoItem(reporoot)
+            ri = c.getRepoItem(reporoot, lookForSubrepos=lookForSubrepos)
             if ri:
                 return ri
         return None
     def details(self):
         return _('Local Repository %s') % hglib.tounicode(self._root)
 
-    def getRepoItem(self, reporoot):
+    def getRepoItem(self, reporoot, lookForSubrepos=False):
         reporoot = os.path.normcase(reporoot)
         if (reporoot == os.path.normcase(self._root)):
             return self
+        if lookForSubrepos:
+            return super(RepoItem, self).getRepoItem(reporoot, lookForSubrepos)
         return None
 
     def appendSubrepos(self, repo=None):

File tortoisehg/hgqt/repotreemodel.py

View file
         if t == QXmlStreamReader.StartElement and xr.name() == 'repo':
             yield undumpObject(xr)
 
-def getRepoItemList(root):
-    if isinstance(root, RepoItem):
+def getRepoItemList(root, includeSubRepos=False):
+    if not includeSubRepos and isinstance(root, RepoItem):
         return [root]
     if not isinstance(root, RepoTreeItem):
         return []
     return reduce(lambda a, b: a + b,
-                  (getRepoItemList(c) for c in root.childs), [])
+                  (getRepoItemList(c, includeSubRepos=includeSubRepos) \
+                    for c in root.childs), [])
 
 
 class RepoTreeModel(QAbstractItemModel):
                     '<br><br><i>%s</i>')  %
                     (root, "<br>".join(invalidRepoList)))
 
-    def getRepoItem(self, reporoot):
-        return self.rootItem.getRepoItem(reporoot)
+    def getRepoItem(self, reporoot, lookForSubrepos=False):
+        return self.rootItem.getRepoItem(os.path.normcase(reporoot),
+                    lookForSubrepos=lookForSubrepos)
 
     def addGroup(self, name):
         ri = self.rootItem

File tortoisehg/hgqt/status.py

View file
                 else:
                     # status and commit only pre-check MAR files
                     precheckfn = lambda x: x < 4
-                m = hglib.match(self.repo, self.pats)
+                m = hglib.match(self.repo[None], self.pats)
                 status = self.repo.status(match=m, **stopts)
                 # Record all matched files as initially checked
                 for i, stat in enumerate(StatusType.preferredOrder):

File tortoisehg/hgqt/sync.py

View file
             self.opbuttons.append(a)
             tb.addAction(a)
         tb.addSeparator()
+        newaction(_('Unbundle'),
+             'hg-unbundle', self.unbundle)
+        tb.addSeparator()
         self.stopAction = a = QAction(self)
         a.setToolTip(_('Stop current operation'))
         a.setIcon(qtlib.geticon('process-stop'))
                     '--template', '{node}\n']
         self.run(cmdline, ('force', 'branch', 'rev'))
 
+    def unbundle(self):
+        caption = _("Select bundle file")
+        _FILE_FILTER = "%s" % _("Bundle files (*.hg)")
+        bundlefile = QFileDialog.getOpenFileName(parent=self, caption=caption,
+                                    directory=self.repo.root,
+                                    filter=_FILE_FILTER)
+        if bundlefile:
+            # Select the "Local" scheme
+            self.schemecombo.setCurrentIndex(0)
+            # Set the pull source to the selected bundle file
+            self.pathentry.setText(bundlefile)
+            # Execute the incomming command, which will show the revisions in
+            # the bundle, and let the user accept or reject them
+            self.inclicked()
+
     @pyqtSlot(QString)
     def removeAlias(self, alias):
         alias = hglib.fromunicode(alias)

File tortoisehg/hgqt/workbench.py

View file
 
         self._setupActions()
 
+        self.restoreSettings()
         self.repoTabChanged()
-        self.restoreSettings()
         self.setAcceptDrops(True)
         if os.name == 'nt':
             # Allow CTRL+Q to close Workbench on Windows
         # Create the actions that will be displayed on the context menu
         self.createActions()
         self.lastClosedRepoRootList = []
-
+        
     def setupUi(self):
         desktopgeom = qApp.desktop().availableGeometry()
         self.resize(desktopgeom.size() * 0.8)
         self.menuView.addAction(a)
 
         newseparator(menu='view')
-        self.menuViewregistryopts = self.menuView.addMenu('Repository Registry Options')
+        self.menuViewregistryopts = self.menuView.addMenu(_('Repository Registry Options'))
         self.actionShowPaths = \
         newaction(_("Show Paths"), self.reporegistry.showPaths,
                   checkable=True, menu='viewregistryopts')

File tortoisehg/util/cachethg.py

View file
     tc1 = GetTickCount()
 
     try:
-        matcher = hglib.match(repo, [pdir])
+        matcher = hglib.match(repo[None], [pdir])
         repostate = repo.status(match=matcher, ignored=True,
                         clean=True, unknown=True)
     except util.Abort, inst: