##// END OF EJS Templates
commit: set whole manifest entries at once (node with its associated flags)...
Arseniy Alekseyev -
r52651:421c9b3f default
parent child Browse files
Show More
@@ -214,15 +214,15 b' def _process_files(tr, ctx, ms, files, n'
214 elif narrow_action == mergestate.CHANGE_ADDED:
214 elif narrow_action == mergestate.CHANGE_ADDED:
215 files.mark_added(f)
215 files.mark_added(f)
216 added.append(f)
216 added.append(f)
217 m[f] = m2[f]
217 fnode = m2[f]
218 flags = m2ctx.find(f)[1] or b''
218 flags = m2ctx.find(f)[1] or b''
219 m.setflag(f, flags)
219 m.set(f, fnode, flags)
220 elif narrow_action == mergestate.CHANGE_MODIFIED:
220 elif narrow_action == mergestate.CHANGE_MODIFIED:
221 files.mark_touched(f)
221 files.mark_touched(f)
222 added.append(f)
222 added.append(f)
223 m[f] = m2[f]
223 fnode = m2[f]
224 flags = m2ctx.find(f)[1] or b''
224 flags = m2ctx.find(f)[1] or b''
225 m.setflag(f, flags)
225 m.set(f, fnode, flags)
226 else:
226 else:
227 msg = _(b"corrupted mergestate, unknown narrow action: %b")
227 msg = _(b"corrupted mergestate, unknown narrow action: %b")
228 hint = _(b"restart the merge")
228 hint = _(b"restart the merge")
@@ -234,7 +234,7 b' def _process_files(tr, ctx, ms, files, n'
234 removed.append(f)
234 removed.append(f)
235 else:
235 else:
236 added.append(f)
236 added.append(f)
237 m[f], is_touched = _filecommit(
237 fnode, is_touched = _filecommit(
238 repo, fctx, m1, m2, linkrev, tr, writefilecopymeta, ms
238 repo, fctx, m1, m2, linkrev, tr, writefilecopymeta, ms
239 )
239 )
240 if is_touched:
240 if is_touched:
@@ -244,7 +244,7 b' def _process_files(tr, ctx, ms, files, n'
244 files.mark_merged(f)
244 files.mark_merged(f)
245 else:
245 else:
246 files.mark_touched(f)
246 files.mark_touched(f)
247 m.setflag(f, fctx.flags())
247 m.set(f, fnode, fctx.flags())
248 except OSError:
248 except OSError:
249 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
249 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f))
250 raise
250 raise
@@ -1021,6 +1021,12 b' class imanifestdict(interfaceutil.Interf'
1021
1021
1022 __bool__ = __nonzero__
1022 __bool__ = __nonzero__
1023
1023
1024 def set(path, node, flags):
1025 """Define the node value and flags for a path in the manifest.
1026
1027 Equivalent to __setitem__ followed by setflag, but can be more efficient.
1028 """
1029
1024 def __setitem__(path, node):
1030 def __setitem__(path, node):
1025 """Define the node value for a path in the manifest.
1031 """Define the node value for a path in the manifest.
1026
1032
@@ -493,6 +493,9 b' class manifestdict:'
493
493
494 __bool__ = __nonzero__
494 __bool__ = __nonzero__
495
495
496 def set(self, key, node, flags):
497 self._lm[key] = node, flags
498
496 def __setitem__(self, key, node):
499 def __setitem__(self, key, node):
497 self._lm[key] = node, self.flags(key)
500 self._lm[key] = node, self.flags(key)
498
501
@@ -1048,6 +1051,26 b' class treemanifest:'
1048 del self._flags[f]
1051 del self._flags[f]
1049 self._dirty = True
1052 self._dirty = True
1050
1053
1054 def set(self, f, node, flags):
1055 """Set both the node and the flags for path f."""
1056 assert node is not None
1057 if flags not in _manifestflags:
1058 raise TypeError(b"Invalid manifest flag set.")
1059 self._load()
1060 dir, subpath = _splittopdir(f)
1061 if dir:
1062 self._loadlazy(dir)
1063 if dir not in self._dirs:
1064 self._dirs[dir] = treemanifest(
1065 self.nodeconstants, self._subpath(dir)
1066 )
1067 self._dirs[dir].set(subpath, node, flags)
1068 else:
1069 assert len(node) in (20, 32)
1070 self._files[f] = node
1071 self._flags[f] = flags
1072 self._dirty = True
1073
1051 def __setitem__(self, f, n):
1074 def __setitem__(self, f, n):
1052 assert n is not None
1075 assert n is not None
1053 self._load()
1076 self._load()
General Comments 0
You need to be logged in to leave comments. Login now