2020import ssl
2121import time
2222
23- from mercurial .i18n import _ # type: ignore
24- from mercurial .node import hex , nullid # type: ignore
25- from mercurial import ( # type: ignore
23+ from mercurial .i18n import _
24+ from mercurial .node import hex , nullid
25+ from mercurial import (
2626 commands ,
2727 configitems ,
2828 error ,
5757
5858
5959def getsparse ():
60- from mercurial import sparse # type: ignore
60+ from mercurial import sparse
6161
6262 return sparse
6363
@@ -79,7 +79,7 @@ def peerlookup(remote, v):
7979 b"" ,
8080 b"networkattempts" ,
8181 3 ,
82- b"Maximum number of attempts for network " b" operations" ,
82+ b"Maximum number of attempts for network operations" ,
8383 ),
8484 (b"" , b"sparseprofile" , b"" , b"Sparse checkout profile to use (path in repo)" ),
8585 (
@@ -150,7 +150,7 @@ def robustcheckout(
150150 or not re .match (b"^[a-f0-9]+$" , revision )
151151 ):
152152 raise error .Abort (
153- b"--revision must be a SHA-1 fragment 12-40 " b" characters long"
153+ b"--revision must be a SHA-1 fragment 12-40 characters long"
154154 )
155155
156156 sharebase = sharebase or ui .config (b"share" , b"pool" )
@@ -171,7 +171,7 @@ def robustcheckout(
171171 extensions .find (b"sparse" )
172172 except KeyError :
173173 raise error .Abort (
174- b"sparse extension must be enabled to use " b" --sparseprofile"
174+ b"sparse extension must be enabled to use --sparseprofile"
175175 )
176176
177177 ui .warn (b"(using Mercurial %s)\n " % util .version ())
@@ -337,7 +337,6 @@ def callself():
337337 @contextlib .contextmanager
338338 def timeit (op , behavior ):
339339 behaviors .add (behavior )
340- start = 0
341340 errored = False
342341 try :
343342 start = time .time ()
@@ -381,14 +380,14 @@ def deletesharedstore(path=None):
381380 # enabled sparse, we would lock them out.
382381 if destvfs .exists () and sparse_profile and not destvfs .exists (b".hg/sparse" ):
383382 raise error .Abort (
384- b"cannot enable sparse profile on existing " b" non-sparse checkout" ,
383+ b"cannot enable sparse profile on existing non-sparse checkout" ,
385384 hint = b"use a separate working directory to use sparse" ,
386385 )
387386
388387 # And the other direction for symmetry.
389388 if not sparse_profile and destvfs .exists (b".hg/sparse" ):
390389 raise error .Abort (
391- b"cannot use non-sparse checkout on existing sparse " b" checkout" ,
390+ b"cannot use non-sparse checkout on existing sparse checkout" ,
392391 hint = b"use a separate working directory to use sparse" ,
393392 )
394393
@@ -408,7 +407,7 @@ def deletesharedstore(path=None):
408407 ui .warn (b"(shared store does not exist; deleting destination)\n " )
409408 with timeit ("removed_missing_shared_store" , "remove-wdir" ):
410409 destvfs .rmtree (forcibly = True )
411- elif not re .search (rb "[a-f0-9]{40}/\.hg$" , storepath .replace (b"\\ " , b"/" )):
410+ elif not re .search (b "[a-f0-9]{40}/\ \ .hg$" , storepath .replace (b"\\ " , b"/" )):
412411 ui .warn (
413412 b"(shared store does not belong to pooled storage; "
414413 b"deleting destination to improve efficiency)\n "
@@ -430,7 +429,7 @@ def handlerepoerror(e):
430429 ui .warn (b"(abandoned transaction found; trying to recover)\n " )
431430 repo = hg .repository (ui , dest )
432431 if not repo .recover ():
433- ui .warn (b"(could not recover repo state; " b" deleting shared store)\n " )
432+ ui .warn (b"(could not recover repo state; deleting shared store)\n " )
434433 with timeit ("remove_unrecovered_shared_store" , "remove-store" ):
435434 deletesharedstore ()
436435
@@ -445,7 +444,7 @@ def handlerepoerror(e):
445444 def handlenetworkfailure ():
446445 if networkattempts [0 ] >= networkattemptlimit :
447446 raise error .Abort (
448- b"reached maximum number of network attempts; " b" giving up\n "
447+ b"reached maximum number of network attempts; giving up\n "
449448 )
450449
451450 ui .warn (
@@ -539,7 +538,7 @@ def handlepullerror(e):
539538 clonepeer = hg .peer (ui , {}, cloneurl )
540539 rootnode = peerlookup (clonepeer , b"0" )
541540 except error .RepoLookupError :
542- raise error .Abort (b"unable to resolve root revision from clone " b" source" )
541+ raise error .Abort (b"unable to resolve root revision from clone source" )
543542 except (
544543 error .Abort ,
545544 ssl .SSLError ,
@@ -673,7 +672,6 @@ def handlepullerror(e):
673672 # We only pull if we are using symbolic names or the requested revision
674673 # doesn't exist.
675674 havewantedrev = False
676- checkoutrevision = None
677675
678676 if revision :
679677 try :
@@ -685,7 +683,7 @@ def handlepullerror(e):
685683 if not ctx .hex ().startswith (revision ):
686684 raise error .Abort (
687685 b"--revision argument is ambiguous" ,
688- hint = b"must be the first 12+ characters of a " b" SHA-1 fragment" ,
686+ hint = b"must be the first 12+ characters of a SHA-1 fragment" ,
689687 )
690688
691689 checkoutrevision = ctx .hex ()
@@ -750,7 +748,6 @@ def handlepullerror(e):
750748 # Mercurial 4.3 doesn't purge files outside the sparse checkout.
751749 # See https://bz.mercurial-scm.org/show_bug.cgi?id=5626. Force
752750 # purging by monkeypatching the sparse matcher.
753- old_sparse_fn = None
754751 try :
755752 old_sparse_fn = getattr (repo .dirstate , "_sparsematchfn" , None )
756753 if old_sparse_fn is not None :
@@ -764,7 +761,7 @@ def handlepullerror(e):
764761 abort_on_err = True ,
765762 # The function expects all arguments to be
766763 # defined.
767- ** {"print" : None , "print0" : None , "dirs" : None , "files" : None },
764+ ** {"print" : None , "print0" : None , "dirs" : None , "files" : None }
768765 ):
769766 raise error .Abort (b"error purging" )
770767 finally :
0 commit comments