Re: [PATCH 2/4] Implement a new patch identification scheme and id command
- From
Karl Hasselström <kha@treskal.com>
- Date
- Jul 14, 2008, 06:58 UTC
- Message-ID
- <20080714065814.GF20751@diana.vm.bytemark.co.uk>
- In-Reply-To
- <20080713114035.18845.45056.stgit@localhost.localdomain>
On 2008-07-13 12:40:35 +0100, Catalin Marinas wrote:
> The new scheme allows '[<branch>:]<patch>' and '[<branch>:]{base}'
> (the latter showing the base of a stack). The former format allows
> symbols like ^ and ^{...}.You changed it, so s/The former format allows/You may append/ or something.
> + # The stack base
> + if patch.startswith('{base}'):
> + base_id = repository.get_stack(branch).base.sha1
> + return repository.rev_parse(base_id + patch[6:])We have a strip_prefix() function precisely so that we can avoid error-prone and not-so-easy-to-read constants like that "6" ...
Hmm. I see that I feel strongly enough about this that I've defined no less than two identical functions in utils.py to do this job: strip_prefix() and strip_leading(). :-)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle