def status(ui, repoagent, *pats, **opts): """browse working copy status""" from tortoisehg.hgqt import status as statusmod repo = repoagent.rawRepo() pats = hglib.canonpaths(pats) os.chdir(repo.root) return statusmod.StatusDialog(repoagent, pats, opts)
def run(ui, *pats, **opts): from tortoisehg.util import paths from tortoisehg.hgqt import thgrepo repo = thgrepo.repository(ui, path=paths.find_root()) pats = hglib.canonpaths(pats) os.chdir(repo.root) return StatusDialog(repo, pats, opts)
def _workbench(ui, *pats, **opts): root = opts.get('root') or paths.find_root() # TODO: unclear that _workbench() is called inside qtrun(). maybe this # function should receive factory object instead of using global qtrun. w = qtrun.createWorkbench() if root: root = hglib.tounicode(root) bundle = opts.get('bundle') if bundle: w.openRepo(root, False, bundle=hglib.tounicode(bundle)) else: w.showRepo(root) if pats: q = [] for f in pats: pat = hglib.canonpaths([f])[0] if os.path.isdir(f): q.append('file("%s/**")' % pat) elif os.path.isfile(f): q.append('file("%s")' % pat) w.setRevsetFilter(root, ' or '.join(q)) if w.repoTabsWidget.count() <= 0: w.reporegistry.setVisible(True) return w
def commit(ui, repoagent, *pats, **opts): """commit tool""" from tortoisehg.hgqt import commit as commitmod repo = repoagent.rawRepo() pats = hglib.canonpaths(pats) os.chdir(repo.root) return commitmod.CommitDialog(repoagent, pats, opts)
def run(ui, *pats, **opts): root = opts.get('root') or paths.find_root() if root and pats: repo = thgrepo.repository(ui, root) pats = hglib.canonpaths(pats) if len(pats) == 1 and os.path.isfile(repo.wjoin(pats[0])): from tortoisehg.hgqt.filedialogs import FileLogDialog fname = pats[0] ufname = hglib.tounicode(fname) dlg = FileLogDialog(repo, fname, None) dlg.setWindowTitle(_('Hg file log viewer [%s] - %s') % ( repo.displayname, ufname)) return dlg w = Workbench() if root: root = hglib.tounicode(root) w.showRepo(root) if pats: q = [] for pat in pats: f = repo.wjoin(pat) if os.path.isdir(f): q.append('file("%s/**")' % pat) elif os.path.isfile(f): q.append('file("%s")' % pat) w.setRevsetFilter(root, ' or '.join(q)) if w.repoTabsWidget.count() <= 0: w.reporegistry.setVisible(True) return w
def vdiff(ui, repoagent, *pats, **opts): """launch configured visual diff tool""" from tortoisehg.hgqt import visdiff repo = repoagent.rawRepo() if opts.get('bundle'): repo = thgrepo.repository(ui, opts.get('bundle')) pats = hglib.canonpaths(pats) return visdiff.visualdiff(ui, repo, pats, opts)
def __do_run(ui, command, *pats, **_opts): root = paths.find_root() repo = thgrepo.repository(ui, root) pats = hglib.canonpaths(pats) cmdline = [command] + pats instance = quickop.HeadlessQuickop(repo, cmdline) return instance
def run(ui, repoagent, *pats, **opts): repo = repoagent.rawRepo() pats = hglib.canonpaths(pats) command = opts['alias'] imm = repo.ui.config('tortoisehg', 'immediate', '') if opts.get('headless') or command in imm.lower(): cmdline = [command] + pats return HeadlessQuickop(repoagent, cmdline) else: return QuickOpDialog(repoagent, command, pats, None)
def run(ui, *pats, **opts): try: path = opts.get('bundle') or paths.find_root() repo = hg.repository(ui, path=path) except error.RepoError: ui.warn(_('No repository found here') + '\n') return None pats = hglib.canonpaths(pats) if opts.get('canonpats'): pats = list(pats) + opts['canonpats'] return visualdiff(ui, repo, pats, opts)
def filelog(ui, repoagent, *pats, **opts): """show history of the specified file""" from tortoisehg.hgqt import filedialogs if len(pats) != 1: raise util.Abort(_('requires a single filename')) repo = repoagent.rawRepo() rev = scmutil.revsingle(repo, opts.get('rev')).rev() filename = hglib.canonpaths(pats)[0] if opts.get('compare'): dlg = filedialogs.FileDiffDialog(repoagent, filename) else: dlg = filedialogs.FileLogDialog(repoagent, filename) dlg.goto(rev) return dlg
def run(ui, *pats, **opts): try: path = opts.get('bundle') or paths.find_root() repo = thgrepo.repository(ui, path=path) except error.RepoError: ui.warn(_('No repository found here') + '\n') return None pats = hglib.canonpaths(pats) if opts.get('canonpats'): pats = list(pats) + opts['canonpats'] dlg = visualdiff(ui, repo, pats, opts) if not dlg: sys.exit() return dlg
def run(ui, *pats, **opts): pats = hglib.canonpaths(pats) if opts.get('canonpats'): pats = list(pats) + opts['canonpats'] from tortoisehg.util import paths from tortoisehg.hgqt import thgrepo repo = thgrepo.repository(ui, path=paths.find_root()) command = opts['alias'] imm = repo.ui.config('tortoisehg', 'immediate', '') if command in imm.lower(): cmdline = [command] + pats global instance instance = HeadlessQuickop(repo, cmdline) return None else: return QuickOpDialog(repo, command, pats, None)
def manifest(ui, repoagent, *pats, **opts): """display the current or given revision of the project manifest""" from tortoisehg.hgqt import revdetails as revdetailsmod repo = repoagent.rawRepo() rev = scmutil.revsingle(repo, opts.get('rev')).rev() dlg = revdetailsmod.createManifestDialog(repoagent, rev) if pats: path = hglib.canonpaths(pats)[0] dlg.setFilePath(hglib.tounicode(path)) if opts.get('line'): try: lineno = int(opts['line']) except ValueError: raise util.Abort(_('invalid line number: %s') % opts['line']) dlg.showLine(lineno) if opts.get('pattern'): dlg.setSearchPattern(hglib.tounicode(opts['pattern'])) return dlg
def manifest(ui, repoagent, *pats, **opts): """display the current or given revision of the project manifest""" from tortoisehg.hgqt import manifestdialog repo = repoagent.rawRepo() rev = scmutil.revsingle(repo, opts.get('rev')).rev() dlg = manifestdialog.ManifestDialog(repoagent, rev) if pats: path = hglib.canonpaths(pats)[0] if opts.get('line'): try: lineno = int(opts['line']) except ValueError: raise util.Abort(_('invalid line number: %s') % opts['line']) else: lineno = None dlg.setSource(hglib.tounicode(path), rev, lineno) if opts.get('pattern'): dlg.setSearchPattern(hglib.tounicode(opts['pattern'])) return dlg
def init(): try: if pats: path = hglib.canonpaths(pats)[0] elif 'canonpath' in opts: path = opts['canonpath'] else: return line = opts.get('line') and int(opts['line']) or None dlg.setSource(hglib.tounicode(path), rev, line) if opts.get('pattern'): dlg.setSearchPattern(opts['pattern']) if dlg._manifest_widget._fileview.actionAnnMode.isEnabled(): dlg._manifest_widget._fileview.actionAnnMode.trigger() if 'ignorecase' in opts: dlg.setSearchCaseInsensitive(opts['ignorecase']) except IndexError: pass dlg.setSearchPattern(hglib.tounicode(opts.get('pattern')) or '')
def init(): try: if pats: path = hglib.canonpaths(pats)[0] elif "canonpath" in opts: path = opts["canonpath"] else: return line = opts.get("line") and int(opts["line"]) or None dlg.setSource(path, rev, line) if opts.get("pattern"): dlg.setSearchPattern(opts["pattern"]) if dlg._manifest_widget._fileview.actionAnnMode.isEnabled(): dlg._manifest_widget._fileview.actionAnnMode.trigger() if "ignorecase" in opts: dlg.setSearchCaseInsensitive(opts["ignorecase"]) except IndexError: pass dlg.setSearchPattern(hglib.tounicode(opts.get("pattern")) or "")
def run(ui, *pats, **opts): pats = hglib.canonpaths(pats) if opts.get('canonpats'): pats = list(pats) + opts['canonpats'] return QuickOpDialog(opts.get('alias'), pats)
def _formatfilerevset(pats): q = ["file('path:%s')" % f for f in hglib.canonpaths(pats)] return ' or '.join(q)
def _filelog(ui, repoagent, *pats, **opts): from tortoisehg.hgqt import filedialogs if len(pats) != 1: raise util.Abort(_('requires a single filename')) filename = hglib.canonpaths(pats)[0] return filedialogs.FileLogDialog(repoagent, filename)
def run(ui, *pats, **opts): pats = hglib.canonpaths(pats) if opts.get("canonpats"): pats = list(pats) + opts["canonpats"] return BrowseDialog(opts.get("alias"), pats)