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
From 8cc61f037783017907d521b979561daca571eea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?A=2E=20Jo=C3=ABl=20Lamotte?= <mjkl...@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

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to