Changeset 87c57f0bb520…
Parent 59be94d56ded…
by
Changes to 19 files · Browse files at 87c57f0bb520 Showing diff from parent 59be94d56ded Diff from another changeset...
@@ -12,7 +12,7 @@
from mercurial import hg, ui
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
import gtklib
class BackoutDialog(gtk.Window):
@@ -27,7 +27,7 @@ self.notify_func = None
try:
- repo = hg.repository(ui.ui(), path=hglib.rootpath())
+ repo = hg.repository(ui.ui(), path=paths.find_root())
except hglib.RepoError:
gobject.idle_add(self.destroy)
return
|
@@ -22,8 +22,7 @@ from mercurial import cmdutil, util, ui, hg, commands
from thgutil.i18n import _
-from thgutil import shlib
-from thgutil import hglib
+from thgutil import shlib, hglib, paths
import gtklib
@@ -122,7 +121,7 @@ self.cwd = cwd or os.getcwd()
self.ui = ui
self.ui.setconfig('ui', 'interactive', 'off')
- self.repo = repo or hg.repository(ui, path=hglib.rootpath())
+ self.repo = repo or hg.repository(ui, path=paths.find_root())
self.pats = pats
self.opts = opts
self.tmproot = None
|
@@ -15,9 +15,8 @@ from mercurial import hg, ui, mdiff, cmdutil, match, util
from thgutil.i18n import _
-from thgutil.hglib import toutf, fromutf, diffexpand, rootpath, RepoError
-from thgutil import thread2
-from thgutil import shlib
+from thgutil.hglib import toutf, fromutf, diffexpand, RepoError
+from thgutil import shlib, paths, thread2
import gtklib
@@ -43,7 +42,7 @@ gtklib.set_tortoise_icon(self, 'detect_rename.ico')
gtklib.set_tortoise_keys(self)
- self.root = rootpath()
+ self.root = paths.find_root()
self.notify_func = None
path = toutf(os.path.basename(self.root))
self.set_title(_('Detect Copies/Renames in ') + path)
@@ -227,10 +226,10 @@ 'User pressed "find renames" button'
cmodel = ctree.get_model()
cmodel.clear()
- umodel, paths = unktree.get_selection().get_selected_rows()
- if not paths:
+ umodel, upaths = unktree.get_selection().get_selected_rows()
+ if not upaths:
return
- tgts = [ umodel[p][0] for p in paths ]
+ tgts = [ umodel[p][0] for p in upaths ]
q = Queue.Queue()
thread = thread2.Thread(target=self.search_thread,
args=(self.root, q, tgts, adj))
@@ -294,8 +293,8 @@ repo = hg.repository(ui.ui(), self.root)
except RepoError:
return
- cmodel, paths = ctree.get_selection().get_selected_rows()
- for path in paths:
+ cmodel, upaths = ctree.get_selection().get_selected_rows()
+ for path in upaths:
row = cmodel[path]
src, usrc, dest, udest, percent, sensitive = row
if not sensitive:
@@ -319,15 +318,15 @@
def unknown_sel_change(self, selection, fr, fc):
'User selected a row in the unknown tree'
- model, paths = selection.get_selected_rows()
- sensitive = paths and True or False
+ model, upaths = selection.get_selected_rows()
+ sensitive = upaths and True or False
fr.set_sensitive(sensitive)
fc.set_sensitive(sensitive)
def show_diff(self, selection, buf, ac):
'User selected a row in the candidate tree'
- model, paths = selection.get_selected_rows()
- sensitive = paths and True or False
+ model, cpaths = selection.get_selected_rows()
+ sensitive = cpaths and True or False
ac.set_sensitive(sensitive)
try:
@@ -337,7 +336,7 @@
buf.set_text('')
bufiter = buf.get_start_iter()
- for path in paths:
+ for path in cpaths:
row = model[path]
src, usrc, dest, udest, percent, sensitive = row
if not sensitive:
|
@@ -11,8 +11,7 @@ from mercurial import hg, ui, match
from thgutil.i18n import _
-from thgutil import shlib
-from thgutil import hglib
+from thgutil import shlib, hglib, paths
import gtklib
@@ -24,7 +23,7 @@ gtklib.set_tortoise_icon(self, 'ignore.ico')
gtklib.set_tortoise_keys(self)
- self.root = hglib.rootpath()
+ self.root = paths.find_root()
self.set_title(_('Ignore filter for ') + os.path.basename(self.root))
self.set_default_size(630, 400)
self.notify_func = None
@@ -156,15 +155,15 @@ self.refresh()
def pattree_rowchanged(self, sel, remove):
- model, paths = sel.get_selected()
- sensitive = paths and True or False
+ model, ppaths = sel.get_selected()
+ sensitive = ppaths and True or False
remove.set_sensitive(sensitive)
def unknown_rowchanged(self, sel):
- model, paths = sel.get_selected()
- if not paths:
+ model, upaths = sel.get_selected()
+ if not upaths:
return
- self.glob_entry.set_text(model[paths][0])
+ self.glob_entry.set_text(model[uupaths][0])
def add_glob(self, widget, glob_entry):
newglob = hglib.fromutf(glob_entry.get_text())
|
@@ -22,7 +22,7 @@ from mercurial import hg, util, fancyopts, cmdutil, extensions
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
nonrepo_commands = 'userconfig clone debugcomplete init about help version'
@@ -143,7 +143,7 @@ elif not cmd:
return help_(ui, 'shortlist')
- path = hglib.rootpath(os.getcwd())
+ path = paths.find_root(os.getcwd())
if path:
try:
lui = hasattr(_ui, 'copy') and _ui.copy() or _ui.ui(ui)
@@ -172,7 +172,7 @@ # try to guess the repo from first of file args
root = None
if args:
- path = hglib.rootpath(args[0])
+ path = paths.find_root(args[0])
if path:
repo = hg.repository(ui, path=path)
else:
@@ -228,16 +228,15 @@ """commit tool"""
ct = ui.config('tortoisehg', 'extcommit', None)
if ct == 'qct':
- from hglib import thgdispatch
- args = ['--repository', root, ct]
+ from mercurial import dispatch
try:
- thgdispatch(repo.ui, args=args)
+ dispatch.dispatch(ct, *pats, **opts)
except SystemExit:
pass
return
# move cwd to repo root if repo is merged, so we can show
# all the changed files
- repo = hg.repository(ui, path=hglib.rootpath())
+ repo = hg.repository(ui, path=paths.find_root())
if len(repo.changectx(None).parents()) > 1:
os.chdir(repo.root)
pats = []
|
@@ -15,7 +15,7 @@ from mercurial import ui, hg, commands, extensions
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
from gdialog import *
from changeset import ChangeSet
@@ -772,7 +772,7 @@ 'date':None, 'only_merges':None, 'prune':[], 'git':False,
'verbose':False, 'include':[], 'exclude':[]
}
- root = hglib.rootpath()
+ root = paths.find_root()
canonpats = []
for f in pats:
canonpats.append(util.canonpath(root, os.getcwd(), f))
|
@@ -11,7 +11,7 @@ from mercurial import hg, ui
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
import gtklib
import gdialog
@@ -33,7 +33,7 @@ return
try:
- repo = hg.repository(ui.ui(), path=hglib.rootpath())
+ repo = hg.repository(ui.ui(), path=paths.find_root())
except hglib.RepoError:
gobject.idle_add(self.destroy)
return
|
@@ -14,8 +14,7 @@ from mercurial import hg, ui, util
from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import shlib
+from thgutil import hglib, shlib, paths
import gdialog
import dialog
@@ -29,7 +28,7 @@ gtklib.set_tortoise_icon(self, 'general.ico')
gtklib.set_tortoise_keys(self)
- self.root = hglib.rootpath()
+ self.root = paths.find_root()
self.selected_path = None
self.hgthread = None
self.connect('delete-event', self._delete)
|
@@ -11,7 +11,7 @@ from mercurial import hg, ui, util, commands
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
import dialog
@@ -38,7 +38,7 @@ dialog.destroy()
return
try:
- root = hglib.rootpath()
+ root = paths.find_root()
repo = hg.repository(ui.ui(), root)
except (ImportError, hglib.RepoError):
dialog.destroy()
|
@@ -20,7 +20,7 @@ from mercurial.hgweb import server
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
import dialog
import gdialog
@@ -47,7 +47,7 @@ commands.table.update(thg_serve_cmd)
self._url = None
- self._root = hglib.rootpath()
+ self._root = paths.find_root()
self._webdirconf = webdir_conf
self._get_config()
self.set_default_size(500, 300)
|
@@ -18,8 +18,7 @@ from mercurial import merge as merge_
from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import shlib
+from thgutil import hglib, shlib, paths
from gdialog import GDialog, Confirm, Prompt, NativeSaveFileDialogWrapper
import dialog
@@ -411,8 +410,8 @@
def thgdiff(self, treeview):
selection = treeview.get_selection()
- model, paths = selection.get_selected_rows()
- row = model[paths[0]]
+ model, tpaths = selection.get_selected_rows()
+ row = model[tpaths[0]]
self._diff_file(row[FM_STATUS], row[FM_PATH])
def thgrefresh(self, window):
@@ -424,8 +423,8 @@ w = self.get_focus()
w.emit('copy-clipboard')
return False
- model, paths = treeview.get_selection().get_selected_rows()
- cids = [ model[row][DM_CHUNK_ID] for row, in paths ]
+ model, tpaths = treeview.get_selection().get_selected_rows()
+ cids = [ model[row][DM_CHUNK_ID] for row, in tpaths ]
headers = {}
fp = cStringIO.StringIO()
for cid in cids:
@@ -567,9 +566,9 @@
# List of the currently checked and selected files to pass on to
# the new data
- model, paths = selection.get_selected_rows()
+ model, tpaths = selection.get_selected_rows()
recheck = [entry[FM_PATH] for entry in model if entry[FM_CHECKED]]
- reselect = [model[path][FM_PATH] for path in paths]
+ reselect = [model[path][FM_PATH] for path in tpaths]
# merge-state of files
ms = merge_.mergestate(repo)
@@ -1162,7 +1161,7 @@ return True
# verify directory
- destroot = hglib.rootpath(destdir)
+ destroot = paths.find_root(destdir)
if destroot != self.repo.root:
Prompt(_('Nothing Moved'),
_('Cannot move outside repo!'), self).run()
@@ -1259,8 +1258,8 @@ selection = self.filetree.get_selection()
assert(selection.count_selected_rows() == 1)
- model, paths = selection.get_selected_rows()
- path = paths[0]
+ model, tpaths = selection.get_selected_rows()
+ path = tpaths[0]
handler(model[path][FM_STATUS], model[path][FM_PATH])
return True
@@ -1295,8 +1294,8 @@ if selection.count_selected_rows() != 1:
return False
- model, paths = selection.get_selected_rows()
- menu = self._get_file_context_menu(model[paths[0]])
+ model, tpaths = selection.get_selected_rows()
+ menu = self._get_file_context_menu(model[tpaths[0]])
menu.popup(None, None, None, button, time)
return True
@@ -1327,8 +1326,8 @@ if selection.count_selected_rows() != 1:
return False
- model, paths = selection.get_selected_rows()
- menu = self._get_file_context_menu(model[paths[0]])
+ model, tpaths = selection.get_selected_rows()
+ menu = self._get_file_context_menu(model[tpaths[0]])
menu.get_children()[0].activate()
return True
|
@@ -15,8 +15,7 @@ from mercurial import hg, ui, util, extensions, url
from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import shlib
+from thgutil import hglib, shlib, paths
import dialog
import gtklib
@@ -29,7 +28,7 @@ gtklib.set_tortoise_icon(self, 'menusynch.ico')
gtklib.set_tortoise_keys(self)
- self.root = hglib.rootpath()
+ self.root = paths.find_root()
self.selected_path = None
self.hgthread = None
@@ -38,7 +37,7 @@
self.set_default_size(655, 552)
- self.paths = self._get_paths()
+ self._paths = self._get_paths()
self.origchangecount = len(self.repo.changelog)
name = self.repo.ui.config('web', 'name') or os.path.basename(self.root)
@@ -260,7 +259,7 @@
def fill_path_combo(self):
self.pathlist.clear()
- for alias, path in self.paths:
+ for alias, path in self._paths:
path = url.hidepassword(path)
self.pathlist.append([hglib.toutf(path), hglib.toutf(alias)])
@@ -274,7 +273,7 @@ if not uri.startswith('file://'):
return
path = urllib.unquote(uri[7:])
- if hglib.rootpath(path) == path:
+ if paths.find_root(path) == path:
self._pathtext.set_text(hglib.toutf(path))
elif not os.path.isdir(path) and path.endswith('.hg'):
self._pathtext.set_text(hglib.toutf(path))
@@ -325,7 +324,7 @@ try:
self.ui = ui.ui()
self.repo = hg.repository(self.ui, path=self.root)
- paths = self.repo.ui.configitems('paths')
+ uipaths = self.repo.ui.configitems('paths')
if sort:
if sort == "value":
sortfunc = lambda a,b: cmp(a[1], b[1])
@@ -333,8 +332,8 @@ sortfunc = lambda a,b: cmp(a[0], b[0])
else:
raise _("unknown sort key '%s'") % sort
- paths.sort(sortfunc)
- return paths
+ uipaths.sort(sortfunc)
+ return uipaths
except hglib.RepoError:
return None
@@ -448,7 +447,7 @@
def _conf_clicked(self, toolbutton, data=None):
newpath = hglib.fromutf(self._pathtext.get_text()).strip()
- for alias, path in self.paths:
+ for alias, path in self._paths:
if path == newpath:
newpath = None
break
@@ -461,7 +460,7 @@ dlg.focus_field('tortoisehg.postpull')
dlg.run()
dlg.hide()
- self.paths = self._get_paths()
+ self._paths = self._get_paths()
self.fill_path_combo()
self.update_pull_setting()
@@ -524,7 +523,7 @@ use_proxy = self._use_proxy.get_active()
text_entry = self._pathbox.get_child()
remote_path = hglib.fromutf(text_entry.get_text()).strip()
- for alias, path in self.paths:
+ for alias, path in self._paths:
if remote_path == alias:
remote_path = path
elif remote_path == url.hidepassword(path):
|
@@ -14,9 +14,7 @@ from mercurial import hg, ui, util, url
from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import iniparse
-from thgutil import shlib
+from thgutil import hglib, shlib, paths, iniparse
import dialog
import gdialog
@@ -369,7 +367,7 @@
self.ui = ui.ui()
try:
- repo = hg.repository(self.ui, path=hglib.rootpath())
+ repo = hg.repository(self.ui, path=paths.find_root())
except hglib.RepoError:
repo = None
if configrepo:
@@ -460,7 +458,7 @@ util.system("%s \"%s\"" % (editor, self.fn))
# reload configs, in case they have been written since opened
if self.configrepo:
- repo = hg.repository(ui.ui(), path=hglib.rootpath())
+ repo = hg.repository(ui.ui(), path=paths.find_root())
u = repo.ui
else:
u = ui.ui()
|
@@ -12,7 +12,7 @@ from mercurial.node import short, nullrev
from thgutil.i18n import _
-from thgutil import hglib
+from thgutil import hglib, paths
import hgcmd
import gdialog
@@ -32,7 +32,7 @@ self.notify_func = None
try:
- repo = hg.repository(ui.ui(), path=hglib.rootpath())
+ repo = hg.repository(ui.ui(), path=paths.find_root())
except hglib.RepoError:
gobject.idle_add(self.destroy)
return
|
@@ -19,8 +19,7 @@ from mercurial import hg, ui, cmdutil, util, commands
from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import shlib
+from thgutil import hglib, shlib, paths
import gdialog
import gtklib
@@ -105,7 +104,7 @@ treeview.append_column(fcol)
try:
- repo = hg.repository(ui.ui(), path=hglib.rootpath())
+ repo = hg.repository(ui.ui(), path=paths.find_root())
except hglib.RepoError:
# hgtk should catch this earlier
gdialog.Prompt(_('No repository'),
@@ -267,7 +266,7 @@ return tools
def run(ui, *pats, **opts):
- root = hglib.rootpath()
+ root = paths.find_root()
canonpats = []
for f in pats:
canonpats.append(util.canonpath(root, os.getcwd(), f))
|
@@ -1,12 +1,10 @@ import os
+import sys
+
from mercurial import hg, cmdutil, util, ui, node, merge
-import thgutil
-import sys
+import paths
import debugthg
-try:
- from mercurial.error import RepoError
-except ImportError:
- from mercurial.repo import RepoError
+import hglib
debugging = False
enabled = True
@@ -132,7 +130,7 @@ root = cache_root
else:
debugf("find new root")
- root = thgutil.find_root(path)
+ root = paths.find_root(path)
if root == path:
if not overlay_cache:
cache_root = pdir
@@ -158,7 +156,7 @@ cache_tick_count = GetTickCount()
debugf("overlayicons disabled")
return NOT_IN_REPO
- if localonly and thgutil.netdrive_status(path):
+ if localonly and paths.netdrive_status(path):
debugf("%s: is a network drive", path)
overlay_cache = {None: None}
cache_tick_count = GetTickCount()
@@ -183,7 +181,7 @@ if not repo or (repo.root != root and repo.root != real(root)):
repo = hg.repository(ui.ui(), path=root)
debugf("hg.repository() took %g ticks", (GetTickCount() - tc1))
- except RepoError:
+ except hglib.RepoError:
# We aren't in a working tree
debugf("%s: not in repo", pdir)
add(pdir + '*', IGNORED)
|
@@ -10,11 +10,12 @@ import os
import sys
import traceback
-import threading, thread2
import urllib2
import Queue
from mercurial import hg, ui, util, extensions, commands, hook
+
from i18n import _
+import paths
try:
from mercurial.error import RepoError, ParseError, LookupError
@@ -73,18 +74,6 @@ pass
return s.decode('utf-8').encode(_fallbackencoding)
-def rootpath(path=None):
- """ find Mercurial's repo root of path """
- if not path:
- path = os.getcwd()
- p = os.path.isdir(path) and path or os.path.dirname(path)
- while not os.path.isdir(os.path.join(p, ".hg")):
- oldp = p
- p = os.path.dirname(p)
- if p == oldp:
- return ''
- return p
-
_tabwidth = None
def gettabwidth(ui):
global _tabwidth
@@ -204,7 +193,7 @@ os.chdir(cwd[-1])
# read the local repository .hgrc into a local ui object
- path = rootpath(path) or ""
+ path = paths.find_root(path) or ""
if path:
try:
ui.readconfig(os.path.join(path, ".hg", "hgrc"))
|
@@ -4,15 +4,13 @@ # Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>
import os
+
+from mercurial import hg, ui, node
+
+from i18n import _
import cachethg
-import thgutil
-from mercurial import hg, ui, node
-from mercurial.i18n import _
-
-try:
- from mercurial.error import RepoError
-except ImportError:
- from mercurial.repo import RepoError
+import paths
+import hglib
promoted = []
try:
@@ -122,12 +120,12 @@
def open_repo(path):
- root = thgutil.find_root(path)
+ root = paths.find_root(path)
if root:
try:
repo = hg.repository(ui.ui(), path=root)
return repo
- except RepoError:
+ except hglib.RepoError:
pass
except StandardError, e:
print "error while opening repo %s:" % path
|
@@ -13,8 +13,8 @@
import os
-def find_root(path):
- p = os.path.isdir(path) and path or os.path.dirname(path)
+def find_root(path=None):
+ p = path or os.getcwd()
while not os.path.isdir(os.path.join(p, ".hg")):
oldp = p
p = os.path.dirname(p)
|
Loading...