Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add revert command to revert a package to a rev #823

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2947,6 +2947,42 @@ def do_aggregatepac(self, subcmd, opts, *args):
aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map, opts.disable_publish, opts.nosources)


@cmdln.option('-r', '--revision', metavar='rev',
help='reset to specified revision.')
def do_reset(self, subcmd, opts, *args):
"""${cmd_name}: Reset a package

This resets a package on the server to a given revision.

Needs either project/package or issued in a valid working
directory.

Usage:
osc reset -r <rev> [project] [package]
"""

args = slash_split(args)

if not opts.revision:
raise oscerr.WrongArgs('You need to specify a revision with -r <rev>')

reset_args = []
if len(args) == 2:
project = args[0]
package = args[1]
elif len(args) < 2:
project = store_read_project(os.curdir)
package = store_read_package(os.curdir)
else:
raise oscerr.WrongArgs('Wrong number of arguments.')

reset_args.append(project)
reset_args.append(package)
reset_args.append(project)

self.do_copypac(None, opts, *reset_args)


@cmdln.option('-c', '--client-side-copy', action='store_true',
help='do a (slower) client-side copy')
@cmdln.option('-k', '--keep-maintainers', action='store_true',
Expand Down