1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-23 05:26:16 +01:00

- do_mv: minor cosmetic changes

This commit is contained in:
Marcus Huewe 2013-02-28 00:30:05 +01:00
parent 1d3805f30e
commit 45e49905ce

View File

@ -7628,9 +7628,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
""" """
if not os.path.isfile(source): if not os.path.isfile(source):
raise oscerr.WrongArgs("Source file ``%s'' does not exists" % source) raise oscerr.WrongArgs("Source file '%s' does not exists or is no file" % 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 os.path.isdir(dest):
dest = os.path.join(dest, os.path.basename(source))
src_pkg = findpacs([source]) src_pkg = findpacs([source])
tgt_pkg = findpacs([dest]) tgt_pkg = findpacs([dest])
if not src_pkg: if not src_pkg:
@ -7638,8 +7640,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not tgt_pkg: if not tgt_pkg:
raise oscerr.NoWorkingCopy("Error: \"%s\" does not point to an osc working copy." % os.path.abspath(dest)) raise oscerr.NoWorkingCopy("Error: \"%s\" does not point to an osc working copy." % os.path.abspath(dest))
if os.path.isfile(source) and os.path.isdir(dest):
dest = os.path.join(dest, os.path.basename(source))
os.rename(source, dest) os.rename(source, dest)
try: try:
tgt_pkg[0].addfile(os.path.basename(dest)) tgt_pkg[0].addfile(os.path.basename(dest))