mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 01:26:23 +01:00
- do_revert: initial version
This commit is contained in:
parent
7ca255cca0
commit
b3d638774c
@ -5902,6 +5902,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
else:
|
else:
|
||||||
print '\'%s\': \'%s\' is set to \'%s\'' % (section, opt, newval)
|
print '\'%s\': \'%s\' is set to \'%s\'' % (section, opt, newval)
|
||||||
|
|
||||||
|
def do_revert(self, subcmd, opts, *files):
|
||||||
|
"""${cmd_name}: restore original wc file
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
osc revert <modified file(s)>
|
||||||
|
|
||||||
|
Note: this only works for files in a package working copy
|
||||||
|
|
||||||
|
${cmd_usage}
|
||||||
|
${cmd_option_list}
|
||||||
|
"""
|
||||||
|
pacs = findpacs(files)
|
||||||
|
for p in pacs:
|
||||||
|
if not len(p.todo):
|
||||||
|
p.todo = p.filenamelist
|
||||||
|
for f in p.todo:
|
||||||
|
p.revert(f)
|
||||||
|
|
||||||
# fini!
|
# fini!
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
13
osc/core.py
13
osc/core.py
@ -1787,6 +1787,19 @@ rev: %s
|
|||||||
if not loop:
|
if not loop:
|
||||||
raise ValueError("Empty filelist")
|
raise ValueError("Empty filelist")
|
||||||
|
|
||||||
|
def revert(self, filename):
|
||||||
|
if not filename in self.filenamelist:
|
||||||
|
raise IOError('file \'%s\' is not under version control' % filename)
|
||||||
|
if not os.path.exists(os.path.join(self.storedir, filename)):
|
||||||
|
raise oscerr.PackageInternalError('file \'%s\' is listed in filenamelist but no storefile exists' % filename)
|
||||||
|
shutil.copyfile(os.path.join(self.storedir, filename), os.path.join(self.absdir, filename))
|
||||||
|
state = self.status(filename)
|
||||||
|
if state == 'D':
|
||||||
|
self.to_be_deleted.remove(filename)
|
||||||
|
self.write_deletelist()
|
||||||
|
elif state == 'C':
|
||||||
|
self.clear_from_conflictlist(filename)
|
||||||
|
|
||||||
class ReviewState:
|
class ReviewState:
|
||||||
"""for objects to represent the review state in a request"""
|
"""for objects to represent the review state in a request"""
|
||||||
def __init__(self, state=None, by_user=None, by_group=None, who=None, when=None, comment=None):
|
def __init__(self, state=None, by_user=None, by_group=None, who=None, when=None, comment=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user