File tree Expand file tree Collapse file tree 6 files changed +22
-2
lines changed Expand file tree Collapse file tree 6 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ use crate::backend::TreeId;
6868use crate :: backend:: TreeValue ;
6969use crate :: commit:: Commit ;
7070use crate :: config:: ConfigGetError ;
71+ use crate :: conflict_labels:: ConflictLabels ;
7172use crate :: conflicts;
7273use crate :: conflicts:: ConflictMarkerStyle ;
7374use crate :: conflicts:: ConflictMaterializeOptions ;
@@ -977,7 +978,10 @@ impl TreeState {
977978 . iter ( )
978979 . map ( |id| TreeId :: new ( id. clone ( ) ) )
979980 . collect ( ) ;
980- self . tree_id = MergedTreeId :: unlabeled ( tree_ids_builder. build ( ) ) ;
981+ self . tree_id = MergedTreeId :: new (
982+ tree_ids_builder. build ( ) ,
983+ ConflictLabels :: from_vec ( proto. conflict_labels ) ,
984+ ) ;
981985 }
982986 self . file_states =
983987 FileStatesMap :: from_proto ( proto. file_states , proto. is_file_states_sorted ) ;
@@ -995,6 +999,7 @@ impl TreeState {
995999 . iter ( )
9961000 . map ( |id| id. to_bytes ( ) )
9971001 . collect ( ) ;
1002+ proto. conflict_labels = self . tree_id . labels ( ) . as_slice ( ) . to_owned ( ) ;
9981003 proto. file_states = self . file_states . data . clone ( ) ;
9991004 // `FileStatesMap` is guaranteed to be sorted.
10001005 proto. is_file_states_sorted = true ;
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ message TreeState {
5151 // Alternating positive and negative terms if there's a conflict, otherwise a
5252 // single (positive) value
5353 repeated bytes tree_ids = 5 ;
54+ // Labels for the terms of a conflict.
55+ repeated string conflict_labels = 7 ;
5456 repeated FileStateEntry file_states = 2 ;
5557 bool is_file_states_sorted = 6 ;
5658 SparsePatterns sparse_patterns = 3 ;
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ pub struct TreeState {
3737 /// single (positive) value
3838 #[ prost( bytes = "vec" , repeated, tag = "5" ) ]
3939 pub tree_ids : :: prost:: alloc:: vec:: Vec < :: prost:: alloc:: vec:: Vec < u8 > > ,
40+ /// Labels for the terms of a conflict.
41+ #[ prost( string, repeated, tag = "7" ) ]
42+ pub conflict_labels : :: prost:: alloc:: vec:: Vec < :: prost:: alloc:: string:: String > ,
4043 #[ prost( message, repeated, tag = "2" ) ]
4144 pub file_states : :: prost:: alloc:: vec:: Vec < FileStateEntry > ,
4245 #[ prost( bool , tag = "6" ) ]
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ message Commit {
4444 repeated bytes predecessors = 2 ;
4545 // Alternating positive and negative terms
4646 repeated bytes root_tree = 3 ;
47+ // Labels for the terms of a conflict.
48+ repeated string conflict_labels = 10 ;
4749 bytes change_id = 4 ;
4850 string description = 5 ;
4951
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ pub struct Commit {
4949 /// Alternating positive and negative terms
5050 #[ prost( bytes = "vec" , repeated, tag = "3" ) ]
5151 pub root_tree : :: prost:: alloc:: vec:: Vec < :: prost:: alloc:: vec:: Vec < u8 > > ,
52+ /// Labels for the terms of a conflict.
53+ #[ prost( string, repeated, tag = "10" ) ]
54+ pub conflict_labels : :: prost:: alloc:: vec:: Vec < :: prost:: alloc:: string:: String > ,
5255 #[ prost( bytes = "vec" , tag = "4" ) ]
5356 pub change_id : :: prost:: alloc:: vec:: Vec < u8 > ,
5457 #[ prost( string, tag = "5" ) ]
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ use crate::backend::Tree;
5757use crate :: backend:: TreeId ;
5858use crate :: backend:: TreeValue ;
5959use crate :: backend:: make_root_commit;
60+ use crate :: conflict_labels:: ConflictLabels ;
6061use crate :: content_hash:: blake2b_hash;
6162use crate :: file_util:: persist_content_addressed_temp_file;
6263use crate :: index:: Index ;
@@ -365,6 +366,7 @@ pub fn commit_to_proto(commit: &Commit) -> crate::protos::simple_store::Commit {
365366 . iter ( )
366367 . map ( |id| id. to_bytes ( ) )
367368 . collect ( ) ;
369+ proto. conflict_labels = commit. root_tree . labels ( ) . as_slice ( ) . to_owned ( ) ;
368370 proto. change_id = commit. change_id . to_bytes ( ) ;
369371 proto. description = commit. description . clone ( ) ;
370372 proto. author = Some ( signature_to_proto ( & commit. author ) ) ;
@@ -383,7 +385,10 @@ fn commit_from_proto(mut proto: crate::protos::simple_store::Commit) -> Commit {
383385 let parents = proto. parents . into_iter ( ) . map ( CommitId :: new) . collect ( ) ;
384386 let predecessors = proto. predecessors . into_iter ( ) . map ( CommitId :: new) . collect ( ) ;
385387 let merge_builder: MergeBuilder < _ > = proto. root_tree . into_iter ( ) . map ( TreeId :: new) . collect ( ) ;
386- let root_tree = MergedTreeId :: unlabeled ( merge_builder. build ( ) ) ;
388+ let root_tree = MergedTreeId :: new (
389+ merge_builder. build ( ) ,
390+ ConflictLabels :: from_vec ( proto. conflict_labels ) ,
391+ ) ;
387392 let change_id = ChangeId :: new ( proto. change_id ) ;
388393 Commit {
389394 parents,
You can’t perform that action at this time.
0 commit comments