##// END OF EJS Templates
dirstate: use a `merged` parameter to _addpath...
marmoute -
r48316:c6b91a9c default
parent child Browse files
Show More
@@ -448,6 +448,7 b' class dirstate(object):'
448 size=None,
448 size=None,
449 mtime=None,
449 mtime=None,
450 added=False,
450 added=False,
451 merged=False,
451 from_p2=False,
452 from_p2=False,
452 possibly_dirty=False,
453 possibly_dirty=False,
453 ):
454 ):
@@ -476,6 +477,7 b' class dirstate(object):'
476 size=size,
477 size=size,
477 mtime=mtime,
478 mtime=mtime,
478 added=added,
479 added=added,
480 merged=merged,
479 from_p2=from_p2,
481 from_p2=from_p2,
480 possibly_dirty=possibly_dirty,
482 possibly_dirty=possibly_dirty,
481 )
483 )
@@ -538,7 +540,7 b' class dirstate(object):'
538 raise error.Abort(msg)
540 raise error.Abort(msg)
539 if f in self and self[f] == b'n':
541 if f in self and self[f] == b'n':
540 # merge-like
542 # merge-like
541 self._addpath(f, b'm', 0, from_p2=True)
543 self._addpath(f, merged=True)
542 else:
544 else:
543 # add-like
545 # add-like
544 self._addpath(f, b'n', 0, from_p2=True)
546 self._addpath(f, b'n', 0, from_p2=True)
@@ -152,16 +152,24 b' class dirstatemap(object):'
152 size=None,
152 size=None,
153 mtime=None,
153 mtime=None,
154 added=False,
154 added=False,
155 merged=False,
155 from_p2=False,
156 from_p2=False,
156 possibly_dirty=False,
157 possibly_dirty=False,
157 ):
158 ):
158 """Add a tracked file to the dirstate."""
159 """Add a tracked file to the dirstate."""
159 if added:
160 if added:
161 assert not merged
160 assert not possibly_dirty
162 assert not possibly_dirty
161 assert not from_p2
163 assert not from_p2
162 state = b'a'
164 state = b'a'
163 size = NONNORMAL
165 size = NONNORMAL
164 mtime = AMBIGUOUS_TIME
166 mtime = AMBIGUOUS_TIME
167 elif merged:
168 assert not possibly_dirty
169 assert not from_p2
170 state = b'm'
171 size = FROM_P2
172 mtime = AMBIGUOUS_TIME
165 elif from_p2:
173 elif from_p2:
166 assert not possibly_dirty
174 assert not possibly_dirty
167 size = FROM_P2
175 size = FROM_P2
@@ -470,6 +478,7 b' if rustmod is not None:'
470 size=None,
478 size=None,
471 mtime=None,
479 mtime=None,
472 added=False,
480 added=False,
481 merged=False,
473 from_p2=False,
482 from_p2=False,
474 possibly_dirty=False,
483 possibly_dirty=False,
475 ):
484 ):
@@ -480,6 +489,7 b' if rustmod is not None:'
480 size,
489 size,
481 mtime,
490 mtime,
482 added,
491 added,
492 merged,
483 from_p2,
493 from_p2,
484 possibly_dirty,
494 possibly_dirty,
485 )
495 )
@@ -71,16 +71,24 b' impl DirstateMap {'
71 entry: DirstateEntry,
71 entry: DirstateEntry,
72 // XXX once the dust settle this should probably become an enum
72 // XXX once the dust settle this should probably become an enum
73 added: bool,
73 added: bool,
74 merged: bool,
74 from_p2: bool,
75 from_p2: bool,
75 possibly_dirty: bool,
76 possibly_dirty: bool,
76 ) -> Result<(), DirstateError> {
77 ) -> Result<(), DirstateError> {
77 let mut entry = entry;
78 let mut entry = entry;
78 if added {
79 if added {
80 assert!(!merged);
79 assert!(!possibly_dirty);
81 assert!(!possibly_dirty);
80 assert!(!from_p2);
82 assert!(!from_p2);
81 entry.state = EntryState::Added;
83 entry.state = EntryState::Added;
82 entry.size = SIZE_NON_NORMAL;
84 entry.size = SIZE_NON_NORMAL;
83 entry.mtime = MTIME_UNSET;
85 entry.mtime = MTIME_UNSET;
86 } else if merged {
87 assert!(!possibly_dirty);
88 assert!(!from_p2);
89 entry.state = EntryState::Merged;
90 entry.size = SIZE_FROM_OTHER_PARENT;
91 entry.mtime = MTIME_UNSET;
84 } else if from_p2 {
92 } else if from_p2 {
85 assert!(!possibly_dirty);
93 assert!(!possibly_dirty);
86 entry.size = SIZE_FROM_OTHER_PARENT;
94 entry.size = SIZE_FROM_OTHER_PARENT;
@@ -410,6 +418,7 b' mod tests {'
410 false,
418 false,
411 false,
419 false,
412 false,
420 false,
421 false,
413 )
422 )
414 .unwrap();
423 .unwrap();
415
424
@@ -723,6 +723,7 b" impl<'on_disk> super::dispatch::Dirstate"
723 filename: &HgPath,
723 filename: &HgPath,
724 entry: DirstateEntry,
724 entry: DirstateEntry,
725 added: bool,
725 added: bool,
726 merged: bool,
726 from_p2: bool,
727 from_p2: bool,
727 possibly_dirty: bool,
728 possibly_dirty: bool,
728 ) -> Result<(), DirstateError> {
729 ) -> Result<(), DirstateError> {
@@ -733,6 +734,12 b" impl<'on_disk> super::dispatch::Dirstate"
733 entry.state = EntryState::Added;
734 entry.state = EntryState::Added;
734 entry.size = SIZE_NON_NORMAL;
735 entry.size = SIZE_NON_NORMAL;
735 entry.mtime = MTIME_UNSET;
736 entry.mtime = MTIME_UNSET;
737 } else if merged {
738 assert!(!possibly_dirty);
739 assert!(!from_p2);
740 entry.state = EntryState::Merged;
741 entry.size = SIZE_FROM_OTHER_PARENT;
742 entry.mtime = MTIME_UNSET;
736 } else if from_p2 {
743 } else if from_p2 {
737 assert!(!possibly_dirty);
744 assert!(!possibly_dirty);
738 entry.size = SIZE_FROM_OTHER_PARENT;
745 entry.size = SIZE_FROM_OTHER_PARENT;
@@ -49,6 +49,7 b' pub trait DirstateMapMethods {'
49 filename: &HgPath,
49 filename: &HgPath,
50 entry: DirstateEntry,
50 entry: DirstateEntry,
51 added: bool,
51 added: bool,
52 merged: bool,
52 from_p2: bool,
53 from_p2: bool,
53 possibly_dirty: bool,
54 possibly_dirty: bool,
54 ) -> Result<(), DirstateError>;
55 ) -> Result<(), DirstateError>;
@@ -289,10 +290,11 b' impl DirstateMapMethods for DirstateMap '
289 filename: &HgPath,
290 filename: &HgPath,
290 entry: DirstateEntry,
291 entry: DirstateEntry,
291 added: bool,
292 added: bool,
293 merged: bool,
292 from_p2: bool,
294 from_p2: bool,
293 possibly_dirty: bool,
295 possibly_dirty: bool,
294 ) -> Result<(), DirstateError> {
296 ) -> Result<(), DirstateError> {
295 self.add_file(filename, entry, added, from_p2, possibly_dirty)
297 self.add_file(filename, entry, added, merged, from_p2, possibly_dirty)
296 }
298 }
297
299
298 fn remove_file(
300 fn remove_file(
@@ -113,6 +113,7 b' py_class!(pub class DirstateMap |py| {'
113 size: PyObject,
113 size: PyObject,
114 mtime: PyObject,
114 mtime: PyObject,
115 added: PyObject,
115 added: PyObject,
116 merged: PyObject,
116 from_p2: PyObject,
117 from_p2: PyObject,
117 possibly_dirty: PyObject,
118 possibly_dirty: PyObject,
118 ) -> PyResult<PyObject> {
119 ) -> PyResult<PyObject> {
@@ -153,12 +154,14 b' py_class!(pub class DirstateMap |py| {'
153 mtime: mtime,
154 mtime: mtime,
154 };
155 };
155 let added = added.extract::<PyBool>(py)?.is_true();
156 let added = added.extract::<PyBool>(py)?.is_true();
157 let merged = merged.extract::<PyBool>(py)?.is_true();
156 let from_p2 = from_p2.extract::<PyBool>(py)?.is_true();
158 let from_p2 = from_p2.extract::<PyBool>(py)?.is_true();
157 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true();
159 let possibly_dirty = possibly_dirty.extract::<PyBool>(py)?.is_true();
158 self.inner(py).borrow_mut().add_file(
160 self.inner(py).borrow_mut().add_file(
159 filename,
161 filename,
160 entry,
162 entry,
161 added,
163 added,
164 merged,
162 from_p2,
165 from_p2,
163 possibly_dirty
166 possibly_dirty
164 ).and(Ok(py.None())).or_else(|e: DirstateError| {
167 ).and(Ok(py.None())).or_else(|e: DirstateError| {
@@ -26,6 +26,7 b' impl DirstateMapMethods for OwningDirsta'
26 filename: &HgPath,
26 filename: &HgPath,
27 entry: DirstateEntry,
27 entry: DirstateEntry,
28 added: bool,
28 added: bool,
29 merged: bool,
29 from_p2: bool,
30 from_p2: bool,
30 possibly_dirty: bool,
31 possibly_dirty: bool,
31 ) -> Result<(), DirstateError> {
32 ) -> Result<(), DirstateError> {
@@ -33,6 +34,7 b' impl DirstateMapMethods for OwningDirsta'
33 filename,
34 filename,
34 entry,
35 entry,
35 added,
36 added,
37 merged,
36 from_p2,
38 from_p2,
37 possibly_dirty,
39 possibly_dirty,
38 )
40 )
General Comments 0
You need to be logged in to leave comments. Login now