Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r864:3c3490a01a5d
Date: 2013-09-25 19:11 +0200
http://bitbucket.org/pypy/buildbot/changeset/3c3490a01a5d/

Log:    Baaaah. I didn't find out how to use Mercurial() for auxiliary
        repos where we *don't* want to update to the branch specified by the
        user.

diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -243,8 +243,52 @@
         self.finished(SUCCESS)
 
 
+def update_hg_old_method(platform, factory, repourl, workdir):
+    # baaaaaah.  Seems that the Mercurial class doesn't support
+    # updating to a different branch than the one specified by
+    # the user (like "default").  This is nonsense if we need
+    # an auxiliary check-out :-(  At least I didn't find how.
+    if platform == 'win32':
+        command = "if not exist .hg rmdir /q /s ."
+    else:
+        command = "if [ ! -d .hg ]; then rm -fr * .[a-z]*; fi"
+    factory.addStep(ShellCmd(description="rmdir?",
+                             command=command,
+                             workdir=workdir,
+                             haltOnFailure=False))
+    #
+    if platform == "win32":
+        command = "if not exist .hg %s"
+    else:
+        command = "if [ ! -d .hg ]; then %s; fi"
+    command = command % ("hg clone -U " + repourl + " .")
+    factory.addStep(ShellCmd(description="hg clone",
+                             command=command,
+                             workdir=workdir,
+                             timeout=3600,
+                             haltOnFailure=True))
+    #
+    factory.addStep(
+        ShellCmd(description="hg purge",
+                 command="hg --config extensions.purge= purge --all",
+                 workdir=workdir,
+                 haltOnFailure=True))
+    #
+    factory.addStep(ShellCmd(description="hg pull",
+                             command="hg pull",
+                             workdir=workdir))
+    #
+    # here, update without caring about branches
+    factory.addStep(ShellCmd(description="hg update",
+           command=WithProperties("hg update --clean %(revision)s"),
+           workdir=workdir))
+
 def update_hg(platform, factory, repourl, workdir, use_branch,
               force_branch=None):
+    if not use_branch:
+        assert force_branch is None
+        update_hg_old_method(platform, factory, repourl, workdir)
+        return
     factory.addStep(
             Mercurial(
                 repourl=repourl,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to