[Bug] 'bzr add --dry-run' actually added files

Alexander Belchenko bialix at ukr.net
Wed Aug 16 09:10:57 BST 2006


Martin Pool пишет:
> On 15 Aug 2006, Alexander Belchenko <bialix at ukr.net> wrote:
>> Alexander Belchenko пишет:
>>> I was very surprised when I saw that 'bzr add --dry-run' actually added 
>>> files! This reproducible on win32 and Slackware Linux too.
>> Error actually in module bzrlib.add function smart_add():
>>
>> def smart_add(file_list, recurse=True, action=None, save=True):
>>      """Add files to version, optionally recursing into directories.
>>
>>      This is designed more towards DWIM for humans than API simplicity.
>>      For the specific behaviour see the help for cmd_add().
>>
>>      Returns the number of files added.
>>      Please see smart_add_tree for more detail.
>>      """
>>      file_list = _prepare_file_list(file_list)
>>      tree = WorkingTree.open_containing(file_list[0])[0]
>>      return smart_add_tree(tree, file_list, recurse, action=action)
>>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--here
>>
>> When smart_add_tree invoked argument save is omitted therefore
>> '--dry-run' never works. Attached obvious fix for this problem. 
> 
> Thanks, merged to my integration branch.
> 
>> I don't
>> wrote test because on win32 this kind of tests fails because of problem
>> with .bazaar/ vs. bazaar/2.0/ in testing directory. I simply cannot
>> clearly test this on my win32.

Here is patch with simple blackbox test for this problem. Test fails
without fix and pass with my fix.

--
Alexander

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: add-dry-run-test.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20060816/7cf79bb0/attachment.diff 


More information about the bazaar mailing list