This is done by:
sed -i "s/pycompat\.osname == 'posix'/pycompat.isposix/" **/*.py
| spectral |
| hg-reviewers |
This is done by:
sed -i "s/pycompat\.osname == 'posix'/pycompat.isposix/" **/*.py
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/largefiles/lfutil.py (2 lines) | |||
| M | mercurial/util.py (2 lines) | |||
| M | mercurial/worker.py (2 lines) |
| appdata = encoding.environ.get('LOCALAPPDATA',\ | appdata = encoding.environ.get('LOCALAPPDATA',\ | ||||
| encoding.environ.get('APPDATA')) | encoding.environ.get('APPDATA')) | ||||
| if appdata: | if appdata: | ||||
| return os.path.join(appdata, longname) | return os.path.join(appdata, longname) | ||||
| elif pycompat.sysplatform == 'darwin': | elif pycompat.sysplatform == 'darwin': | ||||
| home = encoding.environ.get('HOME') | home = encoding.environ.get('HOME') | ||||
| if home: | if home: | ||||
| return os.path.join(home, 'Library', 'Caches', longname) | return os.path.join(home, 'Library', 'Caches', longname) | ||||
| elif pycompat.osname == 'posix': | elif pycompat.isposix: | ||||
| path = encoding.environ.get('XDG_CACHE_HOME') | path = encoding.environ.get('XDG_CACHE_HOME') | ||||
| if path: | if path: | ||||
| return os.path.join(path, longname) | return os.path.join(path, longname) | ||||
| home = encoding.environ.get('HOME') | home = encoding.environ.get('HOME') | ||||
| if home: | if home: | ||||
| return os.path.join(home, '.cache', longname) | return os.path.join(home, '.cache', longname) | ||||
| else: | else: | ||||
| raise error.Abort(_('unknown operating system: %s\n') | raise error.Abort(_('unknown operating system: %s\n') | ||||
| try: | try: | ||||
| buffer = buffer | buffer = buffer | ||||
| except NameError: | except NameError: | ||||
| def buffer(sliceable, offset=0, length=None): | def buffer(sliceable, offset=0, length=None): | ||||
| if length is not None: | if length is not None: | ||||
| return memoryview(sliceable)[offset:offset + length] | return memoryview(sliceable)[offset:offset + length] | ||||
| return memoryview(sliceable)[offset:] | return memoryview(sliceable)[offset:] | ||||
| closefds = pycompat.osname == 'posix' | closefds = pycompat.isposix | ||||
| _chunksize = 4096 | _chunksize = 4096 | ||||
| class bufferedinputpipe(object): | class bufferedinputpipe(object): | ||||
| """a manually buffered input pipe | """a manually buffered input pipe | ||||
| Python will not let us use buffered IO and lazy reading with 'polling' at | Python will not let us use buffered IO and lazy reading with 'polling' at | ||||
| the same time. We cannot probe the buffer state and select will not detect | the same time. We cannot probe the buffer state and select will not detect | ||||
| try: | try: | ||||
| n = int(s) | n = int(s) | ||||
| if n >= 1: | if n >= 1: | ||||
| return n | return n | ||||
| except ValueError: | except ValueError: | ||||
| raise error.Abort(_('number of cpus must be an integer')) | raise error.Abort(_('number of cpus must be an integer')) | ||||
| return min(max(countcpus(), 4), 32) | return min(max(countcpus(), 4), 32) | ||||
| if pycompat.osname == 'posix': | if pycompat.isposix: | ||||
| _startupcost = 0.01 | _startupcost = 0.01 | ||||
| else: | else: | ||||
| _startupcost = 1e30 | _startupcost = 1e30 | ||||
| def worthwhile(ui, costperop, nops): | def worthwhile(ui, costperop, nops): | ||||
| '''try to determine whether the benefit of multiple processes can | '''try to determine whether the benefit of multiple processes can | ||||
| outweigh the cost of starting them''' | outweigh the cost of starting them''' | ||||
| linear = costperop * nops | linear = costperop * nops | ||||