@@ -259,6 +259,14 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
259
259
None
260
260
} ;
261
261
262
+ if changes. is_some ( ) && push_mode == PushMode :: Review {
263
+ changes = Some ( refs_to_changes (
264
+ & transaction_mirror,
265
+ & baseref. replacen ( "refs/heads/" , "" , 1 ) ,
266
+ & author,
267
+ ) ) ;
268
+ }
269
+
262
270
let filter = josh:: filter:: parse ( & repo_update. filter_spec ) ?;
263
271
let new_oid = git2:: Oid :: from_str ( new) ?;
264
272
let backward_new_oid = {
@@ -868,6 +876,38 @@ impl Drop for TmpGitNamespace {
868
876
}
869
877
}
870
878
879
+ fn refs_to_changes (
880
+ transaction : & josh:: cache:: Transaction ,
881
+ baseref : & str ,
882
+ change_author : & str ,
883
+ ) -> Vec < josh:: Change > {
884
+ let mut changes = vec ! [ ] ;
885
+ let glob = transaction. refname ( & format ! (
886
+ "refs/heads/@changes/{}/{}/*" ,
887
+ baseref, change_author
888
+ ) ) ;
889
+
890
+ for r in transaction. repo ( ) . references_glob ( & glob) . unwrap ( ) {
891
+ let r = r. unwrap ( ) ;
892
+ let mut change = josh:: Change :: new ( r. target ( ) . unwrap ( ) ) ;
893
+ change. author = change_author. to_string ( ) ;
894
+
895
+ let id = r. name ( ) . unwrap ( ) . replacen (
896
+ & transaction. refname ( & format ! (
897
+ "refs/heads/@changes/{}/{}/" ,
898
+ baseref, change_author
899
+ ) ) ,
900
+ "" ,
901
+ 1 ,
902
+ ) ;
903
+ change. id = Some ( id) ;
904
+
905
+ changes. push ( change) ;
906
+ }
907
+
908
+ return changes;
909
+ }
910
+
871
911
fn changes_to_refs (
872
912
baseref : & str ,
873
913
change_author : & str ,
@@ -887,12 +927,12 @@ fn changes_to_refs(
887
927
if id. contains ( '@' ) {
888
928
return Err ( josh:: josh_error ( "Change id must not contain '@'" ) ) ;
889
929
}
890
- if seen. contains ( & id) {
891
- return Err ( josh:: josh_error ( & format ! (
892
- "rejecting to push {:?} with duplicate label" ,
893
- change. commit
894
- ) ) ) ;
895
- }
930
+ // if seen.contains(&id) {
931
+ // return Err(josh::josh_error(&format!(
932
+ // "rejecting to push {:?} with duplicate label",
933
+ // change.commit
934
+ // )));
935
+ // }
896
936
seen. push ( id) ;
897
937
} else {
898
938
return Err ( josh:: josh_error ( & format ! (
0 commit comments