##// END OF EJS Templates
merge: move conversion of file-key dict to action-key dict in mergeresult...
Pulkit Goyal -
r45836:f4a2b329 default
parent child Browse files
Show More
@@ -578,6 +578,19 b' class mergeresult(object):'
578 def commitinfo(self):
578 def commitinfo(self):
579 return self._commitinfo
579 return self._commitinfo
580
580
581 @property
582 def actionsdict(self):
583 """ returns a dictionary of actions to be perfomed with action as key
584 and a list of files and related arguments as values """
585 # Convert to dictionary-of-lists format
586 actions = emptyactions()
587 for f, (m, args, msg) in pycompat.iteritems(self._actions):
588 if m not in actions:
589 actions[m] = []
590 actions[m].append((f, args, msg))
591
592 return actions
593
581 def setactions(self, actions):
594 def setactions(self, actions):
582 self._actions = actions
595 self._actions = actions
583
596
@@ -1821,8 +1834,6 b' def update('
1821 mergeforce=mergeforce,
1834 mergeforce=mergeforce,
1822 )
1835 )
1823
1836
1824 actionbyfile = mresult.actions
1825
1826 if updatecheck == UPDATECHECK_NO_CONFLICT:
1837 if updatecheck == UPDATECHECK_NO_CONFLICT:
1827 if mresult.hasconflicts():
1838 if mresult.hasconflicts():
1828 msg = _(b"conflicting changes")
1839 msg = _(b"conflicting changes")
@@ -1832,9 +1843,9 b' def update('
1832 # Prompt and create actions. Most of this is in the resolve phase
1843 # Prompt and create actions. Most of this is in the resolve phase
1833 # already, but we can't handle .hgsubstate in filemerge or
1844 # already, but we can't handle .hgsubstate in filemerge or
1834 # subrepoutil.submerge yet so we have to keep prompting for it.
1845 # subrepoutil.submerge yet so we have to keep prompting for it.
1835 if b'.hgsubstate' in actionbyfile:
1846 if b'.hgsubstate' in mresult.actions:
1836 f = b'.hgsubstate'
1847 f = b'.hgsubstate'
1837 m, args, msg = actionbyfile[f]
1848 m, args, msg = mresult.actions[f]
1838 prompts = filemerge.partextras(labels)
1849 prompts = filemerge.partextras(labels)
1839 prompts[b'f'] = f
1850 prompts[b'f'] = f
1840 if m == mergestatemod.ACTION_CHANGED_DELETED:
1851 if m == mergestatemod.ACTION_CHANGED_DELETED:
@@ -1847,19 +1858,19 b' def update('
1847 % prompts,
1858 % prompts,
1848 0,
1859 0,
1849 ):
1860 ):
1850 actionbyfile[f] = (
1861 mresult.actions[f] = (
1851 mergestatemod.ACTION_REMOVE,
1862 mergestatemod.ACTION_REMOVE,
1852 None,
1863 None,
1853 b'prompt delete',
1864 b'prompt delete',
1854 )
1865 )
1855 elif f in p1:
1866 elif f in p1:
1856 actionbyfile[f] = (
1867 mresult.actions[f] = (
1857 mergestatemod.ACTION_ADD_MODIFIED,
1868 mergestatemod.ACTION_ADD_MODIFIED,
1858 None,
1869 None,
1859 b'prompt keep',
1870 b'prompt keep',
1860 )
1871 )
1861 else:
1872 else:
1862 actionbyfile[f] = (
1873 mresult.actions[f] = (
1863 mergestatemod.ACTION_ADD,
1874 mergestatemod.ACTION_ADD,
1864 None,
1875 None,
1865 b'prompt keep',
1876 b'prompt keep',
@@ -1879,20 +1890,16 b' def update('
1879 )
1890 )
1880 == 0
1891 == 0
1881 ):
1892 ):
1882 actionbyfile[f] = (
1893 mresult.actions[f] = (
1883 mergestatemod.ACTION_GET,
1894 mergestatemod.ACTION_GET,
1884 (flags, False),
1895 (flags, False),
1885 b'prompt recreating',
1896 b'prompt recreating',
1886 )
1897 )
1887 else:
1898 else:
1888 del actionbyfile[f]
1899 del mresult.actions[f]
1889
1900
1890 # Convert to dictionary-of-lists format
1901 # Convert to dictionary-of-lists format
1891 actions = emptyactions()
1902 actions = mresult.actionsdict
1892 for f, (m, args, msg) in pycompat.iteritems(actionbyfile):
1893 if m not in actions:
1894 actions[m] = []
1895 actions[m].append((f, args, msg))
1896
1903
1897 if not util.fscasesensitive(repo.path):
1904 if not util.fscasesensitive(repo.path):
1898 # check collision between files only in p2 for clean update
1905 # check collision between files only in p2 for clean update
General Comments 0
You need to be logged in to leave comments. Login now