Skip to content

Commit

Permalink
- do_mv: minor cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-h committed Feb 27, 2013
1 parent 1d3805f commit 45e4990
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions osc/commandline.py
Expand Up @@ -7628,18 +7628,18 @@ def do_mv(self, subcmd, opts, source, dest):
"""

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):
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])
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))

if os.path.isfile(source) and os.path.isdir(dest):
dest = os.path.join(dest, os.path.basename(source))
os.rename(source, dest)
try:
tgt_pkg[0].addfile(os.path.basename(dest))
Expand Down

0 comments on commit 45e4990

Please sign in to comment.