Mercurial > hg
comparison mercurial/metadata.py @ 45734:53c265a6fc83
sidedata: return enough data to set the proper flag in the future
If the revision has information relevant to copy tracing, we need to set a
dedicated flag in revlog. Currently the upgrade process is failing to do so.
Before we teach the upgrade process about flags, we make the information
available where we will needs it.
Differential Revision: https://phab.mercurial-scm.org/D9198
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 13 Oct 2020 03:30:49 +0200 |
parents | 232c88dd89e3 |
children | edf4fa06df94 |
comparison
equal
deleted
inserted
replaced
45733:ee3fd9021fac | 45734:53c265a6fc83 |
---|---|
801 | 801 |
802 | 802 |
803 def _getsidedata(srcrepo, rev): | 803 def _getsidedata(srcrepo, rev): |
804 ctx = srcrepo[rev] | 804 ctx = srcrepo[rev] |
805 files = compute_all_files_changes(ctx) | 805 files = compute_all_files_changes(ctx) |
806 return encode_files_sidedata(files) | 806 return encode_files_sidedata(files), files.has_copies_info |
807 | 807 |
808 | 808 |
809 def getsidedataadder(srcrepo, destrepo): | 809 def getsidedataadder(srcrepo, destrepo): |
810 use_w = srcrepo.ui.configbool(b'experimental', b'worker.repository-upgrade') | 810 use_w = srcrepo.ui.configbool(b'experimental', b'worker.repository-upgrade') |
811 if pycompat.iswindows or not use_w: | 811 if pycompat.iswindows or not use_w: |
879 # looking for. For example, if we need the sidedatamap for 42, and 43 is | 879 # looking for. For example, if we need the sidedatamap for 42, and 43 is |
880 # received, when shelve 43 for later use. | 880 # received, when shelve 43 for later use. |
881 staging = {} | 881 staging = {} |
882 | 882 |
883 def sidedata_companion(revlog, rev): | 883 def sidedata_companion(revlog, rev): |
884 sidedata = {} | 884 data = {}, False |
885 if util.safehasattr(revlog, b'filteredrevs'): # this is a changelog | 885 if util.safehasattr(revlog, b'filteredrevs'): # this is a changelog |
886 # Is the data previously shelved ? | 886 # Is the data previously shelved ? |
887 sidedata = staging.pop(rev, None) | 887 sidedata = staging.pop(rev, None) |
888 if sidedata is None: | 888 if sidedata is None: |
889 # look at the queued result until we find the one we are lookig | 889 # look at the queued result until we find the one we are lookig |
890 # for (shelve the other ones) | 890 # for (shelve the other ones) |
891 r, sidedata = sidedataq.get() | 891 r, data = sidedataq.get() |
892 while r != rev: | 892 while r != rev: |
893 staging[r] = sidedata | 893 staging[r] = data |
894 r, sidedata = sidedataq.get() | 894 r, sidedata = sidedataq.get() |
895 tokens.release() | 895 tokens.release() |
896 sidedataq, has_copies_info = data | |
896 return False, (), sidedata | 897 return False, (), sidedata |
897 | 898 |
898 return sidedata_companion | 899 return sidedata_companion |
899 | 900 |
900 | 901 |
904 It just compute it in the same thread on request""" | 905 It just compute it in the same thread on request""" |
905 | 906 |
906 def sidedatacompanion(revlog, rev): | 907 def sidedatacompanion(revlog, rev): |
907 sidedata = {} | 908 sidedata = {} |
908 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog | 909 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog |
909 sidedata = _getsidedata(srcrepo, rev) | 910 sidedata, has_copies_info = _getsidedata(srcrepo, rev) |
910 return False, (), sidedata | 911 return False, (), sidedata |
911 | 912 |
912 return sidedatacompanion | 913 return sidedatacompanion |
913 | 914 |
914 | 915 |