Skip to content

Commit

Permalink
- fixed bug #10 ("Traceback of an error in an exception handler")
Browse files Browse the repository at this point in the history
Changed behaviour of "osc mv". Now it is also possible to move files
between different packages, that is "osc mv pkg1/foo pkg2/bar".
  • Loading branch information
marcus-h committed Sep 19, 2012
1 parent dba6930 commit dd48ee4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7154,13 +7154,20 @@ def do_mv(self, subcmd, opts, source, dest):
raise oscerr.WrongArgs("Source file ``%s'' does not exists" % source)
if not opts.force and os.path.isfile(dest):
raise oscerr.WrongArgs("Dest file ``%s'' already exists" % dest)
if not is_package_dir('.'):
raise oscerr.NoWorkingCopy("Error: \"%s\" is not an osc working copy." % os.path.abspath(dir))
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))

p = findpacs('.')[0]
os.rename(source, dest)
self.do_add(subcmd, opts, dest)
self.do_delete(subcmd, opts, source)
try:
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',
help='delete option from config or reset option to the default)')
Expand Down

0 comments on commit dd48ee4

Please sign in to comment.