Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 45277:c515c54f6530
merge: remove no longer required ACTION_GET_OTHER_AND_STORE
In 1b8fd4af33189c84feadb47c74d659ec31cde3b9 I (ab)used merge actions to pass
info from manifestmerge() to applyupdates() and store info in mergestate.
In previous patches, we introduced a separate return value from manifestmerge()
and calculateupdates() and an argument to applyupdates() which achieved the same
thing.
Let's remove this no longer required messy code.
Differential Revision: https://phab.mercurial-scm.org/D8744
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 14 Jul 2020 16:40:28 +0530 |
parents | cb6a72dc0511 |
children | 0c849f0166c2 |
comparison
equal
deleted
inserted
replaced
45276:cb6a72dc0511 | 45277:c515c54f6530 |
---|---|
704 (fl2,), | 704 (fl2,), |
705 b'update permissions', | 705 b'update permissions', |
706 ) | 706 ) |
707 else: | 707 else: |
708 actions[f] = ( | 708 actions[f] = ( |
709 mergestatemod.ACTION_GET_OTHER_AND_STORE | 709 mergestatemod.ACTION_GET, |
710 if branchmerge | |
711 else mergestatemod.ACTION_GET, | |
712 (fl2, False), | 710 (fl2, False), |
713 b'remote is newer', | 711 b'remote is newer', |
714 ) | 712 ) |
715 if branchmerge: | 713 if branchmerge: |
716 commitinfo[f] = b'other' | 714 commitinfo[f] = b'other' |
720 (fl2,), | 718 (fl2,), |
721 b'update permissions', | 719 b'update permissions', |
722 ) | 720 ) |
723 elif nol and n1 == a: # local only changed 'x' | 721 elif nol and n1 == a: # local only changed 'x' |
724 actions[f] = ( | 722 actions[f] = ( |
725 mergestatemod.ACTION_GET_OTHER_AND_STORE | 723 mergestatemod.ACTION_GET, |
726 if branchmerge | |
727 else mergestatemod.ACTION_GET, | |
728 (fl1, False), | 724 (fl1, False), |
729 b'remote is newer', | 725 b'remote is newer', |
730 ) | 726 ) |
731 if branchmerge: | 727 if branchmerge: |
732 commitinfo[f] = b'other' | 728 commitinfo[f] = b'other' |
997 ): | 993 ): |
998 renamedelete = mresult1.renamedelete | 994 renamedelete = mresult1.renamedelete |
999 | 995 |
1000 for f, a in sorted(pycompat.iteritems(mresult1.actions)): | 996 for f, a in sorted(pycompat.iteritems(mresult1.actions)): |
1001 m, args, msg = a | 997 m, args, msg = a |
1002 if m == mergestatemod.ACTION_GET_OTHER_AND_STORE: | |
1003 m = mergestatemod.ACTION_GET | |
1004 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m)) | 998 repo.ui.debug(b' %s: %s -> %s\n' % (f, msg, m)) |
1005 if f in fbids: | 999 if f in fbids: |
1006 d = fbids[f] | 1000 d = fbids[f] |
1007 if m in d: | 1001 if m in d: |
1008 d[m].append(a) | 1002 d[m].append(a) |
1233 mergestatemod.ACTION_MERGE, | 1227 mergestatemod.ACTION_MERGE, |
1234 mergestatemod.ACTION_EXEC, | 1228 mergestatemod.ACTION_EXEC, |
1235 mergestatemod.ACTION_KEEP, | 1229 mergestatemod.ACTION_KEEP, |
1236 mergestatemod.ACTION_PATH_CONFLICT, | 1230 mergestatemod.ACTION_PATH_CONFLICT, |
1237 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, | 1231 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, |
1238 mergestatemod.ACTION_GET_OTHER_AND_STORE, | |
1239 ) | 1232 ) |
1240 } | 1233 } |
1241 | 1234 |
1242 | 1235 |
1243 def applyupdates( | 1236 def applyupdates( |
1276 for f, op in pycompat.iteritems(commitinfo): | 1269 for f, op in pycompat.iteritems(commitinfo): |
1277 # the other side of filenode was choosen while merging, store this in | 1270 # the other side of filenode was choosen while merging, store this in |
1278 # mergestate so that it can be reused on commit | 1271 # mergestate so that it can be reused on commit |
1279 if op == b'other': | 1272 if op == b'other': |
1280 ms.addmergedother(f) | 1273 ms.addmergedother(f) |
1281 | |
1282 # add ACTION_GET_OTHER_AND_STORE to mergestate | |
1283 for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]: | |
1284 ms.addmergedother(e[0]) | |
1285 | 1274 |
1286 moves = [] | 1275 moves = [] |
1287 for m, l in actions.items(): | 1276 for m, l in actions.items(): |
1288 l.sort() | 1277 l.sort() |
1289 | 1278 |
1825 mergestatemod.ACTION_GET, | 1814 mergestatemod.ACTION_GET, |
1826 mergestatemod.ACTION_KEEP, | 1815 mergestatemod.ACTION_KEEP, |
1827 mergestatemod.ACTION_EXEC, | 1816 mergestatemod.ACTION_EXEC, |
1828 mergestatemod.ACTION_REMOVE, | 1817 mergestatemod.ACTION_REMOVE, |
1829 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, | 1818 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, |
1830 mergestatemod.ACTION_GET_OTHER_AND_STORE, | |
1831 ): | 1819 ): |
1832 msg = _(b"conflicting changes") | 1820 msg = _(b"conflicting changes") |
1833 hint = _(b"commit or update --clean to discard changes") | 1821 hint = _(b"commit or update --clean to discard changes") |
1834 raise error.Abort(msg, hint=hint) | 1822 raise error.Abort(msg, hint=hint) |
1835 | 1823 |
1895 actions = emptyactions() | 1883 actions = emptyactions() |
1896 for f, (m, args, msg) in pycompat.iteritems(actionbyfile): | 1884 for f, (m, args, msg) in pycompat.iteritems(actionbyfile): |
1897 if m not in actions: | 1885 if m not in actions: |
1898 actions[m] = [] | 1886 actions[m] = [] |
1899 actions[m].append((f, args, msg)) | 1887 actions[m].append((f, args, msg)) |
1900 | |
1901 # ACTION_GET_OTHER_AND_STORE is a mergestatemod.ACTION_GET + store in mergestate | |
1902 for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]: | |
1903 actions[mergestatemod.ACTION_GET].append(e) | |
1904 | 1888 |
1905 if not util.fscasesensitive(repo.path): | 1889 if not util.fscasesensitive(repo.path): |
1906 # check collision between files only in p2 for clean update | 1890 # check collision between files only in p2 for clean update |
1907 if not branchmerge and ( | 1891 if not branchmerge and ( |
1908 force or not wc.dirty(missing=True, branch=False) | 1892 force or not wc.dirty(missing=True, branch=False) |