From: Karl Hasselström Date: Sun, 22 Jun 2008 15:27:58 GMT Subject: Re: [StGIT PATCH 2/4] Implement a new patch identification scheme and id command Message-ID: <20080622152758.GB4468@diana.vm.bytemark.co.uk> In-Reply-To: <20080619214210.27794.76950.stgit@localhost.localdomain> On 2008-06-19 22:42:10 +0100, Catalin Marinas wrote: > The new scheme allows '[:]' and '[:]{base}' > (the latter showing the base of a stack). The former format allows > symbols like ^ and ^{...}. Hmm. Why only the former? Supporting it for the latter should be easy. (Though it would take some extra work, I guess.) Other than that, it looks good to me. > +def git_commit(name, repository, branch = None): > + """Return the a Commit object if 'name' is a patch name or Git commit. > + The patch names allowed are in the form ':' and can be > + followed by standard symbols used by git-rev-parse. If is '{base}', Long line. > + # The stack base > + if patch == '{base}': > + return repository.get_stack(branch).base Should be a simple matter of if patch.startswith('{base}'): foo = repository.get_stack(branch).base + drop_prefix(patch, '{base}') return repository.rev_parse(foo) or something. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle