Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

nautilus: bring up to date with new thg dir layout

remove environment variable hacks and hard-coded paths

Changeset 30ee4a16cacf

Parent f02c20f9a919

by Steve Borho

Changes to one file · Browse files at 30ee4a16cacf Showing diff from parent f02c20f9a919 Diff from another changeset...

 
35
36
37
38
39
40
41
 
60
61
62
63
64
65
66
67
68
69
 
70
71
72
 
73
74
75
76
77
78
79
80
81
82
83
 
 
84
85
86
87
88
89
90
91
92
93
94
95
 
 
96
97
 
98
99
100
 
 
101
102
103
 
118
119
120
 
121
122
123
124
125
126
 
127
128
129
 
144
145
146
147
148
149
150
151
152
153
154
155
 
156
157
158
 
 
159
160
161
 
231
232
233
234
 
 
235
236
237
 
254
255
256
257
 
258
259
260
 
315
316
317
318
 
319
320
321
 
35
36
37
 
38
39
40
 
59
60
61
 
 
 
 
 
 
 
62
63
 
 
64
65
 
 
66
67
68
69
 
 
 
 
70
71
72
 
 
 
 
 
 
 
 
73
 
 
74
75
76
 
77
78
79
 
80
81
82
83
84
 
99
100
101
102
103
104
105
106
107
 
108
109
110
111
 
126
127
128
 
 
129
130
131
132
133
 
 
134
135
 
 
136
137
138
139
140
 
210
211
212
 
213
214
215
216
217
 
234
235
236
 
237
238
239
240
 
295
296
297
 
298
299
300
301
@@ -35,7 +35,6 @@
  from mercurial.repo import RepoError  from mercurial.node import short   -TORTOISEHG_PATH = '~/tools/tortoisehg-dev'  nofilecmds = 'about serve synch repoconfig userconfig merge unmerge'.split()  nocachecmds = 'about serve repoconfig userconfig'.split()   @@ -60,44 +59,26 @@
  if os.path.isdir(testpath):   if thgpath not in sys.path:   sys.path.insert(0, thgpath) - else: - # try environment or hard-coded path - thgpath = os.environ.get('TORTOISEHG_PATH', TORTOISEHG_PATH) - thgpath = os.path.normpath(os.path.expanduser(thgpath)) - if os.path.exists(thgpath) and thgpath not in sys.path: - sys.path.insert(0, thgpath) - # else assume tortoise is already in PYTHONPATH + # else assume thgutil is already in PYTHONPATH   try: - import tortoise.thgutil - import tortoise.menuthg + from thgutil import paths, debugthg, menuthg   except ImportError, e: - # if thgutil is not found, then repository cannot be found - # if menuthg is not found, you have an older version in sys.path   print e   self.menu = None   return   - self.env = os.environ - self.env['PYTHONPATH'] = ':'.join(sys.path) - self.env['TORTOISEHG_PATH'] = thgpath - self.env['THG_ICON_PATH'] = os.path.join(thgpath, 'icons') + self.hgtk = paths.find_in_path('hgtk') + self.menu = menuthg.menuThg()   - self.hgtk = tortoise.thgutil.find_path('hgtk', - tortoise.thgutil.get_prog_root()) - if not self.hgtk: - self.hgtk = tortoise.thgutil.find_path('hgtk') - self.ipath = os.path.join(thgpath, 'icons', 'tortoise') - self.menu = tortoise.menuthg.menuThg() - - import tortoise.debugthg   global debugf - if tortoise.debugthg.debug('N'): - debugf = tortoise.debugthg.debugf + if debugthg.debug('N'): + debugf = debugthg.debugf   else: - debugf = tortoise.debugthg.debugf_No + debugf = debugthg.debugf_No     def icon(self, iname): - return os.path.join(self.ipath, iname) + from thgutil import paths + return paths.get_tortoise_icon(iname)     def get_path_for_vfs_file(self, vfs_file):   if vfs_file.is_gone() or vfs_file.get_uri_scheme() != 'file': @@ -118,12 +99,13 @@
    if p == self.cacheroot:   return self.cacherepo + from thgutil import hglib   # Keep one repo cached   try:   self.cacheroot = p   self.cacherepo = hg.repository(ui.ui(), path=p)   return self.cacherepo - except RepoError: + except hglib.RepoError:   self.cacheroot = None   self.cacherepo = None   return None @@ -144,18 +126,15 @@
  cmdopts = [sys.executable, self.hgtk, hgtkcmd]     if hgtkcmd not in nofilecmds and self.files: - # Use stdin to pass file list (avoid shell command - # line limitations)   pipe = subprocess.PIPE   cmdopts += ['--listfile', '-']   else:   pipe = None   - stdin = subprocess.Popen(cmdopts, cwd=cwd, stdin=pipe, env=self.env, shell=False).stdin - + proc = subprocess.Popen(cmdopts, cwd=cwd, stdin=pipe, shell=False)   if pipe: - stdin.write('\n'.join(self.files)) - stdin.close() + proc.stdin.write('\n'.join(self.files)) + proc.stdin.close()     if hgtkcmd not in nocachecmds:   # Remove cached repo object, dirstate may change @@ -231,7 +210,8 @@
  menu_info.menutext,   menu_info.helptext,   self.icon(menu_info.icon)) - item.connect('activate', self.run_dialog, menu_info.hgcmd, passcwd) + item.connect('activate', self.run_dialog, menu_info.hgcmd, + passcwd)   items.append(item)   return items   @@ -254,7 +234,7 @@
  "Version control status"),     def _get_file_status(self, repo, localpath): - from tortoise import cachethg + from thgutil import cachethg   cachestate = cachethg.get_state(localpath, repo)   cache2state = {cachethg.UNCHANGED: ('default', 'clean'),   cachethg.ADDED: ('cvs-added', 'added'), @@ -315,7 +295,7 @@
  emblem, status = self._get_file_status(repo, path)     # Get the information from Mercurial - ctx = repo.changectx(None).parents()[0] + ctx = repo['.']   try:   fctx = ctx.filectx(localpath)   rev = fctx.filelog().linkrev(fctx.filerev())