1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-24 11:12:14 +01:00

osc mv command

This commit is contained in:
Michal Vyskocil 2009-11-24 16:25:48 +00:00
parent aafcf707fd
commit e57b3548c9
2 changed files with 23 additions and 0 deletions

1
NEWS
View File

@ -19,6 +19,7 @@
have changed and submits only the changed after asking back.
- show worker/id on jobhistory and make it faster by adding a default limit of 20
- add "osc build --root" option to allow to specify build root directory
- added osc mv command which can rename file and leave him under version control
#
# Features which require OBS 1.7
#

View File

@ -4339,6 +4339,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
vc.wait()
sys.exit(vc.returncode)
@cmdln.option('-f', '--force', action='store_true',
help='forces removal of entire package and its files')
def do_mv(self, subcmd, opts, source, dest):
"""${cmd_name}: Move SOURCE file to DEST and keep it under version control
${cmd_usage}
${cmd_option_list}
"""
if not os.path.isfile(source):
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))
p = findpacs('.')[0]
os.rename(source, dest)
self.do_add(subcmd, opts, dest)
self.do_delete(subcmd, opts, source)
# fini!
###############################################################################