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

hggtk: paths.find_root() replaces hglib.rootpath()

Changeset 87c57f0bb520

Parent 59be94d56ded

by Steve Borho

Changes to 19 files · Browse files at 87c57f0bb520 Showing diff from parent 59be94d56ded Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​backout.py Stacked
 
12
13
14
15
 
16
17
18
 
27
28
29
30
 
31
32
33
 
12
13
14
 
15
16
17
18
 
27
28
29
 
30
31
32
33
@@ -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
Change 1 of 2 Show Entire File hggtk/​gdialog.py Stacked
 
22
23
24
25
26
 
27
28
29
 
122
123
124
125
 
126
127
128
 
22
23
24
 
 
25
26
27
28
 
121
122
123
 
124
125
126
127
@@ -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
Change 1 of 6 Show Entire File hggtk/​guess.py Stacked
 
15
16
17
18
19
20
 
 
21
22
23
 
43
44
45
46
 
47
48
49
 
227
228
229
230
231
 
 
232
233
 
234
235
236
 
294
295
296
297
298
 
 
299
300
301
 
319
320
321
322
323
 
 
324
325
326
327
328
329
330
 
 
331
332
333
 
337
338
339
340
 
341
342
343
 
15
16
17
 
 
 
18
19
20
21
22
 
42
43
44
 
45
46
47
48
 
226
227
228
 
 
229
230
231
 
232
233
234
235
 
293
294
295
 
 
296
297
298
299
300
 
318
319
320
 
 
321
322
323
324
325
326
327
 
 
328
329
330
331
332
 
336
337
338
 
339
340
341
342
@@ -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:
Change 1 of 3 Show Entire File hggtk/​hgignore.py Stacked
 
11
12
13
14
15
 
16
17
18
 
24
25
26
27
 
28
29
30
 
156
157
158
159
160
 
 
161
162
163
164
165
 
 
166
167
 
168
169
170
 
11
12
13
 
 
14
15
16
17
 
23
24
25
 
26
27
28
29
 
155
156
157
 
 
158
159
160
161
162
 
 
163
164
165
 
166
167
168
169
@@ -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())
Change 1 of 4 Show Entire File hggtk/​hgtk.py Stacked
 
22
23
24
25
 
26
27
28
 
143
144
145
146
 
147
148
149
 
172
173
174
175
 
176
177
178
 
228
229
230
231
232
 
233
234
 
235
236
237
238
239
240
 
241
242
243
 
22
23
24
 
25
26
27
28
 
143
144
145
 
146
147
148
149
 
172
173
174
 
175
176
177
178
 
228
229
230
 
 
231
232
 
233
234
235
236
237
238
 
239
240
241
242
@@ -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 = []
Change 1 of 2 Show Entire File hggtk/​history.py Stacked
 
15
16
17
18
 
19
20
21
 
772
773
774
775
 
776
777
778
 
15
16
17
 
18
19
20
21
 
772
773
774
 
775
776
777
778
@@ -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))
Change 1 of 2 Show Entire File hggtk/​merge.py Stacked
 
11
12
13
14
 
15
16
17
 
33
34
35
36
 
37
38
39
 
11
12
13
 
14
15
16
17
 
33
34
35
 
36
37
38
39
@@ -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
Change 1 of 2 Show Entire File hggtk/​recovery.py Stacked
 
14
15
16
17
18
 
19
20
21
 
29
30
31
32
 
33
34
35
 
14
15
16
 
 
17
18
19
20
 
28
29
30
 
31
32
33
34
@@ -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)
Change 1 of 2 Show Entire File hggtk/​rename.py Stacked
 
11
12
13
14
 
15
16
17
 
38
39
40
41
 
42
43
44
 
11
12
13
 
14
15
16
17
 
38
39
40
 
41
42
43
44
@@ -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()
Change 1 of 2 Show Entire File hggtk/​serve.py Stacked
 
20
21
22
23
 
24
25
26
 
47
48
49
50
 
51
52
53
 
20
21
22
 
23
24
25
26
 
47
48
49
 
50
51
52
53
@@ -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)
Change 1 of 8 Show Entire File hggtk/​status.py Stacked
 
18
19
20
21
22
 
23
24
25
 
411
412
413
414
415
 
 
416
417
418
 
424
425
426
427
428
 
 
429
430
431
 
567
568
569
570
 
571
572
 
573
574
575
 
1162
1163
1164
1165
 
1166
1167
1168
 
1259
1260
1261
1262
1263
 
 
1264
1265
1266
 
1295
1296
1297
1298
1299
 
 
1300
1301
1302
 
1327
1328
1329
1330
1331
 
 
1332
1333
1334
 
18
19
20
 
 
21
22
23
24
 
410
411
412
 
 
413
414
415
416
417
 
423
424
425
 
 
426
427
428
429
430
 
566
567
568
 
569
570
 
571
572
573
574
 
1161
1162
1163
 
1164
1165
1166
1167
 
1258
1259
1260
 
 
1261
1262
1263
1264
1265
 
1294
1295
1296
 
 
1297
1298
1299
1300
1301
 
1326
1327
1328
 
 
1329
1330
1331
1332
1333
@@ -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  
Change 1 of 10 Show Changes Only hggtk/​synch.py Stacked
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
20
21
22
23
24
25
26
27
28
29
30
31
32
 
33
34
35
36
37
38
39
40
41
 
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
 
264
265
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
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
324
325
326
327
328
 
329
330
331
332
333
334
335
336
337
 
 
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
 
452
453
454
455
456
457
458
459
460
461
462
463
464
 
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
 
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
 
18
19
20
21
22
23
24
25
26
27
28
29
30
 
31
32
33
34
35
36
37
38
39
 
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
 
262
263
264
265
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
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
324
325
326
 
327
328
329
330
331
332
333
334
 
 
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
 
450
451
452
453
454
455
456
457
458
459
460
461
462
 
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
 
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
 #  # Repository synchronization dialog for TortoiseHg  #  # Copyright (C) 2007 Steve Borho <steve@borho.org>  # Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>  #    import gtk  import gobject  import pango  import Queue  import os  import urllib    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  import hgthread    class SynchDialog(gtk.Window):   def __init__(self, repos=[], pushmode=False):   """ Initialize the Dialog. """   gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)   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     # persistent app data   self._settings = shlib.Settings('synch')     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)   self.set_title(_('TortoiseHg Synchronize - ') + name)     self.connect('delete-event', self._delete)     # toolbar   self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()   self._stop_button = self._toolbutton(gtk.STOCK_STOP,   _('Stop'), self._stop_clicked, tip=_('Stop the hg operation'))   self._stop_button.set_sensitive(False)   tbuttons = [   self._toolbutton(gtk.STOCK_GO_DOWN,   _('Incoming'),   self._incoming_clicked,   tip=_('Display changes that can be pulled'   ' from selected repository')),   self._toolbutton(gtk.STOCK_GOTO_BOTTOM,   _(' Pull '),   self._pull_clicked,   tip=_('Pull changes from selected'   ' repository')),   gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_GO_UP,   _('Outgoing'),   self._outgoing_clicked,   tip=_('Display local changes that will be pushed'   ' to selected repository')),   self._toolbutton(gtk.STOCK_GOTO_TOP,   _('Push'),   self._push_clicked,   tip=_('Push local changes to selected'   ' repository')),   self._toolbutton(gtk.STOCK_GOTO_LAST,   _('Email'),   self._email_clicked,   tip=_('Email local outgoing changes to'   ' one or more recipients')),   gtk.SeparatorToolItem(),   self._stop_button,   gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_PREFERENCES,   _('Configure'),   self._conf_clicked,   tip=_('Configure peer repository paths')),   gtk.SeparatorToolItem(),   ]   for btn in tbuttons:   self.tbar.insert(btn, -1)   vbox = gtk.VBox()   self.add(vbox)   vbox.pack_start(self.tbar, False, False, 2)     # sync target info   targethbox = gtk.HBox()   lbl = gtk.Button(_('Repo:'))   lbl.unset_flags(gtk.CAN_FOCUS)   lbl.connect('clicked', self._btn_remotepath_clicked)   targethbox.pack_start(lbl, False, False)     lbl = gtk.Button(_('Bundle:'))   lbl.unset_flags(gtk.CAN_FOCUS)   lbl.connect('clicked', self._btn_bundlepath_clicked)   targethbox.pack_start(lbl, False, False)     # revisions combo box   self.pathlist = gtk.ListStore(str, str)   self._pathbox = gtk.ComboBoxEntry(self.pathlist, 0)   self._pathtext = self._pathbox.get_child()   cell = gtk.CellRendererText()   self._pathbox.pack_end(cell, False)   self._pathbox.add_attribute(cell, 'text', 1)   targethbox.pack_start(self._pathbox, True, True)     self.fill_path_combo()   defrow = None   defpushrow = None   for i, (path, alias) in enumerate(self.pathlist):   if alias == 'default':   defrow = i   if defpushrow is None:   defpushrow = i   elif alias == 'default-push':   defpushrow = i     if repos:   self._pathtext.set_text(hglib.toutf(repos[0]))   elif defpushrow is not None and pushmode:   self._pathbox.set_active(defpushrow)   elif defrow is not None:   self._pathbox.set_active(defrow)     # support dropping of repos or bundle files   self.drag_dest_set(gtk.DEST_DEFAULT_ALL,   [("text/uri-list", 0, 1)], gtk.gdk.ACTION_COPY)   self.connect('drag_data_received', self._drag_receive)     # create checkbox to disable proxy   self._use_proxy = gtk.CheckButton(_('use proxy server'))   if ui.ui().config('http_proxy', 'host', ''):   self._use_proxy.set_active(True)   else:   self._use_proxy.set_sensitive(False)     frame = gtk.Frame(_('Post pull operation'))   ppvbox = gtk.VBox()   self.nothingradio = gtk.RadioButton(None, _('Nothing'))   self.updateradio = gtk.RadioButton(self.nothingradio, _('Update'))   self.fetchradio = gtk.RadioButton(self.nothingradio, _('Fetch'))   self.rebaseradio = gtk.RadioButton(self.nothingradio, _('Rebase'))   ppvbox.pack_start(self.nothingradio, True, True, 2)   ppvbox.pack_start(self.updateradio, True, True, 2)   ppvbox.pack_start(self.fetchradio, True, True, 2)   ppvbox.pack_start(self.rebaseradio, True, True, 2)   frame.add(ppvbox)   frame.set_border_width(2)     self.expander = expander = gtk.Expander(_('Advanced Options'))   expander.set_expanded(False)   expander.connect_after('activate', self._expanded)   hbox = gtk.HBox()   expander.add(hbox)     leftvbox = gtk.VBox()   leftvbox.pack_start(frame, False, False, 2)   leftvbox.pack_start(self._use_proxy, False, False, 3)     rightvbox = gtk.VBox()   rightvbox.pack_start(targethbox, False, False, 2)   rightvbox.pack_start(expander, True, True, 2)     tophbox = gtk.HBox()   tophbox.pack_start(rightvbox, True, True, 2)   tophbox.pack_start(leftvbox, False, False, 2)   vbox.pack_start(tophbox, False, False, 2)     revvbox = gtk.VBox()   self._reventry = gtk.Entry()   self._cmdentry = gtk.Entry()   self._force = gtk.CheckButton(_('Force pull or push'))   self.tips.set_tip(self._force, _('Run even when remote repository'   ' is unrelated.'))     revhbox = gtk.HBox()   revhbox.pack_start(gtk.Label(_('Target Revision:')), False, False, 2)   revhbox.pack_start(self._reventry, True, True, 2)   reveventbox = gtk.EventBox()   reveventbox.add(revhbox)   self.tips.set_tip(reveventbox, _('A specific revision up to which you'   ' would like to push or pull.'))     cmdhbox = gtk.HBox()   cmdhbox.pack_start(gtk.Label(_('Remote Command:')), False, False, 2)   cmdhbox.pack_start(self._cmdentry, True, True, 2)   cmdeventbox = gtk.EventBox()   cmdeventbox.add(cmdhbox)   self.tips.set_tip(cmdeventbox, _('Name of hg executable on remote'   ' machine.'))     revvbox.pack_start(self._force, False, False, 8)   revvbox.pack_start(reveventbox, True, True, 2)   revvbox.pack_start(cmdeventbox, True, True, 2)   hbox.pack_start(revvbox, True, True, 4)     frame = gtk.Frame(_('Incoming/Outgoing'))   hbox.pack_start(frame, False, False, 2)     self._showpatch = gtk.CheckButton(_('Show Patches'))   self._newestfirst = gtk.CheckButton(_('Show Newest First'))   self._nomerge = gtk.CheckButton(_('Show No Merges'))     iovbox = gtk.VBox()   iovbox.pack_start(self._showpatch, False, False, 2)   iovbox.pack_start(self._newestfirst, False, False, 2)   iovbox.pack_start(self._nomerge, False, False, 2)   frame.add(iovbox)     # hg output window   scrolledwindow = gtk.ScrolledWindow()   scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   self.textview = gtk.TextView(buffer=None)   self.textview.set_editable(False)   self.textview.modify_font(pango.FontDescription('Monospace'))   scrolledwindow.add(self.textview)   self.textview.set_editable(False)   self.textview.connect('populate-popup', self._add_to_popup)   self.textbuffer = self.textview.get_buffer()   vbox.pack_start(scrolledwindow, True, True)     self.buttonhbox = gtk.HBox()   self.viewpulled = gtk.Button(_('View pulled revisions'))   self.viewpulled.connect('clicked', self._view_pulled_changes)   self.updatetip = gtk.Button(_('Update to branch tip'))   self.updatetip.connect('clicked', self._update_to_tip)   self.buttonhbox.pack_start(self.viewpulled, False, False, 2)   self.buttonhbox.pack_start(self.updatetip, False, False, 2)   vbox.pack_start(self.buttonhbox, False, False, 2)     self.stbar = gtklib.StatusBar()   vbox.pack_start(self.stbar, False, False, 2)   self.connect('map', self.update_buttons)   self._last_drop_time = None     self.load_settings()   self.update_pull_setting()     def update_pull_setting(self):   ppull = self.repo.ui.config('tortoisehg', 'postpull', 'None')   self.nothingradio.set_active(True)   if ppull == 'update':   self.updateradio.set_active(True)   elif ppull == 'fetch':   self.fetchradio.set_active(True)   elif ppull == 'rebase':   self.rebaseradio.set_active(True)     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)])     def _drag_receive(self, widget, context, x, y, selection, targetType, time):   if time != self._last_drop_time:   files = selection.get_uris()   gobject.idle_add(self._set_path, files[0])   self._last_drop_time = time     def _set_path(self, uri):   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))     def update_buttons(self, *args):   self.buttonhbox.hide()   try:   # open a new repo, rebase can confuse cached repo   repo = hg.repository(ui.ui(), path=self.root)   except hglib.RepoError:   return   tip = len(repo.changelog)   if self.origchangecount == tip:   self.viewpulled.hide()   else:   self.buttonhbox.show()   self.viewpulled.show()     wc = repo[None]   branchhead = repo.branchtags()[wc.branch()]   parents = repo.parents()   if len(parents) > 1 or parents[0].node() == branchhead:   self.updatetip.hide()   else:   self.buttonhbox.show()   self.updatetip.show()   self.repo = repo     def _view_pulled_changes(self, button):   from history import GLog   countpulled = len(self.repo.changelog) - self.origchangecount   opts = {'limit' : countpulled, 'from-synch' : True}   dlg = GLog(self.ui, None, None, [], opts)   dlg.display()     def _update_to_tip(self, button):   # execute command and show output on text widget   gobject.timeout_add(10, self.process_queue)   self.write("", False)   cmdline = ['update', '-v']   self.hgthread = hgthread.HgThread(cmdline)   self.hgthread.start()   self.stbar.begin()   self.stbar.set_status_text('hg ' + ' '.join(cmdline))     def _get_paths(self, sort="value"):   """ retrieve symbolic paths """   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])   elif sort == "name":   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     def _btn_remotepath_clicked(self, button):   """ select source folder to clone """   dlg = gtk.FileChooserDialog(title=_('Select Repository'),   action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,   buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,   gtk.STOCK_OPEN,gtk.RESPONSE_OK))   dlg.set_default_response(gtk.RESPONSE_OK)   dlg.set_current_folder(self.root)   response = dlg.run()   if response == gtk.RESPONSE_OK:   self._pathtext.set_text(dlg.get_filename())   dlg.destroy()     def _btn_bundlepath_clicked(self, button):   """ select bundle to read from """   dlg = gtk.FileChooserDialog(title=_('Select Bundle'),   action=gtk.FILE_CHOOSER_ACTION_OPEN,   buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,   gtk.STOCK_OPEN,gtk.RESPONSE_OK))   dlg.set_default_response(gtk.RESPONSE_OK)   dlg.set_current_folder(self.root)   filefilter = gtk.FileFilter()   filefilter.set_name(_('Bundle (*.hg)'))   filefilter.add_pattern("*.hg")   dlg.add_filter(filefilter)   filefilter = gtk.FileFilter()   filefilter.set_name(_('Bundle (*)'))   filefilter.add_pattern("*")   dlg.add_filter(filefilter)   response = dlg.run()   if response == gtk.RESPONSE_OK:   self._pathtext.set_text(dlg.get_filename())   dlg.destroy()     def should_live(self):   if self._cmd_running():   dialog.error_dialog(self, _('Cannot close now'),   _('command is running'))   return True   else:   self.update_settings()   self._settings.write()   return False     def _delete(self, widget, event):   if not self.should_live():   self.destroy()     def _toolbutton(self, stock, label, handler,   menu=None, userdata=None, tip=None):   if menu:   tbutton = gtk.MenuToolButton(stock)   tbutton.set_menu(menu)   else:   tbutton = gtk.ToolButton(stock)     tbutton.set_label(label)   if tip:   tbutton.set_tooltip(self.tips, tip)   tbutton.connect('clicked', handler, userdata)   return tbutton     def _get_advanced_options(self):   opts = {}   if self._showpatch.get_active():   opts['patch'] = ['--patch']   if self._nomerge.get_active():   opts['no-merges'] = ['--no-merges']   if self._force.get_active():   opts['force'] = ['--force']   if self._newestfirst.get_active():   opts['newest-first'] = ['--newest-first']   remotecmd = self._cmdentry.get_text().strip()   if remotecmd != "":   opts['remotecmd'] = ['--remotecmd', remotecmd]   target_rev = self._reventry.get_text().strip()   if target_rev != "":   opts['rev'] = ['--rev', target_rev]     return opts     def _pull_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   if self.fetchradio.get_active():   cmd = ['fetch', '--message', 'merge']   # load the fetch extensions explicitly   extensions.load(self.ui, 'fetch', None)   else:   cmd = ['pull']   cmd += aopts.get('force', [])   cmd += aopts.get('remotecmd', [])   if self.updateradio.get_active():   cmd.append('--update')   elif self.rebaseradio.get_active():   cmd.append('--rebase')   # load the rebase extensions explicitly   extensions.load(self.ui, 'rebase', None)   cmd += aopts.get('rev', [])   self._exec_cmd(cmd)     def _push_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['push']   cmd += aopts.get('rev', [])   cmd += aopts.get('force', [])   cmd += aopts.get('remotecmd', [])   self._exec_cmd(cmd)     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   from thgconfig import ConfigDialog   dlg = ConfigDialog(True)   dlg.show_all()   if newpath:   dlg.new_path(newpath)   else:   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()     def _email_clicked(self, toolbutton, data=None):   opts = []   path = hglib.fromutf(self._pathtext.get_text()).strip()   rev = self._get_advanced_options().get('rev')   if path:   opts.extend(['--outgoing', path])   elif not rev:   dialog.info_dialog(self, _('No repository selected'),   _('Select a peer repository to compare with'))   self._pathbox.grab_focus()   return   if rev:   opts.extend(rev)   from hgemail import EmailDialog   dlg = EmailDialog(self.root, opts)   dlg.set_transient_for(self)   dlg.show_all()   dlg.present()   dlg.set_transient_for(None)     def _incoming_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['incoming']   cmd += aopts.get('rev', [])   cmd += aopts.get('patch', [])   cmd += aopts.get('no-merges', [])   cmd += aopts.get('force', [])   cmd += aopts.get('newest-first', [])   cmd += aopts.get('remotecmd', [])   self._exec_cmd(cmd)     def _outgoing_clicked(self, toolbutton, data=None):   aopts = self._get_advanced_options()   cmd = ['outgoing']   cmd += aopts.get('rev', [])   cmd += aopts.get('patch', [])   cmd += aopts.get('no-merges', [])   cmd += aopts.get('force', [])   cmd += aopts.get('newest-first', [])   cmd += aopts.get('remotecmd', [])   self._exec_cmd(cmd)     def _stop_clicked(self, toolbutton, data=None):   if self._cmd_running():   self.hgthread.terminate()   self._stop_button.set_sensitive(False)     def _exec_cmd(self, cmd):   if self._cmd_running():   dialog.error_dialog(self, _('Cannot run now'),   _('Please try again after the previous command is completed'))   return     self._stop_button.set_sensitive(True)     proxy_host = ui.ui().config('http_proxy', 'host', '')   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):   remote_path = path     cmdline = cmd[:]   cmdline += ['--verbose', '--repository', self.root]   if proxy_host and not use_proxy:   cmdline += ["--config", "http_proxy.host="]   cmdline += [remote_path]     # show command to be executed   self.write("", False)     # execute command and show output on text widget   gobject.timeout_add(10, self.process_queue)   self.hgthread = hgthread.HgThread(cmdline, parent=self)   self.hgthread.start()   self.stbar.begin()   self.stbar.set_status_text('hg ' + ' '.join(cmd + [remote_path]))     self._add_src_to_recent(remote_path)     def _cmd_running(self):   if self.hgthread and self.hgthread.isAlive():   return True   else:   return False     def _add_src_to_recent(self, src):   if os.path.exists(src):   src = os.path.abspath(src)     # save src path to recent list in history (read by clone tool)   self._settings.mrul('src_paths').add(src)   self._settings.write()     # update drop-down list   self.fill_path_combo()     def write(self, msg, append=True):   msg = hglib.toutf(msg)   if append:   enditer = self.textbuffer.get_end_iter()   self.textbuffer.insert(enditer, msg)   self.textview.scroll_to_mark(self.textbuffer.get_insert(), 0)   else:   self.textbuffer.set_text(msg)     def process_queue(self):   """   Handle all the messages currently in the queue (if any).   """   self.hgthread.process_dialogs()   while self.hgthread.getqueue().qsize():   try:   msg = self.hgthread.getqueue().get(0)   self.write(msg)   except Queue.Empty:   pass     if self._cmd_running():   return True   else:   # Update button states   self.update_buttons()   self.stbar.end()   self._stop_button.set_sensitive(False)   if self.hgthread.return_code() is None:   self.write(_('[command interrupted]'))   return False # Stop polling this function     AdvancedDefaults = {   'expander.expanded': False,   '_reventry.text': '',   '_cmdentry.text': '',   '_force.active': False,   '_showpatch.active': False,   '_newestfirst.active': False,   '_nomerge.active': False,}     def _expanded(self, expander):   if not expander.get_expanded():   self.load_settings(SynchDialog.AdvancedDefaults.get)     def load_settings(self, get_value = None):   get_value = get_value or self._settings.get_value   for key, default in SynchDialog.AdvancedDefaults.iteritems():   member, attr = key.split('.')   value = get_value(key, default)   getattr(getattr(self, member), 'set_%s'%attr)(value)     def update_settings(self, set_value = None):   set_value = set_value or self._settings.set_value   for key, default in SynchDialog.AdvancedDefaults.iteritems():   member, attr = key.split('.')   value = getattr(getattr(self, member), 'get_%s'%attr)()   set_value(key, value)     def _add_to_popup(self, textview, menu):   menu_items = (('----', None),   (_('Toggle _Wordwrap'), self._toggle_wordwrap),   )   for label, handler in menu_items:   if label == '----':   menuitem = gtk.SeparatorMenuItem()   else:   menuitem = gtk.MenuItem(label)   if handler:   menuitem.connect('activate', handler)   menu.append(menuitem)   menu.show_all()     def _toggle_wordwrap(self, sender):   if self.textview.get_wrap_mode() != gtk.WRAP_NONE:   self.textview.set_wrap_mode(gtk.WRAP_NONE)   else:   self.textview.set_wrap_mode(gtk.WRAP_WORD)      def run(ui, *pats, **opts):   return SynchDialog(pats, opts.get('pushmode'))
 
14
15
16
17
18
19
 
20
21
22
 
369
370
371
372
 
373
374
375
 
460
461
462
463
 
464
465
466
 
14
15
16
 
 
 
17
18
19
20
 
367
368
369
 
370
371
372
373
 
458
459
460
 
461
462
463
464
@@ -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()
Change 1 of 2 Show Entire File hggtk/​update.py Stacked
 
12
13
14
15
 
16
17
18
 
32
33
34
35
 
36
37
38
 
12
13
14
 
15
16
17
18
 
32
33
34
 
35
36
37
38
@@ -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
Change 1 of 3 Show Entire File hggtk/​visdiff.py Stacked
 
19
20
21
22
23
 
24
25
26
 
105
106
107
108
 
109
110
111
 
267
268
269
270
 
271
272
273
 
19
20
21
 
 
22
23
24
25
 
104
105
106
 
107
108
109
110
 
266
267
268
 
269
270
271
272
@@ -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
 
 
2
3
4
 
5
6
7
8
9
 
10
11
12
 
132
133
134
135
 
136
137
138
 
158
159
160
161
 
162
163
164
 
183
184
185
186
 
187
188
189
 
1
2
3
4
 
 
5
6
 
 
 
 
7
8
9
10
 
130
131
132
 
133
134
135
136
 
156
157
158
 
159
160
161
162
 
181
182
183
 
184
185
186
187
@@ -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)
Change 1 of 3 Show Entire File thgutil/​hglib.py Stacked
 
10
11
12
13
14
15
16
 
17
 
18
19
20
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 
204
205
206
207
 
208
209
210
 
10
11
12
 
13
14
15
16
17
18
19
20
21
 
74
75
76
 
 
 
 
 
 
 
 
 
 
 
 
77
78
79
 
193
194
195
 
196
197
198
199
@@ -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
5
6
 
 
 
 
7
8
9
10
11
12
13
14
15
 
 
16
17
18
 
122
123
124
125
 
126
127
128
129
130
 
131
132
133
 
4
5
6
7
8
9
10
11
 
 
 
 
 
 
 
 
12
13
14
15
16
 
120
121
122
 
123
124
125
126
127
 
128
129
130
131
@@ -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
Change 1 of 1 Show Entire File thgutil/​paths.py Stacked
 
13
14
15
16
17
 
 
18
19
20
 
13
14
15
 
 
16
17
18
19
20
@@ -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)