Show More
@@ -1477,6 +1477,49 b' def applyupdates(' | |||||
1477 | return updateresult(updated, merged, removed, unresolved), getfiledata |
|
1477 | return updateresult(updated, merged, removed, unresolved), getfiledata | |
1478 |
|
1478 | |||
1479 |
|
1479 | |||
|
1480 | def _advertisefsmonitor(repo, num_gets, p1node): | |||
|
1481 | # Advertise fsmonitor when its presence could be useful. | |||
|
1482 | # | |||
|
1483 | # We only advertise when performing an update from an empty working | |||
|
1484 | # directory. This typically only occurs during initial clone. | |||
|
1485 | # | |||
|
1486 | # We give users a mechanism to disable the warning in case it is | |||
|
1487 | # annoying. | |||
|
1488 | # | |||
|
1489 | # We only allow on Linux and MacOS because that's where fsmonitor is | |||
|
1490 | # considered stable. | |||
|
1491 | fsmonitorwarning = repo.ui.configbool(b'fsmonitor', b'warn_when_unused') | |||
|
1492 | fsmonitorthreshold = repo.ui.configint( | |||
|
1493 | b'fsmonitor', b'warn_update_file_count' | |||
|
1494 | ) | |||
|
1495 | try: | |||
|
1496 | # avoid cycle: extensions -> cmdutil -> merge | |||
|
1497 | from . import extensions | |||
|
1498 | ||||
|
1499 | extensions.find(b'fsmonitor') | |||
|
1500 | fsmonitorenabled = repo.ui.config(b'fsmonitor', b'mode') != b'off' | |||
|
1501 | # We intentionally don't look at whether fsmonitor has disabled | |||
|
1502 | # itself because a) fsmonitor may have already printed a warning | |||
|
1503 | # b) we only care about the config state here. | |||
|
1504 | except KeyError: | |||
|
1505 | fsmonitorenabled = False | |||
|
1506 | ||||
|
1507 | if ( | |||
|
1508 | fsmonitorwarning | |||
|
1509 | and not fsmonitorenabled | |||
|
1510 | and p1node == nullid | |||
|
1511 | and num_gets >= fsmonitorthreshold | |||
|
1512 | and pycompat.sysplatform.startswith((b'linux', b'darwin')) | |||
|
1513 | ): | |||
|
1514 | repo.ui.warn( | |||
|
1515 | _( | |||
|
1516 | b'(warning: large working directory being used without ' | |||
|
1517 | b'fsmonitor enabled; enable fsmonitor to improve performance; ' | |||
|
1518 | b'see "hg help -e fsmonitor")\n' | |||
|
1519 | ) | |||
|
1520 | ) | |||
|
1521 | ||||
|
1522 | ||||
1480 | UPDATECHECK_ABORT = b'abort' # handled at higher layers |
|
1523 | UPDATECHECK_ABORT = b'abort' # handled at higher layers | |
1481 | UPDATECHECK_NONE = b'none' |
|
1524 | UPDATECHECK_NONE = b'none' | |
1482 | UPDATECHECK_LINEAR = b'linear' |
|
1525 | UPDATECHECK_LINEAR = b'linear' | |
@@ -1815,45 +1858,8 b' def update(' | |||||
1815 | # note that we're in the middle of an update |
|
1858 | # note that we're in the middle of an update | |
1816 | repo.vfs.write(b'updatestate', p2.hex()) |
|
1859 | repo.vfs.write(b'updatestate', p2.hex()) | |
1817 |
|
1860 | |||
1818 | # Advertise fsmonitor when its presence could be useful. |
|
1861 | _advertisefsmonitor( | |
1819 | # |
|
1862 | repo, len(actions[mergestatemod.ACTION_GET]), p1.node() | |
1820 | # We only advertise when performing an update from an empty working |
|
|||
1821 | # directory. This typically only occurs during initial clone. |
|
|||
1822 | # |
|
|||
1823 | # We give users a mechanism to disable the warning in case it is |
|
|||
1824 | # annoying. |
|
|||
1825 | # |
|
|||
1826 | # We only allow on Linux and MacOS because that's where fsmonitor is |
|
|||
1827 | # considered stable. |
|
|||
1828 | fsmonitorwarning = repo.ui.configbool(b'fsmonitor', b'warn_when_unused') |
|
|||
1829 | fsmonitorthreshold = repo.ui.configint( |
|
|||
1830 | b'fsmonitor', b'warn_update_file_count' |
|
|||
1831 | ) |
|
|||
1832 | try: |
|
|||
1833 | # avoid cycle: extensions -> cmdutil -> merge |
|
|||
1834 | from . import extensions |
|
|||
1835 |
|
||||
1836 | extensions.find(b'fsmonitor') |
|
|||
1837 | fsmonitorenabled = repo.ui.config(b'fsmonitor', b'mode') != b'off' |
|
|||
1838 | # We intentionally don't look at whether fsmonitor has disabled |
|
|||
1839 | # itself because a) fsmonitor may have already printed a warning |
|
|||
1840 | # b) we only care about the config state here. |
|
|||
1841 | except KeyError: |
|
|||
1842 | fsmonitorenabled = False |
|
|||
1843 |
|
||||
1844 | if ( |
|
|||
1845 | fsmonitorwarning |
|
|||
1846 | and not fsmonitorenabled |
|
|||
1847 | and p1.node() == nullid |
|
|||
1848 | and len(actions[mergestatemod.ACTION_GET]) >= fsmonitorthreshold |
|
|||
1849 | and pycompat.sysplatform.startswith((b'linux', b'darwin')) |
|
|||
1850 | ): |
|
|||
1851 | repo.ui.warn( |
|
|||
1852 | _( |
|
|||
1853 | b'(warning: large working directory being used without ' |
|
|||
1854 | b'fsmonitor enabled; enable fsmonitor to improve performance; ' |
|
|||
1855 | b'see "hg help -e fsmonitor")\n' |
|
|||
1856 | ) |
|
|||
1857 |
|
|
1863 | ) | |
1858 |
|
1864 | |||
1859 | wantfiledata = updatedirstate and not branchmerge |
|
1865 | wantfiledata = updatedirstate and not branchmerge |
General Comments 0
You need to be logged in to leave comments.
Login now