custom-properties

Custom revision properties in Mercurial?

点点圈 提交于 2019-12-01 22:46:06
Can I setup a custom property for my hg repository so that I could store/retrieve its value for each revision? Like, weather in Tokyo at the time of commit, etc. Same for git? VonC This could be a job for: a pre-commit hook in Mercurial (not a precommit hook which runs before the internal commit occurs, when the list of files to commit is already known. But "pre-commit", a generic hook which runs before the commit begin) a git pre-commit hook (but you need to add your file with the updated weather information to the list of files to be committed ) In both cases, said hooks would get the

Adding custom properties to a function

可紊 提交于 2019-11-26 18:18:48
Searching for appropriate answer proved difficult because of the existence of many other problems related to my keywords, so I'll ask this here. As we know, functions in javascript are objects and they have their own properties and methods (more properly, function istances, inherited from Function.prototype). I was considering adding custom properties for one function (method), let's skip the "why?" part and go straight to the code: var something = { myMethod: function () { if (something.myMethod.someProperty === undefined) { something.myMethod.someProperty = "test"; } console.log(something

Adding custom properties to a function

十年热恋 提交于 2019-11-26 12:18:43
问题 Searching for appropriate answer proved difficult because of the existence of many other problems related to my keywords, so I\'ll ask this here. As we know, functions in javascript are objects and they have their own properties and methods (more properly, function istances, inherited from Function.prototype). I was considering adding custom properties for one function (method), let\'s skip the \"why?\" part and go straight to the code: var something = { myMethod: function () { if (something