mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-22 21:16:16 +01:00
- fixed bug #10 ("Traceback of an error in an exception handler")
Changed behaviour of "osc mv". Now it is also possible to move files between different packages, that is "osc mv pkg1/foo pkg2/bar".
This commit is contained in:
parent
dba6930267
commit
dd48ee4730
@ -7154,13 +7154,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
raise oscerr.WrongArgs("Source file ``%s'' does not exists" % source)
|
raise oscerr.WrongArgs("Source file ``%s'' does not exists" % source)
|
||||||
if not opts.force and os.path.isfile(dest):
|
if not opts.force and os.path.isfile(dest):
|
||||||
raise oscerr.WrongArgs("Dest file ``%s'' already exists" % dest)
|
raise oscerr.WrongArgs("Dest file ``%s'' already exists" % dest)
|
||||||
if not is_package_dir('.'):
|
src_pkg = findpacs([source])
|
||||||
raise oscerr.NoWorkingCopy("Error: \"%s\" is not an osc working copy." % os.path.abspath(dir))
|
tgt_pkg = findpacs([dest])
|
||||||
|
if not src_pkg:
|
||||||
|
raise oscerr.NoWorkingCopy("Error: \"%s\" is not located in an osc working copy." % os.path.abspath(source))
|
||||||
|
if not tgt_pkg:
|
||||||
|
raise oscerr.NoWorkingCopy("Error: \"%s\" does not point to an osc working copy." % os.path.abspath(dest))
|
||||||
|
|
||||||
p = findpacs('.')[0]
|
|
||||||
os.rename(source, dest)
|
os.rename(source, dest)
|
||||||
self.do_add(subcmd, opts, dest)
|
try:
|
||||||
self.do_delete(subcmd, opts, source)
|
tgt_pkg[0].addfile(os.path.basename(dest))
|
||||||
|
except oscerr.PackageFileConflict:
|
||||||
|
# file is already tracked
|
||||||
|
pass
|
||||||
|
src_pkg[0].delete_file(os.path.basename(source), force=opts.force)
|
||||||
|
|
||||||
@cmdln.option('-d', '--delete', action='store_true',
|
@cmdln.option('-d', '--delete', action='store_true',
|
||||||
help='delete option from config or reset option to the default)')
|
help='delete option from config or reset option to the default)')
|
||||||
|
Loading…
Reference in New Issue
Block a user