"bzr shelve" can fail on files in cygwin

Bug #301639 reported by John Carlyle-Clarke
2
Affects Status Importance Assigned to Milestone
BzrTools
New
Undecided
Mario Đanić

Bug Description

bzr shelve often fails at the end of the process (after successfully creating the patches) with the error:-

  bzr: ERROR: Failed removing shelved changes from theworking tree!

Sample from log:-

0.270 encoding stdout as sys.stdout encoding 'US-ASCII'
0.270 bzr arguments: [u'shelve', u'Controls/DeviceSelect.ascx', u'Controls/DeviceSelect.ascx.cs']
0.270 looking for plugins in /home/johncc/.bazaar/plugins
0.600 looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
0.600 Plugin name __init__ already loaded
0.600 Plugin name __init__ already loaded
0.630 encoding stdout as sys.stdout encoding 'US-ASCII'
0.921 opening working tree '/cygdrive/c/projects/website/thurayarelay/web'
11.726 Traceback (most recent call last):
  File "commands.py", line 849, in run_bzr_catch_errors
  File "commands.py", line 795, in run_bzr
  File "/home/johncc/.bazaar/plugins/bzrtools/command.py", line 13, in run_argv_aliases
    commands.Command.run_argv_aliases(self, argv, alias_argv)
  File "commands.py", line 495, in run_argv_aliases
  File "/home/johncc/.bazaar/plugins/bzrtools/__init__.py", line 227, in run
    s.shelve(source, all, message, no_color)
  File "/home/johncc/.bazaar/plugins/bzrtools/shelf.py", line 244, in shelve
    raise CommandError("Failed removing shelved changes from the"
BzrCommandError: Failed removing shelved changes from theworking tree!

11.726 return code 3

Experimenting seems to show that it works with files created with Cygwin tools (e.g. vi). I believe it's related to line endings in Windows files combined with the Cygwin/Windows behaviour for text files.

For me, this change in run_patch in patch.py (version 1.8) fixes it.

$ diff bzrtools/patch.py ~/.bazaar/plugins/bzrtools/patch.py
43c43
< if sys.platform == "win32":
---
> if sys.platform == "win32" or sys.platform == "cygwin":

This causes the "--binary" to be used in cygwin as well as win32.

Tags: windows
Revision history for this message
John Carlyle-Clarke (jpcc) wrote :

As requested in #bzr by pygi

Changed in bzrtools:
assignee: nobody → mario-danic
Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 301639] [NEW] "bzr shelve" can fail on files in cygwin

John Carlyle-Clarke wrote:
> Public bug reported:
>
> bzr shelve often fails at the end of the process (after successfully
> creating the patches) with the error:-
>
> bzr: ERROR: Failed removing shelved changes from theworking tree!

Note that this implementation of shelf will be superseded by the in-core
implementation of shelf in bzr 1.10, though it will be retained for
legacy purposes.

Aaron

Revision history for this message
John Carlyle-Clarke (jpcc) wrote :

My humble suggestion would be to search the current code for all cases where platform is tested against "win32" and see if "cygwin" should also be included in that test.

Jelmer Vernooij (jelmer)
tags: added: windows
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.