@@ -206,12 +206,19 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
206
206
None
207
207
} ;
208
208
209
- let mut changes = if push_mode == PushMode :: Stack || push_mode == PushMode :: Split {
210
- Some ( vec ! [ ] )
209
+ let author = if let Some ( p ) = push_options . get ( "author" ) {
210
+ p . to_string ( )
211
211
} else {
212
- None
212
+ "" . to_string ( )
213
213
} ;
214
214
215
+ let mut changes =
216
+ if push_mode == PushMode :: Stack || push_mode == PushMode :: Split || author != "" {
217
+ Some ( vec ! [ ] )
218
+ } else {
219
+ None
220
+ } ;
221
+
215
222
let filterobj = josh:: filter:: parse ( & repo_update. filter_spec ) ?;
216
223
let new_oid = git2:: Oid :: from_str ( new) ?;
217
224
let backward_new_oid = {
@@ -265,12 +272,6 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
265
272
push_to
266
273
} ;
267
274
268
- let author = if let Some ( p) = push_options. get ( "author" ) {
269
- p. to_string ( )
270
- } else {
271
- "" . to_string ( )
272
- } ;
273
-
274
275
let to_push = if let Some ( changes) = changes {
275
276
let mut v = vec ! [ ] ;
276
277
v. append ( & mut changes_to_refs ( & baseref, & author, changes) ?) ;
@@ -279,6 +280,10 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
279
280
split_changes ( transaction. repo ( ) , & mut v, old) ?;
280
281
}
281
282
283
+ if push_mode == PushMode :: Review {
284
+ v. push ( ( ref_with_options, oid_to_push, "JOSH_PUSH" . to_string ( ) ) ) ;
285
+ }
286
+
282
287
v. push ( (
283
288
format ! (
284
289
"refs/heads/@heads/{}/{}" ,
@@ -820,20 +825,20 @@ fn changes_to_refs(
820
825
} ;
821
826
822
827
for change in changes. iter ( ) {
823
- if let Some ( label ) = & change. label {
824
- if label . contains ( '@' ) {
825
- return Err ( josh:: josh_error ( "Change label must not contain '@'" ) ) ;
828
+ if let Some ( id ) = & change. id {
829
+ if id . contains ( '@' ) {
830
+ return Err ( josh:: josh_error ( "Change id must not contain '@'" ) ) ;
826
831
}
827
- if seen. contains ( & label ) {
832
+ if seen. contains ( & id ) {
828
833
return Err ( josh:: josh_error ( & format ! (
829
834
"rejecting to push {:?} with duplicate label" ,
830
835
change. commit
831
836
) ) ) ;
832
837
}
833
- seen. push ( label ) ;
838
+ seen. push ( id ) ;
834
839
} else {
835
840
return Err ( josh:: josh_error ( & format ! (
836
- "rejecting to push {:?} without label " ,
841
+ "rejecting to push {:?} without id " ,
837
842
change. commit
838
843
) ) ) ;
839
844
}
@@ -847,11 +852,11 @@ fn changes_to_refs(
847
852
"refs/heads/@changes/{}/{}/{}" ,
848
853
baseref. replacen( "refs/heads/" , "" , 1 ) ,
849
854
change. author,
850
- change. label . as_ref( ) . unwrap_or( & "" . to_string( ) ) ,
855
+ change. id . as_ref( ) . unwrap_or( & "" . to_string( ) ) ,
851
856
) ,
852
857
change. commit ,
853
858
change
854
- . label
859
+ . id
855
860
. as_ref ( )
856
861
. unwrap_or ( & "JOSH_PUSH" . to_string ( ) )
857
862
. to_string ( ) ,
0 commit comments