[cmake-developers] [patch] ExternalProject: Removed implicit hg update on hg clone.

Klaim - Joël Lamotte mjklaim at gmail.com
Mon Aug 10 19:13:01 EDT 2015


Please find attached a patch fixing ExternalProject_Add() which update
mercurial repositories _twice_, which can lead to too long cloning
transactions
(in particular when there are subrepos in the default branch),
which can lead transaction abort by repository servers.
I found the issue in such situation. This patch fixes the observed issue.

Here is the description from the patch:

By default Mercurial command "clone" will implicitly call "update"
with the "default" branch after downloading the cloned repository.
However ExternalProject_Add() always generate a second "update" command
after cloning with a tag which is either specified or "tip" (equivalent to
"default" by default).
Therefore, before this patch, ExternalProject will first clone then update
to default branch then update to another specified branch if provided.
This lead to potentially very long clone operation (in particular when
the repository default branch contain subrepos) which can lead
to transaction abort triggered by the server.

This patch remove the implicit update-on-clone step.
The update command following the clone command generated by
ExternalDependencies is enough to setup the directory to the specified
or default tag/branch.

----

Should I also make a ticket or just posting the patch here is enough?


A. Joël Lamotte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150811/744a3d99/attachment-0001.html>
-------------- next part --------------
From 8cc61f037783017907d521b979561daca571eea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?A=2E=20Jo=C3=ABl=20Lamotte?= <mjklaim at gmail.com>
Date: Tue, 11 Aug 2015 01:01:25 +0200
Subject: [PATCH] ExternalProject: Removed implicit hg update on hg clone.

By default Mercurial command "clone" will implicitly call "update"
with the "default" branch after downloading the cloned repository.
However ExternalProject_Add() always generate a second "update" command
after cloning with a tag which is either specified or "tip" (equivalent to
"default" by default).
Therefore, before this patch, ExternalProject will first clone then update
to default branch then update to another specified branch if provided.
This lead to potentially very long clone operation (in particular when
the repository default branch contain subrepos) which can lead
to transaction abort triggered by the server.

This patch remove the implicit update-on-clone step.
The update command following the clone command generated by
ExternalDependencies is enough to setup the directory to the specified
or default tag/branch.
---
 Modules/ExternalProject.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index fdb146a..0fbf7c3 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -609,7 +609,7 @@ if(error_code)
 endif()
 
 execute_process(
-  COMMAND \"${hg_EXECUTABLE}\" clone \"${hg_repository}\" \"${src_name}\"
+  COMMAND \"${hg_EXECUTABLE}\" clone -U \"${hg_repository}\" \"${src_name}\"
   WORKING_DIRECTORY \"${work_dir}\"
   RESULT_VARIABLE error_code
   )
-- 
1.9.5.msysgit.1



More information about the cmake-developers mailing list