[checker] make lgp checker use hglib and add the node id as apycot package suffix draft
authorDavid Douard <david.douard@logilab.fr>
Fri, 22 Jan 2016 17:14:04 +0100
changeset 1862 6063a2a6ee8c
parent 1861 651a4a4dc1dd
[checker] make lgp checker use hglib and add the node id as apycot package suffix in the context of checking draft changesets, the revision number is not guaranteed to be increasing, so let's build packages with a reasonably confident unique name.
_narval/checkers/apycot/lgp.py
--- a/_narval/checkers/apycot/lgp.py	Fri Jan 22 17:07:51 2016 +0100
+++ b/_narval/checkers/apycot/lgp.py	Fri Jan 22 17:14:04 2016 +0100
@@ -1,6 +1,7 @@
 import os
 import logging
 from glob import glob
+import hglib
 
 import apycotlib as apycot
 from checkers.apycot import BaseChecker, AbstractFilteredFileChecker
@@ -97,7 +98,6 @@
         build_folder = os.path.join(test.project_path(), '..')
         cwd = os.getcwd()
         os.chdir(test.project_path())
-        repo = test.apycot_repository()
         try:
             handler = LgpLogHandler(self.writer)
             cmd = LGP.get_command(self.command)
@@ -106,7 +106,8 @@
             if dist:
                 args += ['-d', ','.join(dist)]
             if suffix:
-                args += ['--suffix', '~rev%s' % repo.revision()]
+                revision = hglib.open('.').parents()[0].node[:12]
+                args += ['--suffix', '~rev%s' % revision]
             exit_status = cmd.main_run(args, LGP.rcfile)
             self.debian_changes = [f for f in cmd.packages if f.endswith('.changes')]
             self.rpms = [f for f in cmd.packages if f.endswith('.rpm')]