tests/pullext.py
changeset 40393 229d23cdb203
parent 40327 55836a34f41b
child 40996 70a00a8cd66e
--- a/tests/pullext.py	Wed Oct 17 17:32:15 2018 +0200
+++ b/tests/pullext.py	Fri Oct 19 12:30:49 2018 +0200
@@ -10,6 +10,7 @@
 from mercurial.i18n import _
 from mercurial import (
     commands,
+    error,
     extensions,
     localrepo,
     repository,
@@ -19,6 +20,12 @@
     if kwargs.get(r'include') or kwargs.get(r'exclude'):
         kwargs[r'narrow'] = True
 
+    if kwargs.get(r'depth'):
+        try:
+            kwargs[r'depth'] = int(kwargs[r'depth'])
+        except ValueError:
+            raise error.Abort(_('--depth must be an integer'))
+
     return orig(ui, repo, *args, **kwargs)
 
 def featuresetup(ui, features):
@@ -28,6 +35,7 @@
     entry = extensions.wrapcommand(commands.table, 'clone', clonecommand)
 
     hasinclude = any(x[1] == 'include' for x in entry[1])
+    hasdepth = any(x[1] == 'depth' for x in entry[1])
 
     if not hasinclude:
         entry[1].append(('', 'include', [],
@@ -35,4 +43,8 @@
         entry[1].append(('', 'exclude', [],
                          _('pattern of file/directory to not clone')))
 
+    if not hasdepth:
+        entry[1].append(('', 'depth', '',
+                         _('ancestry depth of changesets to fetch')))
+
     localrepo.featuresetupfuncs.add(featuresetup)