Mercurial > hg
comparison hgext/remotefilelog/__init__.py @ 50895:a834ec41f17c
remotefilelog: use sysstr to check for attribute presence
We do not need bytes here.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 30 Aug 2023 13:07:00 +0200 |
parents | cbd1da102417 |
children | d718eddf01d9 |
comparison
equal
deleted
inserted
replaced
50894:f75fd677cc05 | 50895:a834ec41f17c |
---|---|
423 try: | 423 try: |
424 orig(ui, repo, *args, **opts) | 424 orig(ui, repo, *args, **opts) |
425 finally: | 425 finally: |
426 if opts.get('shallow'): | 426 if opts.get('shallow'): |
427 for r in repos: | 427 for r in repos: |
428 if util.safehasattr(r, b'fileservice'): | 428 if util.safehasattr(r, 'fileservice'): |
429 r.fileservice.close() | 429 r.fileservice.close() |
430 | 430 |
431 | 431 |
432 def debugdatashallow(orig, *args, **kwds): | 432 def debugdatashallow(orig, *args, **kwds): |
433 oldlen = remotefilelog.remotefilelog.__len__ | 433 oldlen = remotefilelog.remotefilelog.__len__ |
902 # this repo was added to the repos file. We'd rather this loop succeed | 902 # this repo was added to the repos file. We'd rather this loop succeed |
903 # and too much be deleted, than the loop fail and nothing gets deleted. | 903 # and too much be deleted, than the loop fail and nothing gets deleted. |
904 if not isenabled(repo): | 904 if not isenabled(repo): |
905 continue | 905 continue |
906 | 906 |
907 if not util.safehasattr(repo, b'name'): | 907 if not util.safehasattr(repo, 'name'): |
908 ui.warn( | 908 ui.warn( |
909 _(b"repo %s is a misconfigured remotefilelog repo\n") % path | 909 _(b"repo %s is a misconfigured remotefilelog repo\n") % path |
910 ) | 910 ) |
911 continue | 911 continue |
912 | 912 |
1032 bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack') | 1032 bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack') |
1033 # update a revset with a date limit | 1033 # update a revset with a date limit |
1034 bgprefetchrevs = revdatelimit(ui, bgprefetchrevs) | 1034 bgprefetchrevs = revdatelimit(ui, bgprefetchrevs) |
1035 | 1035 |
1036 def anon(unused_success): | 1036 def anon(unused_success): |
1037 if util.safehasattr(repo, b'ranprefetch') and repo.ranprefetch: | 1037 if util.safehasattr(repo, 'ranprefetch') and repo.ranprefetch: |
1038 return | 1038 return |
1039 repo.ranprefetch = True | 1039 repo.ranprefetch = True |
1040 repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack) | 1040 repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack) |
1041 | 1041 |
1042 repo._afterlock(anon) | 1042 repo._afterlock(anon) |
1078 bundlecaps.add(constants.BUNDLE2_CAPABLITY) | 1078 bundlecaps.add(constants.BUNDLE2_CAPABLITY) |
1079 return orig( | 1079 return orig( |
1080 source, heads=heads, common=common, bundlecaps=bundlecaps, **kwargs | 1080 source, heads=heads, common=common, bundlecaps=bundlecaps, **kwargs |
1081 ) | 1081 ) |
1082 | 1082 |
1083 if util.safehasattr(remote, b'_callstream'): | 1083 if util.safehasattr(remote, '_callstream'): |
1084 remote._localrepo = repo | 1084 remote._localrepo = repo |
1085 elif util.safehasattr(remote, b'getbundle'): | 1085 elif util.safehasattr(remote, 'getbundle'): |
1086 extensions.wrapfunction(remote, 'getbundle', localgetbundle) | 1086 extensions.wrapfunction(remote, 'getbundle', localgetbundle) |
1087 | 1087 |
1088 return orig(repo, remote, *args, **kwargs) | 1088 return orig(repo, remote, *args, **kwargs) |
1089 | 1089 |
1090 | 1090 |