[PLUGIN] bzr changeset, time to pull again
Robey Pointer
robey at lag.net
Fri Jul 8 08:30:31 BST 2005
On 7 Jul 2005, at 1:20, John A Meinel wrote:
> Robey Pointer wrote:
>
>
>>
>> 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. :)
>>
>
> I would generally like to avoid escaped characters (especially an
> escaped space).
> These are meant to be human readable changesets, and I think seeing
> "my\u0020file.txt" is pretty ugly.
Yeah, sorry, I wasn't clear. (I tend to jump ahead when thinking
aloud.) The point would be to only quote a space that's at the
beginning or end of a filename, an extremely rare place for a space
to be.
"my file.txt"
"nasa/fake/alien moon landing.mpeg"
"extremely odd filename \u0020"
Thus assuring that strip() on the split-out filenames would work.
robey
More information about the bazaar
mailing list