1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 08:56:13 +01:00

Merge pull request #1570 from dmach/fix-mv

Fix 'mv' command when renaming a file multiple times
This commit is contained in:
Daniel Mach 2024-05-27 08:49:59 +02:00 committed by GitHub
commit e981645791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 0 deletions

View File

@ -19,3 +19,36 @@ Scenario: Run `osc mv <file> <new-name>` in a package checkout
"""
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes" does not exist
And file "{context.osc.temp}/test:factory/test-pkgA/new-name.changes" exists
Scenario: Run `osc mv <file> <new-name>` several times
When I execute osc with args "mv test-pkgA.changes test-pkgA.changes-1"
Then the exit code is 0
And I execute osc with args "status"
And stdout is
"""
D test-pkgA.changes
A test-pkgA.changes-1
"""
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes" does not exist
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes-1" exists
When I execute osc with args "mv test-pkgA.changes-1 test-pkgA.changes-2"
Then the exit code is 0
And I execute osc with args "status"
And stdout is
"""
D test-pkgA.changes
A test-pkgA.changes-2
"""
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes" does not exist
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes-2" exists
When I execute osc with args "mv test-pkgA.changes-2 test-pkgA.changes-3"
Then the exit code is 0
And I execute osc with args "status"
And stdout is
"""
D test-pkgA.changes
A test-pkgA.changes-3
"""
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes" does not exist
And file "{context.osc.temp}/test:factory/test-pkgA/test-pkgA.changes-3" exists

View File

@ -9887,6 +9887,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
except oscerr.PackageFileConflict:
# file is already tracked
pass
# instantiate src_pkg *again* to load fresh state from .osc that was written on deleting a file in tgt_pkg
# it would be way better to use a single Package instance where possible
src_pkg = Package(source)
src_pkg.delete_file(os.path.basename(source), force=opts.force)
@cmdln.option('-d', '--delete', action='store_true',