[MERGE] don't invoke os.rename on children with no contents

Robert Collins robertc at robertcollins.net
Wed Jun 6 03:10:10 BST 2007


On Tue, 2007-06-05 at 21:48 -0400, Aaron Bentley wrote:
> Perhaps it would be clearer to scrag the from_scratch parameter, and
> do
> this:
> 
>      for trans_id in trans_ids:
>          old_path = self._limbo_files[trans_id]
>          del self._limbo_files[trans_id]
>          if trans_id in self._new_contents:
>              new_path = self._limbo_name(trans_id)
>              os.rename(old_path, new_path)
> 
> What do you think?

Thats certainly easier for me to grok.

How about:

     for trans_id in trans_ids:
         old_path = self._limbo_files.pop(trans_id)
         if trans_id in self._new_contents:
             new_path = self._limbo_name(trans_id)
             os.rename(old_path, new_path)

I think thats slightly clearer still.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070606/f167ed98/attachment.pgp 


More information about the bazaar mailing list