# HG changeset patch # User Christophe de Vienne # Date 1674657204 -3600 # Wed Jan 25 15:33:24 2023 +0100 # Node ID 1ad59e428decb53648b27bc2bc141267048fd3c2 # Parent 7398c3dc28121e84c5ed21b0ae2beab41763da86 configuration: remove the destination directory if clone fails diff --git a/hgext3rd/confman/configuration.py b/hgext3rd/confman/configuration.py --- a/hgext3rd/confman/configuration.py +++ b/hgext3rd/confman/configuration.py @@ -2,6 +2,7 @@ import itertools import os +import shutil from collections import defaultdict from mercurial import error, util @@ -203,6 +204,7 @@ self.failed.add(section) ui.write('%s\n' % err, label='confman.dirty') ui.debug(str(err)) + shutil.rmtree(dest) continue # if managed is a sub configuration, we add the rootpath diff --git a/tests/test-git.t b/tests/test-git.t --- a/tests/test-git.t +++ b/tests/test-git.t @@ -232,3 +232,20 @@ $ hg cfs -I foo conf |- foo (HEAD) [baseline 'foo-0.2' in a parallel branch] M + +Git clone failure + $ cd $TESTTMP + $ hg init test-git-failure + $ cd test-git-failure + $ cat > .hgconf < [agitrepo] + > pulluri = invalid.git + > layout = target + > track = master + > EOF + $ hg cfensureconf --no-hggit + fatal: repository 'invalid.git' does not exist + cloning agitrepo from invalid.git to $TESTTMP/test-git-failure/target + Command '['git', 'clone', 'invalid.git', '$TESTTMP/test-git-failure/target']' returned non-zero exit status 128. + $ [ -e target ] ; echo $? + 1