apycotlib: restrict hg up to public changesets (closes #2741838) stable
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 11 Mar 2013 18:11:20 +0100
branchstable
changeset 877 86cc30266cd5
parent 849 4c5189022c91
child 878 601c4a1f8c53
apycotlib: restrict hg up to public changesets (closes #2741838) With vcreview now supporting draft changesets as patches, apycot starts testing those draft changesets instead of the public heads, wreaking havoc. As a short term fix, make it not do that (eventually we might want to actually run unit tests on drafts, just not now).
_apycotlib/repositories.py
--- a/_apycotlib/repositories.py	Fri Jan 25 23:11:46 2013 +0100
+++ b/_apycotlib/repositories.py	Mon Mar 11 18:11:20 2013 +0100
@@ -172,13 +172,14 @@
         package
         """
         if quiet:
-            return 'hg clone -q %s' % self.ref_repo
-        return 'hg clone %s' % self.ref_repo
+            return "hg clone -q %s && hg -R %s up '::. and public()'" % (self.ref_repo, self.co_path)
+        return "hg clone %s && hg -R %s up '::. and public()'" % (self.ref_repo, self.co_path)
 
     def co_move_to_branch_command(self, quiet=True):
-        # if branch doesn't exists, stay in default
+        # if branch doesn't exist, stay in default
         if self.branch:
-            return 'hg -R %s up %s' % (self.co_path, self.branch)
+            return "hg -R %s up 'first(id(%s) + max(branch(%s) and public()))'" % (
+                    self.co_path, self.branch, self.branch)
         return None
 
     def changeset(self):