##// END OF EJS Templates
dirstate: no longer pass the `oldstate` value to the dirstatemap...
marmoute -
r48313:69a463a4 default
parent child Browse files
Show More
@@ -450,7 +450,6 b' class dirstate(object):'
450 from_p2=False,
450 from_p2=False,
451 possibly_dirty=False,
451 possibly_dirty=False,
452 ):
452 ):
453 oldstate = self[f]
454 entry = self._map.get(f)
453 entry = self._map.get(f)
455 if state == b'a' or entry is not None and entry.removed:
454 if state == b'a' or entry is not None and entry.removed:
456 scmutil.checkfilename(f)
455 scmutil.checkfilename(f)
@@ -471,7 +470,6 b' class dirstate(object):'
471 self._updatedfiles.add(f)
470 self._updatedfiles.add(f)
472 self._map.addfile(
471 self._map.addfile(
473 f,
472 f,
474 oldstate,
475 state=state,
473 state=state,
476 mode=mode,
474 mode=mode,
477 size=size,
475 size=size,
@@ -147,7 +147,6 b' class dirstatemap(object):'
147 def addfile(
147 def addfile(
148 self,
148 self,
149 f,
149 f,
150 oldstate,
151 state,
150 state,
152 mode,
151 mode,
153 size=None,
152 size=None,
@@ -175,9 +174,12 b' class dirstatemap(object):'
175 mtime = mtime & rangemask
174 mtime = mtime & rangemask
176 assert size is not None
175 assert size is not None
177 assert mtime is not None
176 assert mtime is not None
178 if oldstate in b"?r" and "_dirs" in self.__dict__:
177 old_entry = self.get(f)
178 if (
179 old_entry is None or old_entry.removed
180 ) and "_dirs" in self.__dict__:
179 self._dirs.addpath(f)
181 self._dirs.addpath(f)
180 if oldstate == b"?" and "_alldirs" in self.__dict__:
182 if old_entry is None and "_alldirs" in self.__dict__:
181 self._alldirs.addpath(f)
183 self._alldirs.addpath(f)
182 self._map[f] = dirstatetuple(state, mode, size, mtime)
184 self._map[f] = dirstatetuple(state, mode, size, mtime)
183 if state != b'n' or mtime == AMBIGUOUS_TIME:
185 if state != b'n' or mtime == AMBIGUOUS_TIME:
@@ -459,7 +461,6 b' if rustmod is not None:'
459 def addfile(
461 def addfile(
460 self,
462 self,
461 f,
463 f,
462 oldstate,
463 state,
464 state,
464 mode,
465 mode,
465 size=None,
466 size=None,
@@ -469,7 +470,6 b' if rustmod is not None:'
469 ):
470 ):
470 return self._rustmap.addfile(
471 return self._rustmap.addfile(
471 f,
472 f,
472 oldstate,
473 state,
473 state,
474 mode,
474 mode,
475 size,
475 size,
@@ -68,7 +68,6 b' impl DirstateMap {'
68 pub fn add_file(
68 pub fn add_file(
69 &mut self,
69 &mut self,
70 filename: &HgPath,
70 filename: &HgPath,
71 old_state: EntryState,
72 entry: DirstateEntry,
71 entry: DirstateEntry,
73 // XXX once the dust settle this should probably become an enum
72 // XXX once the dust settle this should probably become an enum
74 from_p2: bool,
73 from_p2: bool,
@@ -91,7 +90,10 b' impl DirstateMap {'
91 entry.size = entry.size & V1_RANGEMASK;
90 entry.size = entry.size & V1_RANGEMASK;
92 entry.mtime = entry.mtime & V1_RANGEMASK;
91 entry.mtime = entry.mtime & V1_RANGEMASK;
93 }
92 }
94
93 let old_state = match self.get(filename) {
94 Some(e) => e.state,
95 None => EntryState::Unknown,
96 };
95 if old_state == EntryState::Unknown || old_state == EntryState::Removed
97 if old_state == EntryState::Unknown || old_state == EntryState::Removed
96 {
98 {
97 if let Some(ref mut dirs) = self.dirs {
99 if let Some(ref mut dirs) = self.dirs {
@@ -397,7 +399,6 b' mod tests {'
397
399
398 map.add_file(
400 map.add_file(
399 HgPath::new(b"meh"),
401 HgPath::new(b"meh"),
400 EntryState::Normal,
401 DirstateEntry {
402 DirstateEntry {
402 state: EntryState::Normal,
403 state: EntryState::Normal,
403 mode: 1337,
404 mode: 1337,
@@ -721,7 +721,6 b" impl<'on_disk> super::dispatch::Dirstate"
721 fn add_file(
721 fn add_file(
722 &mut self,
722 &mut self,
723 filename: &HgPath,
723 filename: &HgPath,
724 old_state: EntryState,
725 entry: DirstateEntry,
724 entry: DirstateEntry,
726 from_p2: bool,
725 from_p2: bool,
727 possibly_dirty: bool,
726 possibly_dirty: bool,
@@ -744,6 +743,11 b" impl<'on_disk> super::dispatch::Dirstate"
744 entry.mtime = entry.mtime & V1_RANGEMASK;
743 entry.mtime = entry.mtime & V1_RANGEMASK;
745 }
744 }
746
745
746 let old_state = match self.get(filename)? {
747 Some(e) => e.state,
748 None => EntryState::Unknown,
749 };
750
747 Ok(self.add_or_remove_file(filename, old_state, entry)?)
751 Ok(self.add_or_remove_file(filename, old_state, entry)?)
748 }
752 }
749
753
@@ -47,7 +47,6 b' pub trait DirstateMapMethods {'
47 fn add_file(
47 fn add_file(
48 &mut self,
48 &mut self,
49 filename: &HgPath,
49 filename: &HgPath,
50 old_state: EntryState,
51 entry: DirstateEntry,
50 entry: DirstateEntry,
52 from_p2: bool,
51 from_p2: bool,
53 possibly_dirty: bool,
52 possibly_dirty: bool,
@@ -287,12 +286,11 b' impl DirstateMapMethods for DirstateMap '
287 fn add_file(
286 fn add_file(
288 &mut self,
287 &mut self,
289 filename: &HgPath,
288 filename: &HgPath,
290 old_state: EntryState,
291 entry: DirstateEntry,
289 entry: DirstateEntry,
292 from_p2: bool,
290 from_p2: bool,
293 possibly_dirty: bool,
291 possibly_dirty: bool,
294 ) -> Result<(), DirstateError> {
292 ) -> Result<(), DirstateError> {
295 self.add_file(filename, old_state, entry, from_p2, possibly_dirty)
293 self.add_file(filename, entry, from_p2, possibly_dirty)
296 }
294 }
297
295
298 fn remove_file(
296 fn remove_file(
@@ -108,7 +108,6 b' py_class!(pub class DirstateMap |py| {'
108 def addfile(
108 def addfile(
109 &self,
109 &self,
110 f: PyObject,
110 f: PyObject,
111 oldstate: PyObject,
112 state: PyObject,
111 state: PyObject,
113 mode: PyObject,
112 mode: PyObject,
114 size: PyObject,
113 size: PyObject,
@@ -118,11 +117,6 b' py_class!(pub class DirstateMap |py| {'
118 ) -> PyResult<PyObject> {
117 ) -> PyResult<PyObject> {
119 let f = f.extract::<PyBytes>(py)?;
118 let f = f.extract::<PyBytes>(py)?;
120 let filename = HgPath::new(f.data(py));
119 let filename = HgPath::new(f.data(py));
121 let oldstate = oldstate.extract::<PyBytes>(py)?.data(py)[0]
122 .try_into()
123 .map_err(|e: HgError| {
124 PyErr::new::<exc::ValueError, _>(py, e.to_string())
125 })?;
126 let state = state.extract::<PyBytes>(py)?.data(py)[0]
120 let state = state.extract::<PyBytes>(py)?.data(py)[0]
127 .try_into()
121 .try_into()
128 .map_err(|e: HgError| {
122 .map_err(|e: HgError| {
@@ -151,7 +145,6 b' py_class!(pub class DirstateMap |py| {'
151 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true();
145 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true();
152 self.inner(py).borrow_mut().add_file(
146 self.inner(py).borrow_mut().add_file(
153 filename,
147 filename,
154 oldstate,
155 entry,
148 entry,
156 from_p2,
149 from_p2,
157 possibly_dirty
150 possibly_dirty
@@ -24,18 +24,12 b' impl DirstateMapMethods for OwningDirsta'
24 fn add_file(
24 fn add_file(
25 &mut self,
25 &mut self,
26 filename: &HgPath,
26 filename: &HgPath,
27 old_state: EntryState,
28 entry: DirstateEntry,
27 entry: DirstateEntry,
29 from_p2: bool,
28 from_p2: bool,
30 possibly_dirty: bool,
29 possibly_dirty: bool,
31 ) -> Result<(), DirstateError> {
30 ) -> Result<(), DirstateError> {
32 self.get_mut().add_file(
31 self.get_mut()
33 filename,
32 .add_file(filename, entry, from_p2, possibly_dirty)
34 old_state,
35 entry,
36 from_p2,
37 possibly_dirty,
38 )
39 }
33 }
40
34
41 fn remove_file(
35 fn remove_file(
General Comments 0
You need to be logged in to leave comments. Login now