Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

Merge

Changeset e3be646769d5

Parents 73e6d5bf66df

Parents ba2dea51f18b

by Steve Borho

Changes to one file · Browse files at e3be646769d5 Showing diff from parent 73e6d5bf66df ba2dea51f18b Diff from another changeset...

 
80
81
82
83
 
84
85
 
 
86
87
88
 
155
156
157
158
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
161
162
 
171
172
173
174
175
176
177
178
179
180
181
182
 
 
 
 
 
 
 
183
184
185
186
187
188
189
 
190
191
192
193
194
195
196
 
 
 
 
 
 
 
 
197
198
199
 
 
200
201
 
202
203
204
 
227
228
229
230
 
 
231
232
233
234
235
236
237
 
 
 
 
 
238
239
240
 
250
251
252
253
254
255
 
256
257
 
258
259
260
 
266
267
268
269
270
271
272
273
274
275
276
 
 
 
 
 
 
 
 
 
 
 
 
 
277
278
279
280
281
282
283
284
285
286
287
 
 
 
 
 
 
 
288
289
290
 
80
81
82
 
83
84
 
85
86
87
88
89
 
156
157
158
 
 
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
 
184
185
186
 
 
 
187
188
189
190
 
 
191
192
193
194
195
196
197
198
 
199
200
201
202
203
204
205
 
 
 
 
 
 
206
207
208
209
210
211
212
213
214
 
 
215
216
217
218
219
220
221
222
 
245
246
247
 
248
249
250
251
252
253
254
255
 
256
257
258
259
260
261
262
263
 
273
274
275
 
 
 
276
277
 
278
279
280
281
 
287
288
289
 
 
290
291
 
292
 
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
 
 
313
 
 
314
315
316
317
318
319
320
321
322
323
@@ -80,9 +80,10 @@
   class BrowsePane(gtk.TreeView):   'Dialog for browsing repo.status() output' - def __init__(self, entry): + def __init__(self, callback):   gtk.TreeView.__init__(self) - self.entry = entry + self.callback = callback + self.cachedroot = None   self.menu = menuthg.menuThg()   fm = gtk.ListStore(str, # canonical path   bool, # Checked @@ -155,8 +156,20 @@
  dirs.reverse()   return dirs, basename   - def chdir(self, cwd, repo): - 'change directories inside a repo, or out of a repo' + def chdir(self, cwd): + 'change to a new directory' + # disable updates while we refill the model + model = self.get_model() + self.set_model(None) + model.clear() + try: + self._chdir(model, cwd) + except Exception, e: + # report to status bar + pass + self.set_model(model) + + def _chdir(self, model, cwd):   def buildrow(name, stset, isfile):   dirs, basename = self.split(name)   row = [ name, False, hglib.toutf(basename), @@ -171,34 +184,39 @@
  for fname, st in node.files:   model.append(buildrow(fname, st, True))   - model = self.get_model() - self.set_model(None) # disable updates while we fill the model - model.clear()   drive, tail = os.path.splitdrive(cwd)   if cwd != '/' or (drive and tail):   model.append(buildrow('..', '', False))   - if repo and cwd.startswith(repo.root): - relpath = cwd[len(repo.root)+len(os.sep):] + root = paths.find_root(cwd) + if root and self.cachedroot != root: + self.cacherepo(root) + + if root: + node = self.cachedmodel + relpath = cwd[len(root)+len(os.sep):]   dirs, basename = self.split(relpath) - node = self.cachedmodel   for dname in dirs:   node = node.subdirs[dname]   if basename:   node = node.subdirs[basename]   adddir(node) + self.currepo = None   else: - for name in os.listdir(cwd): - model.append(buildrow(name, '', os.path.isfile(name))) - self.entry.set_text(cwd) - self.set_model(model) - self.cwd = cwd - self.repo = repo + try: + for name in os.listdir(cwd): + isfile = os.path.isfile(os.path.join(cwd, name)) + model.append(buildrow(name, '', isfile)) + except OSError: + # report to status bar + pass + self.currepo = self.cachedrepo   - def refresh(self, cwd, repo, pats=[], filetypes='CI?'): - hglib.invalidaterepo(repo) + + def cacherepo(self, root, pats=[], filetypes='CI?'):   status = ([],)*7   try: + repo = hg.repository(ui.ui(), path=root)   matcher = cmdutil.match(repo, pats)   st = repo.status(match=matcher,   clean='C' in filetypes, @@ -227,14 +245,19 @@
  curdir.addfile(name, filestatus)     self.cachedmodel = modelroot - self.chdir(cwd, repo) + self.cachedroot = root + self.cachedrepo = repo     def popupmenu(self, browse):   model, tpaths = browse.get_selection().get_selected_rows()   if not tpaths:   return   files = [model[p][0] for p in tpaths if model[p][10]] - menus = self.menu.get_commands(self.repo, self.repo.root, files) + if self.currepo: + repo = self.currepo + menus = self.menu.get_commands(repo, repo.root, files) + else: + menus = self.menu.get_norepo_commands(None, files)   # see nautilus extension for usage info   for menu_info in menus:   print menu_info @@ -250,11 +273,9 @@
  if not tpaths:   return   if len(tpaths) == 1 and not model[tpaths[0]][10]: - newpath = os.path.join(self.cwd, model[tpaths[0]][0]) - newpath = os.path.abspath(newpath) - self.chdir(newpath, self.repo) + self.callback(model[tpaths[0]][0])   else: - files = [model[p][0] for p in tpaths and model[p][10]] + files = [model[p][0] for p in tpaths if model[p][10]]   print files, 'activated'    class BrowseDialog(gtk.Dialog): @@ -266,25 +287,37 @@
  self.set_has_separator(False)   self.set_default_size(400, 500)   self.connect('response', self.dialog_response) - repo = hg.repository(ui.ui(), path=paths.find_root()) - self.set_title(_('%s - browser') % hglib.get_reponame(repo))     entry = gtk.Entry() - entry.set_text(repo.root)   self.vbox.pack_start(entry, False, True) - browse = BrowsePane(entry)   + def newfolder_notify(newfolder): + curpath = entry.get_text() + newpath = os.path.join(curpath, newfolder) + newpath = hglib.toutf(os.path.abspath(newpath)) + root = paths.find_root(newpath) + if root: + self.set_title(root + ' - ' + _('browser')) + else: + self.set_title(_('browser')) + entry.set_text(newpath) + browse.chdir(newpath) + + browse = BrowsePane(newfolder_notify)   scroller = gtk.ScrolledWindow()   scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   scroller.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scroller.add(browse)   self.vbox.pack_start(scroller, True, True)   self.show_all() - self.browse = browse - gobject.idle_add(self.refresh, repo.root, repo)   - def refresh(self, cwd, repo): - self.browse.refresh(cwd, repo) + cwd = hglib.toutf(os.getcwd()) + entry.connect('activate', self.entry_activated, browse) + entry.set_text(cwd) + browse.chdir(cwd) + + def entry_activated(self, entry, browse): + browse.chdir(entry.get_text())     def dialog_response(self, dialog, response):   return True