Example #1
0
 def editSelected(self, path, rev, line):
     """Open editor to show the specified file"""
     path = hglib.fromunicode(path)
     base = visdiff.snapshot(self.repo, [path], self.repo[rev])[0]
     files = [os.path.join(base, path)]
     pattern = hglib.fromunicode(self._lastSearch[0])
     qtlib.editfiles(self.repo, files, line, pattern, self)
Example #2
0
 def editSelected(self, path, rev, line):
     """Open editor to show the specified file"""
     path = hglib.fromunicode(path)
     base = visdiff.snapshot(self.repo, [path], self.repo[rev])[0]
     files = [os.path.join(base, path)]
     pattern = hglib.fromunicode(self._lastSearch[0])
     qtlib.editfiles(self.repo, files, line, pattern, self)
Example #3
0
 def _editFileAt(self, fds, ctx):
     repo = self._repoAgentFor(fds[0]).rawRepo()
     filenames = _lcanonpaths(fds)
     base, _ = visdiff.snapshot(repo, filenames, ctx)
     files = [os.path.join(base, filename)
              for filename in filenames]
     qtlib.editfiles(repo, files, parent=self.parent())
Example #4
0
def _openineditor(repo, path, rev, line=None, pattern=None, parent=None):
    """Open editor to show the specified file [unicode]"""
    path = hglib.fromunicode(path)
    pattern = hglib.fromunicode(pattern)
    base = visdiff.snapshot(repo, [path], repo[rev])[0]
    files = [os.path.join(base, path)]
    qtlib.editfiles(repo, files, line, pattern, parent=self)
Example #5
0
 def preparefiles():
     files = [self.filePath(i) for i in indexes if i.isValid()]
     if self._rev is not None:
         base, _fns = visdiff.snapshot(self._repo, files,
                                       self._repo[self._rev])
     else:  # working copy
         base = self._repo.root
     return iter(os.path.join(base, e) for e in files)
Example #6
0
 def preparefiles():
     files = [self.filePath(i) for i in indexes if i.isValid()]
     if self._rev is not None:
         base, _fns = visdiff.snapshot(self._repo, files,
                                       self._repo[self._rev])
     else:  # working copy
         base = self._repo.root
     return iter(os.path.join(base, e) for e in files)
Example #7
0
 def editfile(self):
     if self.path is None:
         return
     if self.rev is None:
         qtlib.editfiles(self._repo, [hglib.fromunicode(self.path)], parent=self)
     else:
         base, _ = visdiff.snapshot(self._repo, [hglib.fromunicode(self.path)], self._repo[self.rev])
         files = [os.path.join(base, hglib.fromunicode(self.path))]
         qtlib.editfiles(self._repo, files, parent=self)
Example #8
0
 def editfile(self):
     repo, filenames, rev = self._findsub(self._selectedfiles)
     if not filenames:
         return
     if rev is None:
         qtlib.editfiles(repo, filenames, parent=self.parent())
     else:
         base, _ = visdiff.snapshot(repo, filenames, repo[rev])
         files = [os.path.join(base, filename) for filename in filenames]
         qtlib.editfiles(repo, files, parent=self.parent())
Example #9
0
 def onViewFileAtRevision(self):
     rev = self.selection[0]
     filenames = [self.filerevmodel.graph.filename(rev)]
     if not filenames:
         return
     if rev is None:
         qtlib.editfiles(self.repo, filenames, parent=self)
     else:
         base, _ = visdiff.snapshot(self.repo, filenames, self.repo[rev])
         files = [os.path.join(base, filename) for filename in filenames]
         qtlib.editfiles(self.repo, files, parent=self)
 def editfile(self):
     repo, filenames, rev = self._findsub(self._selectedfiles)
     if not filenames:
         return
     if rev is None:
         qtlib.editfiles(repo, filenames, parent=self.parent())
     else:
         base, _ = visdiff.snapshot(repo, filenames, repo[rev])
         files = [os.path.join(base, filename)
                  for filename in filenames]
         qtlib.editfiles(repo, files, parent=self.parent())
Example #11
0
 def editfile(self):
     filenames = self.filelist.getSelectedFiles()
     if not filenames:
         return
     rev = self.ctx.rev()
     if rev is None:
         qtlib.editfiles(self.repo, filenames, parent=self)
     else:
         base, _ = visdiff.snapshot(self.repo, filenames, self.ctx)
         files = [os.path.join(base, filename)
                  for filename in filenames]
         qtlib.editfiles(self.repo, files, parent=self)
Example #12
0
 def onViewFileAtRevision(self):
     rev = self.selection[0]
     filenames = [self.filerevmodel.graph.filename(rev)]
     if not filenames:
         return
     if rev is None:
         qtlib.editfiles(self.repo, filenames, parent=self)
     else:
         base, _ = visdiff.snapshot(self.repo, filenames, self.repo[rev])
         files = [os.path.join(base, filename)
                  for filename in filenames]
         qtlib.editfiles(self.repo, files, parent=self)
Example #13
0
    def mimeData(self, indexes):
        files = [self.filePath(i) for i in indexes if i.isValid()]
        ctx = self._rootentry.ctx
        if ctx.rev() is not None:
            repo = self._repoagent.rawRepo()
            lfiles = map(hglib.fromunicode, files)
            lbase, _fns = visdiff.snapshot(repo, lfiles, ctx)
            base = hglib.tounicode(lbase)
        else:
            # working copy
            base = self._repoagent.rootPath()

        m = QMimeData()
        m.setUrls([QUrl.fromLocalFile(os.path.join(base, e)) for e in files])
        return m
Example #14
0
 def dragObject(self):
     if type(self.ctx.rev()) == str:
         return
     paths = []
     for index in self.selectedRows():
         paths.append(self.model().fileFromIndex(index))
     if not paths:
         return
     if self.ctx.rev() is None:
         base = self.repo.root
     else:
         base, _ = visdiff.snapshot(self.repo, paths, self.ctx)
     urls = []
     for path in paths:
         urls.append(QUrl.fromLocalFile(os.path.join(base, path)))
     if urls:
         d = QDrag(self)
         m = QMimeData()
         m.setUrls(urls)
         d.setMimeData(m)
         d.start(Qt.CopyAction)
Example #15
0
def viewmissing(parent, ui, repo, files):
    base, _ = visdiff.snapshot(repo, files, repo['.'])
    edit(parent, ui, repo, [os.path.join(base, f) for f in files])
Example #16
0
def viewmissing(parent, ui, repo, files):
    base, _ = visdiff.snapshot(repo, files, repo['.'])
    edit(parent, ui, repo, [os.path.join(base, f) for f in files])
Example #17
0
def viewother(parent, ui, repo, files):
    wctx = repo[None]
    assert bool(wctx.p2())
    base, _ = visdiff.snapshot(repo, files, wctx.p2())
    edit(parent, ui, repo, [os.path.join(base, f) for f in files])
Example #18
0
def viewother(parent, ui, repo, files):
    wctx = repo[None]
    assert bool(wctx.p2())
    base, _ = visdiff.snapshot(repo, files, wctx.p2())
    edit(parent, ui, repo, [os.path.join(base, f) for f in files])