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

rename: replace all relative imports

Changeset 24b21b62f1d5

Parent 37792d6a7d99

by Steve Borho

Changes to one file · Browse files at 24b21b62f1d5 Showing diff from parent 37792d6a7d99 Diff from another changeset...

Change 1 of 2 Show Changes Only hggtk/​rename.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
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
 #  # rename.py - TortoiseHg's dialogs for handling renames  #  # Copyright (C) 2009 Steve Borho <steve@borho.org>  #    import sys  import gtk  import cStringIO    from mercurial import hg, ui, util, commands    from thgutil.i18n import _  from thgutil import hglib, paths   +from hggtk import dialog +  def run(ui, *pats, **opts):   fname, target = '', ''   try:   fname = pats[0]   target = pats[1]   except IndexError:   pass - from dialog import entry_dialog   fname = util.normpath(fname)   if target:   target = hglib.toutf(util.normpath(target))   else:   target = hglib.toutf(fname)   title = 'Rename ' + hglib.toutf(fname) - dlg = entry_dialog(None, title, True, target, rename_resp) + dlg = dialog.entry_dialog(None, title, True, target, rename_resp)   dlg.orig = fname   return dlg    def rename_resp(dlg, response):   if response != gtk.RESPONSE_OK:   dlg.destroy()   return   try:   root = paths.find_root()   repo = hg.repository(ui.ui(), root)   except (ImportError, hglib.RepoError):   dlg.destroy()   return     new_name = hglib.fromutf(dlg.entry.get_text())   opts = {}   opts['force'] = False # Checkbox? Nah.   opts['after'] = False   opts['dry_run'] = False     saved = sys.stderr   errors = cStringIO.StringIO()   toquit = False   try:   sys.stderr = errors   repo.ui.pushbuffer()   repo.ui.quiet = True   try:   commands.rename(repo.ui, repo, dlg.orig, new_name, **opts)   toquit = True   except (util.Abort, hglib.RepoError), inst:   dlg.error_dialog(None, _('rename error'), str(inst))   toquit = False   finally:   sys.stderr = saved   textout = errors.getvalue() + repo.ui.popbuffer()   errors.close()   if len(textout) > 1:   dlg.error_dialog(None, _('rename error'), textout)   elif toquit:   dlg.destroy()