line endings and Cygwin

Alexander Belchenko bialix at ukr.net
Tue Apr 12 09:45:28 BST 2005


Hi!
I'm have some difficulties with bzr on Windows (bzr unable to work with 
files in subdirectories because os.sep for Windows is '\\' not '/').
So I run bzr on Cygwin. On cygwin I have trouble with 'bzr status' 
command (log info from .bzr.log):

bzr: exception: [Errno 2] No such file or directory: 
'/cygdrive/e/temp/filename/.bzr/revision-store/bialix at bialix-20050412073931-40090f94a636f00b\r'
(see $HOME/.bzr.log for debug information)
Traceback (most recent call last):
   File "/home/bialix/bzr/bzr.dev/bzrlib/commands.py", line 1002, in main
     ret = run_bzr(argv)
   File "/home/bialix/bzr/bzr.dev/bzrlib/commands.py", line 988, in run_bzr
     return cmd_handler(**cmdargs) or 0
   File "/home/bialix/bzr/bzr.dev/bzrlib/commands.py", line 131, in 
cmd_status
     Branch('.').show_status(show_all=all)
   File "/home/bialix/bzr/bzr.dev/bzrlib/branch.py", line 870, in 
show_status
     old = self.basis_tree()
   File "/home/bialix/bzr/bzr.dev/bzrlib/branch.py", line 696, in basis_tree
     return RevisionTree(self.text_store, self.get_revision_inventory(r))
   File "/home/bialix/bzr/bzr.dev/bzrlib/branch.py", line 606, in 
get_revision_inventory
     return self.get_inventory(self.get_revision(revision_id).inventory_id)
   File "/home/bialix/bzr/bzr.dev/bzrlib/branch.py", line 586, in 
get_revision
     r = Revision.read_xml(self.revision_store[revision_id])
   File "/home/bialix/bzr/bzr.dev/bzrlib/store.py", line 136, in __getitem__
     return file(p, 'rb')
IOError: [Errno 2] No such file or directory: 
'/cygdrive/e/temp/filename/.bzr/revision-store/bialix at bialix-20050412073931-40090f94a636f00b\r'

As you see in the end of filename with id presents '\r' symbol. It is 
strange, but `revision-history` file is created with line-endings 
'\r\n'. Workaround for this very simple: we can open text file by 
default with mode 'rU' (universal line-endings). I change default mode 
in function `controlfile` of class `Branch` in this manner:

     def controlfile(self, file_or_path, mode='rU'):

--
Alexander
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: branch_py.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050412/dffce3ac/attachment.diff 


More information about the bazaar mailing list