Mercurial > hg
comparison mercurial/dirstate.py @ 47320:a43d256c041a
dirstate-v2: Add `hg debugupgraderepo` command support
This command changes changes the file formats used inside an existing
repository to what they would be in a new repository with the current config.
For example:
hg debugupgraderepo --config format.exp-dirstate-v2=1 --run
hg debugupgraderepo --config format.exp-dirstate-v2=0 --run
If a repository has a dirstate in v1 format, the first command would upgrade it
to dirstate-v2. Conversely, if a repository has a dirstate in v2 format, the
second command would downgrade it to v1. (Both may also run some unrelated
upgrades.)
Since `format.exp-dirstate-v2` is currently disabled by default, not specifying
it in `--config` or any configuration file would result in the second command.
Differential Revision: https://phab.mercurial-scm.org/D10769
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 18:35:43 +0200 |
parents | 1766130fe9ba |
children | 04d1f17f49e7 |
comparison
equal
deleted
inserted
replaced
47319:e985a36c2aa3 | 47320:a43d256c041a |
---|---|
1773 self._dirtyparents = False | 1773 self._dirtyparents = False |
1774 | 1774 |
1775 # for consistent view between _pl() and _read() invocations | 1775 # for consistent view between _pl() and _read() invocations |
1776 self._pendingmode = None | 1776 self._pendingmode = None |
1777 | 1777 |
1778 self._use_dirstate_tree = self._ui.configbool( | |
1779 b"experimental", | |
1780 b"dirstate-tree.in-memory", | |
1781 False, | |
1782 ) | |
1783 | |
1778 def addfile(self, *args, **kwargs): | 1784 def addfile(self, *args, **kwargs): |
1779 return self._rustmap.addfile(*args, **kwargs) | 1785 return self._rustmap.addfile(*args, **kwargs) |
1780 | 1786 |
1781 def removefile(self, *args, **kwargs): | 1787 def removefile(self, *args, **kwargs): |
1782 return self._rustmap.removefile(*args, **kwargs) | 1788 return self._rustmap.removefile(*args, **kwargs) |
1901 except IOError as err: | 1907 except IOError as err: |
1902 if err.errno != errno.ENOENT: | 1908 if err.errno != errno.ENOENT: |
1903 raise | 1909 raise |
1904 st = b'' | 1910 st = b'' |
1905 | 1911 |
1906 use_dirstate_tree = self._ui.configbool( | |
1907 b"experimental", | |
1908 b"dirstate-tree.in-memory", | |
1909 False, | |
1910 ) | |
1911 self._rustmap, parents = rustmod.DirstateMap.new( | 1912 self._rustmap, parents = rustmod.DirstateMap.new( |
1912 use_dirstate_tree, self._use_dirstate_v2, st | 1913 self._use_dirstate_tree, self._use_dirstate_v2, st |
1913 ) | 1914 ) |
1914 | 1915 |
1915 if parents and not self._dirtyparents: | 1916 if parents and not self._dirtyparents: |
1916 self.setparents(*parents) | 1917 self.setparents(*parents) |
1917 | 1918 |