Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 41228:3b35ebdb9f8c
narrow: include working copy narrowspec in transaction journal
Now that we have separate narrowspecs for the store and the working
copy, we need to include both in the transaction journal.
Differential Revision: https://phab.mercurial-scm.org/D5505
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 29 Dec 2018 22:34:38 -0800 |
parents | 0f2b8d51bfdf |
children | 50ca531f1f24 |
comparison
equal
deleted
inserted
replaced
41227:b74481038438 | 41228:3b35ebdb9f8c |
---|---|
1834 repo.dirstate.write(None) | 1834 repo.dirstate.write(None) |
1835 else: | 1835 else: |
1836 # discard all changes (including ones already written | 1836 # discard all changes (including ones already written |
1837 # out) in this transaction | 1837 # out) in this transaction |
1838 narrowspec.restorebackup(self, 'journal.narrowspec') | 1838 narrowspec.restorebackup(self, 'journal.narrowspec') |
1839 narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate') | |
1839 repo.dirstate.restorebackup(None, 'journal.dirstate') | 1840 repo.dirstate.restorebackup(None, 'journal.dirstate') |
1840 | 1841 |
1841 repo.invalidate(clearfilecache=True) | 1842 repo.invalidate(clearfilecache=True) |
1842 | 1843 |
1843 tr = transaction.transaction(rp, self.svfs, vfsmap, | 1844 tr = transaction.transaction(rp, self.svfs, vfsmap, |
1911 return tr | 1912 return tr |
1912 | 1913 |
1913 def _journalfiles(self): | 1914 def _journalfiles(self): |
1914 return ((self.svfs, 'journal'), | 1915 return ((self.svfs, 'journal'), |
1915 (self.svfs, 'journal.narrowspec'), | 1916 (self.svfs, 'journal.narrowspec'), |
1917 (self.vfs, 'journal.narrowspec.dirstate'), | |
1916 (self.vfs, 'journal.dirstate'), | 1918 (self.vfs, 'journal.dirstate'), |
1917 (self.vfs, 'journal.branch'), | 1919 (self.vfs, 'journal.branch'), |
1918 (self.vfs, 'journal.desc'), | 1920 (self.vfs, 'journal.desc'), |
1919 (self.vfs, 'journal.bookmarks'), | 1921 (self.vfs, 'journal.bookmarks'), |
1920 (self.svfs, 'journal.phaseroots')) | 1922 (self.svfs, 'journal.phaseroots')) |
1923 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()] | 1925 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()] |
1924 | 1926 |
1925 @unfilteredmethod | 1927 @unfilteredmethod |
1926 def _writejournal(self, desc): | 1928 def _writejournal(self, desc): |
1927 self.dirstate.savebackup(None, 'journal.dirstate') | 1929 self.dirstate.savebackup(None, 'journal.dirstate') |
1930 narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate') | |
1928 narrowspec.savebackup(self, 'journal.narrowspec') | 1931 narrowspec.savebackup(self, 'journal.narrowspec') |
1929 self.vfs.write("journal.branch", | 1932 self.vfs.write("journal.branch", |
1930 encoding.fromlocal(self.dirstate.branch())) | 1933 encoding.fromlocal(self.dirstate.branch())) |
1931 self.vfs.write("journal.desc", | 1934 self.vfs.write("journal.desc", |
1932 "%d\n%s\n" % (len(self), desc)) | 1935 "%d\n%s\n" % (len(self), desc)) |
2012 if parentgone: | 2015 if parentgone: |
2013 # prevent dirstateguard from overwriting already restored one | 2016 # prevent dirstateguard from overwriting already restored one |
2014 dsguard.close() | 2017 dsguard.close() |
2015 | 2018 |
2016 narrowspec.restorebackup(self, 'undo.narrowspec') | 2019 narrowspec.restorebackup(self, 'undo.narrowspec') |
2020 narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate') | |
2017 self.dirstate.restorebackup(None, 'undo.dirstate') | 2021 self.dirstate.restorebackup(None, 'undo.dirstate') |
2018 try: | 2022 try: |
2019 branch = self.vfs.read('undo.branch') | 2023 branch = self.vfs.read('undo.branch') |
2020 self.dirstate.setbranch(encoding.tolocal(branch)) | 2024 self.dirstate.setbranch(encoding.tolocal(branch)) |
2021 except IOError: | 2025 except IOError: |