[MERGE] Implement hard-link support for branch and checkout

Matt Nordhoff mnordhoff at mattnordhoff.com
Thu Jan 3 08:45:27 GMT 2008


Andrew Bennetts wrote:
> Ian Clatworthy wrote:
>> Aaron Bentley wrote:
> [...]
>>> +    def create_hardlink(self, path, trans_id):
>>> +        """Schedule creation of a hard link"""
>>> +        name = self._limbo_name(trans_id)
>>> +        os.link(path, name)
>>> +        try:
>>> +            unique_add(self._new_contents, trans_id, 'file')
>>> +        except:
>>> +            # Clean up the file, it never got registered so
>>> +            # TreeTransform.finalize() won't clean it up.
>>> +            os.unlink(name)
>>> +            raise
>>> +
>> Bare except clauses are considered bad. Please be explicit about the
>> class of exceptions being caught.
> 
> This one is fine: it immediately re-raises the original exception.  It is just
> making sure that things get cleaned up if an exception is raised, and it's about
> as idiomatic as it can be.
> 
> -Andrew.

finally block?
-- 



More information about the bazaar mailing list