[PLUGIN] bzr changeset, time to pull again

Robey Pointer robey at lag.net
Thu Jul 7 08:17:22 BST 2005


On 4 Jul 2005, at 16:42, John A Meinel wrote:

> Robey Pointer wrote:
>
>
>> If you normalize the path, then "//" would be an unambiguous
>> terminator (and you could follow with spaces for readability):
>>
> You actually bring up a potentially better solution. Make the  
> separator
> ' // ' Then things look like
> landing/on/the moon.txt // file-id:the  
> moon.txt-12389127-123871223784 //
> text-id:the moon.txt-123123123
>
> You can also detect files that end in a space, because they will have
> too many spaces.
> So you would have:
>
> myfile  // file-id:myfile -1231231235-134134 // text-id:myfile
> -12312312-123123
>
> And parsing becomes a simple:
> parts = txt.split(' // ')

Actually if you did something like this

def quote_path(s):
     s = s.encode('unicode_escape')
     if s[0] == ' ':
         s = '\\u0020' + s[1:]
     if s[-1] == ' ':
         s = s[:-1] + '\\u0020'
     return s

then the path would be guaranteed not to start or end with a space,  
and you could do split('//') and strip() the elements.

I'm probably overthinking this. :)

robey





More information about the bazaar mailing list