##// END OF EJS Templates
dirstate: Replace dropfile with drop_item_and_copy_source...
Simon Sapin -
r48864:2ac0e6b2 default
parent child Browse files
Show More
@@ -606,7 +606,7 b' if rustmod is not None:'
606 self.copymap.pop(filename, None)
606 self.copymap.pop(filename, None)
607
607
608 if not (p1_tracked or p2_tracked or wc_tracked):
608 if not (p1_tracked or p2_tracked or wc_tracked):
609 self.dropfile(filename)
609 self._rustmap.drop_item_and_copy_source(filename)
610 elif merged:
610 elif merged:
611 # XXX might be merged and removed ?
611 # XXX might be merged and removed ?
612 entry = self.get(filename)
612 entry = self.get(filename)
@@ -684,8 +684,7 b' if rustmod is not None:'
684 return False
684 return False
685 else:
685 else:
686 if entry.added:
686 if entry.added:
687 self._rustmap.copymap().pop(f, None)
687 self._rustmap.drop_item_and_copy_source(f)
688 self._rustmap.dropfile(f)
689 else:
688 else:
690 self._rustmap.removefile(f, in_merge=True)
689 self._rustmap.removefile(f, in_merge=True)
691 return True
690 return True
@@ -693,10 +692,6 b' if rustmod is not None:'
693 def removefile(self, *args, **kwargs):
692 def removefile(self, *args, **kwargs):
694 return self._rustmap.removefile(*args, **kwargs)
693 return self._rustmap.removefile(*args, **kwargs)
695
694
696 def dropfile(self, f, *args, **kwargs):
697 self._rustmap.copymap().pop(f, None)
698 self._rustmap.dropfile(f, *args, **kwargs)
699
700 def clearambiguoustimes(self, *args, **kwargs):
695 def clearambiguoustimes(self, *args, **kwargs):
701 return self._rustmap.clearambiguoustimes(*args, **kwargs)
696 return self._rustmap.clearambiguoustimes(*args, **kwargs)
702
697
@@ -195,7 +195,7 b' impl DirstateMap {'
195
195
196 /// Remove a file from the dirstate.
196 /// Remove a file from the dirstate.
197 /// Returns `true` if the file was previously recorded.
197 /// Returns `true` if the file was previously recorded.
198 pub fn drop_file(
198 pub fn drop_entry_and_copy_source(
199 &mut self,
199 &mut self,
200 filename: &HgPath,
200 filename: &HgPath,
201 ) -> Result<(), DirstateError> {
201 ) -> Result<(), DirstateError> {
@@ -216,6 +216,8 b' impl DirstateMap {'
216 .0
216 .0
217 .remove(filename);
217 .remove(filename);
218
218
219 self.copy_map.remove(filename);
220
219 Ok(())
221 Ok(())
220 }
222 }
221
223
@@ -845,7 +845,10 b" impl<'on_disk> super::dispatch::Dirstate"
845 Ok(self.add_or_remove_file(filename, old_state, entry)?)
845 Ok(self.add_or_remove_file(filename, old_state, entry)?)
846 }
846 }
847
847
848 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
848 fn drop_entry_and_copy_source(
849 &mut self,
850 filename: &HgPath,
851 ) -> Result<(), DirstateError> {
849 let was_tracked = self
852 let was_tracked = self
850 .get(filename)?
853 .get(filename)?
851 .map_or(false, |e| e.state().is_tracked());
854 .map_or(false, |e| e.state().is_tracked());
@@ -907,7 +910,8 b" impl<'on_disk> super::dispatch::Dirstate"
907 node.data = NodeData::None
910 node.data = NodeData::None
908 }
911 }
909 if let Some(source) = &node.copy_source {
912 if let Some(source) = &node.copy_source {
910 DirstateMap::count_dropped_path(unreachable_bytes, source)
913 DirstateMap::count_dropped_path(unreachable_bytes, source);
914 node.copy_source = None
911 }
915 }
912 dropped = Dropped {
916 dropped = Dropped {
913 was_tracked: node
917 was_tracked: node
@@ -66,7 +66,10 b' pub trait DirstateMapMethods {'
66 /// Drop information about this file from the map if any.
66 /// Drop information about this file from the map if any.
67 ///
67 ///
68 /// `get` will now return `None` for this filename.
68 /// `get` will now return `None` for this filename.
69 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError>;
69 fn drop_entry_and_copy_source(
70 &mut self,
71 filename: &HgPath,
72 ) -> Result<(), DirstateError>;
70
73
71 /// Among given files, mark the stored `mtime` as ambiguous if there is one
74 /// Among given files, mark the stored `mtime` as ambiguous if there is one
72 /// (if `state == EntryState::Normal`) equal to the given current Unix
75 /// (if `state == EntryState::Normal`) equal to the given current Unix
@@ -339,8 +342,11 b' impl DirstateMapMethods for DirstateMap '
339 self.remove_file(filename, in_merge)
342 self.remove_file(filename, in_merge)
340 }
343 }
341
344
342 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
345 fn drop_entry_and_copy_source(
343 self.drop_file(filename)
346 &mut self,
347 filename: &HgPath,
348 ) -> Result<(), DirstateError> {
349 self.drop_entry_and_copy_source(filename)
344 }
350 }
345
351
346 fn clear_ambiguous_times(
352 fn clear_ambiguous_times(
@@ -55,8 +55,11 b' impl DirstateMapMethods for OwningDirsta'
55 self.get_mut().remove_file(filename, in_merge)
55 self.get_mut().remove_file(filename, in_merge)
56 }
56 }
57
57
58 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
58 fn drop_entry_and_copy_source(
59 self.get_mut().drop_file(filename)
59 &mut self,
60 filename: &HgPath,
61 ) -> Result<(), DirstateError> {
62 self.get_mut().drop_entry_and_copy_source(filename)
60 }
63 }
61
64
62 fn clear_ambiguous_times(
65 fn clear_ambiguous_times(
@@ -210,13 +210,13 b' py_class!(pub class DirstateMap |py| {'
210 Ok(py.None())
210 Ok(py.None())
211 }
211 }
212
212
213 def dropfile(
213 def drop_item_and_copy_source(
214 &self,
214 &self,
215 f: PyBytes,
215 f: PyBytes,
216 ) -> PyResult<PyNone> {
216 ) -> PyResult<PyNone> {
217 self.inner(py)
217 self.inner(py)
218 .borrow_mut()
218 .borrow_mut()
219 .drop_file(HgPath::new(f.data(py)))
219 .drop_entry_and_copy_source(HgPath::new(f.data(py)))
220 .map_err(|e |dirstate_error(py, e))?;
220 .map_err(|e |dirstate_error(py, e))?;
221 Ok(PyNone)
221 Ok(PyNone)
222 }
222 }
General Comments 0
You need to be logged in to leave comments. Login now