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

stable hglib: add utility function to load and initialize an extension

Remove redundant calls to extensions.loadall(), which is already done by
hgtk.py before any dialogs are launched.

Fixes #809

Changeset 01cfbbba74b0

Parent 91703c3411ba

by Steve Borho

Changes to 4 files · Browse files at 01cfbbba74b0 Showing diff from parent 91703c3411ba Diff from another changeset...

 
179
180
181
182
 
183
184
185
 
179
180
181
 
182
183
184
185
@@ -179,7 +179,7 @@
  hbox.pack_start(gtk.Label(_('Subject:')), False, False, 4)   hbox.pack_start(self._subjbox, True, True, 4)   - extensions.load(ui.ui(), 'patchbomb', None) + hglib.loadextension(ui.ui(), 'patchbomb')     # --flags was added after hg 1.3   hasflags = False
 
54
55
56
57
58
59
60
61
62
 
1141
1142
1143
1144
 
1145
1146
1147
 
1149
1150
1151
1152
 
1153
1154
1155
 
1299
1300
1301
1302
 
1303
1304
1305
 
1307
1308
1309
1310
 
1311
1312
1313
 
54
55
56
 
 
 
57
58
59
 
1138
1139
1140
 
1141
1142
1143
1144
 
1146
1147
1148
 
1149
1150
1151
1152
 
1296
1297
1298
 
1299
1300
1301
1302
 
1304
1305
1306
 
1307
1308
1309
1310
@@ -54,9 +54,6 @@
  self.forcepush = False   self.bundle_autoreject = False   os.chdir(self.repo.root) - - # Load extension support for commands which need it - extensions.loadall(self.ui)   self.exs = [ name for name, module in extensions.extensions() ]     def get_help_url(self): @@ -1141,7 +1138,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   if ppull == 'update': @@ -1149,7 +1146,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')     cmdline = ['hg'] + cmd + [self.bfile]   dlg = hgcmd.CmdDialog(cmdline) @@ -1299,7 +1296,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   if ppull == 'update': @@ -1307,7 +1304,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')     path = hglib.fromutf(self.pathentry.get_text()).strip()   remote_path = hglib.validate_synch_path(path, self.repo)
 
147
148
149
150
151
152
153
 
445
446
447
448
 
449
450
451
 
455
456
457
458
 
459
460
461
 
147
148
149
 
150
151
152
 
444
445
446
 
447
448
449
450
 
454
455
456
 
457
458
459
460
@@ -147,7 +147,6 @@
  elif defrow is not None:   self.pathbox.set_active(defrow)   - extensions.loadall(self.ui)   exs = [ name for name, module in extensions.extensions() ]     # Post Pull Operation @@ -445,7 +444,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   cmd += aopts.get('force', []) @@ -455,7 +454,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')   cmd += aopts.get('rev', [])   self.exec_cmd(cmd)  
 
124
125
126
 
 
 
 
 
 
 
 
 
 
127
128
129
 
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
@@ -124,6 +124,16 @@
  if 'mq' in repo.__dict__: #do not create if it does not exist   repo.mq.invalidate()   +def loadextension(ui, name): + # Between Mercurial revisions 1.2 and 1.3, extensions.load() stopped + # calling uisetup() after loading an extension. This could do + # unexpected things if you use an hg version < 1.3 + extensions.load(ui, name, None) + mod = extensions.find(name) + uisetup = getattr(mod, 'uisetup', None) + if uisetup: + uisetup(ui) +  def canonpaths(list):   'Get canonical paths (relative to root) for list of files'   # This is a horrible hack. Please remove this when HG acquires a