##// END OF EJS Templates
commitextras: work nicely with other extensions...
Valentin Gatien-Baron -
r39330:1cb7c977 default
parent child Browse files
Show More
@@ -17,6 +17,7 b' from mercurial import ('
17 17 error,
18 18 extensions,
19 19 registrar,
20 util,
20 21 )
21 22
22 23 cmdtable = {}
@@ -43,9 +44,10 b' def extsetup(ui):'
43 44 _('set a changeset\'s extra values'), _("KEY=VALUE")))
44 45
45 46 def _commit(orig, ui, repo, *pats, **opts):
46 origcommit = repo.commit
47 try:
48 def _wrappedcommit(*innerpats, **inneropts):
47 if util.safehasattr(repo, 'unfiltered'):
48 repo = repo.unfiltered()
49 class repoextra(repo.__class__):
50 def commit(self, *innerpats, **inneropts):
49 51 extras = opts.get(r'extra')
50 52 if extras:
51 53 for raw in extras:
@@ -66,11 +68,6 b' def _commit(orig, ui, repo, *pats, **opt'
66 68 "manually")
67 69 raise error.Abort(msg % k)
68 70 inneropts[r'extra'][k] = v
69 return origcommit(*innerpats, **inneropts)
70
71 # This __dict__ logic is needed because the normal
72 # extension.wrapfunction doesn't seem to work.
73 repo.__dict__[r'commit'] = _wrappedcommit
74 return orig(ui, repo, *pats, **opts)
75 finally:
76 del repo.__dict__[r'commit']
71 return super(repoextra, self).commit(*innerpats, **inneropts)
72 repo.__class__ = repoextra
73 return orig(ui, repo, *pats, **opts)
General Comments 0
You need to be logged in to leave comments. Login now