Mercurial > hg
changeset 23186:6de61d0b773f
largefiles: introduce "_lfcommithooks" to abstract pre-committing procedures
This changes allows to customize pre-committing procedures according
to conditions.
This patch uses "stack" with an element instead of flag like
"_isXXXXing" or so, because:
- the former works correctly even when customizations are nested, and
- ensuring at least one element can ignore empty check
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 05 Nov 2014 23:24:47 +0900 |
parents | 9870173e0b48 |
children | f726b05ecfe6 |
files | hgext/largefiles/reposetup.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py Wed Nov 05 23:24:47 2014 +0900 +++ b/hgext/largefiles/reposetup.py Wed Nov 05 23:24:47 2014 +0900 @@ -262,7 +262,8 @@ wlock = self.wlock() try: - match = lfutil.updatestandinsbymatch(self, match) + lfcommithook = self._lfcommithooks[-1] + match = lfcommithook(self, match) result = orig(text=text, user=user, date=date, match=match, force=force, editor=editor, extra=extra) return result @@ -338,6 +339,10 @@ repo.__class__ = lfilesrepo + # stack of hooks being executed before committing. + # only last element ("_lfcommithooks[-1]") is used for each committing. + repo._lfcommithooks = [lfutil.updatestandinsbymatch] + def prepushoutgoinghook(local, remote, outgoing): if outgoing.missing: toupload = set()