Kaydet (Commit) 2f555cdd authored tarafından Your Name's avatar Your Name

Merge branch 'develop' of https://gitlab.com/sulinos/devel/inary into develop

......@@ -29,7 +29,8 @@ import inary.cli.command as command
# Operation names for translation
opttrans = {"upgrade": _("upgrade"), "remove": _("remove"), "emerge": _("emerge"), "install": _("install"),
"snapshot": _("snapshot"), "takeback": _("takeback"), "repoupdate": _("repository update")}
"snapshot": _("snapshot"), "takeback": _("takeback"), "repoupdate": _("repository update"),
"reset": _("reset history")}
class History(command.PackageOp, metaclass=command.autocommand):
......@@ -140,12 +141,13 @@ Lists previous operations.""")
self.takeback(opno)
return
elif ctx.get_option('reset'):
ctx.ui.info(_("Resetting history casts"), verbose=True)
util.clean_dir(ctx.config.history_dir())
util.makedirs(ctx.config.history_dir())
# FIXME: we must add reset info in history
#import inary.data.history as History
#history = History.History()
#history.add("reset")
import inary.data.history as History
history = History.History()
history.create("reset")
history.update()
return
else:
self.redirect_output(self.print_history())
......@@ -100,7 +100,7 @@ class History(xmlfile.XmlFile, metaclass=autoxml.autoxml):
def create(self, operation):
if operation not in ["downgrade", "upgrade", "remove", "emerge", "install", "snapshot", "takeback",
"repoupdate"]:
"repoupdate", "reset"]:
raise Exception(_("Unknown package operation"))
opno = self._get_latest()
......@@ -122,7 +122,7 @@ class History(xmlfile.XmlFile, metaclass=autoxml.autoxml):
# @param otype is currently only used to hold if an upgrade is from "delta"
def add(self, pkgBefore=None, pkgAfter=None, operation=None, otype=None):
if operation not in ["upgrade", "remove", "install", "reinstall", "downgrade", "snapshot", "reset"]:
if operation not in ["upgrade", "remove", "install", "reinstall", "downgrade", "snapshot"]:
raise Exception(_("Unknown package operation"))
package = Package()
......@@ -151,7 +151,7 @@ class History(xmlfile.XmlFile, metaclass=autoxml.autoxml):
files = [h for h in os.listdir(ctx.config.history_dir()) if h.endswith(".xml")]
if not files:
return "0o01"
return "001"
# files.sort(key=lambda x,y:int(x.split("_")[0]) - int(y.split("_")[0]))
files.sort(key=lambda x: int(x.split("_")[0].replace("0o", "0")))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment