@@ -206,12 +206,19 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
206206 None
207207 } ;
208208
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 ( )
211211 } else {
212- None
212+ "" . to_string ( )
213213 } ;
214214
215+ let mut changes =
216+ if push_mode == PushMode :: Stack || push_mode == PushMode :: Split || author != "" {
217+ Some ( vec ! [ ] )
218+ } else {
219+ None
220+ } ;
221+
215222 let filterobj = josh:: filter:: parse ( & repo_update. filter_spec ) ?;
216223 let new_oid = git2:: Oid :: from_str ( new) ?;
217224 let backward_new_oid = {
@@ -265,12 +272,6 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
265272 push_to
266273 } ;
267274
268- let author = if let Some ( p) = push_options. get ( "author" ) {
269- p. to_string ( )
270- } else {
271- "" . to_string ( )
272- } ;
273-
274275 let to_push = if let Some ( changes) = changes {
275276 let mut v = vec ! [ ] ;
276277 v. append ( & mut changes_to_refs ( & baseref, & author, changes) ?) ;
@@ -279,6 +280,10 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult<String>
279280 split_changes ( transaction. repo ( ) , & mut v, old) ?;
280281 }
281282
283+ if push_mode == PushMode :: Review {
284+ v. push ( ( ref_with_options, oid_to_push, "JOSH_PUSH" . to_string ( ) ) ) ;
285+ }
286+
282287 v. push ( (
283288 format ! (
284289 "refs/heads/@heads/{}/{}" ,
@@ -820,20 +825,20 @@ fn changes_to_refs(
820825 } ;
821826
822827 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 '@'" ) ) ;
826831 }
827- if seen. contains ( & label ) {
832+ if seen. contains ( & id ) {
828833 return Err ( josh:: josh_error ( & format ! (
829834 "rejecting to push {:?} with duplicate label" ,
830835 change. commit
831836 ) ) ) ;
832837 }
833- seen. push ( label ) ;
838+ seen. push ( id ) ;
834839 } else {
835840 return Err ( josh:: josh_error ( & format ! (
836- "rejecting to push {:?} without label " ,
841+ "rejecting to push {:?} without id " ,
837842 change. commit
838843 ) ) ) ;
839844 }
@@ -847,11 +852,11 @@ fn changes_to_refs(
847852 "refs/heads/@changes/{}/{}/{}" ,
848853 baseref. replacen( "refs/heads/" , "" , 1 ) ,
849854 change. author,
850- change. label . as_ref( ) . unwrap_or( & "" . to_string( ) ) ,
855+ change. id . as_ref( ) . unwrap_or( & "" . to_string( ) ) ,
851856 ) ,
852857 change. commit ,
853858 change
854- . label
859+ . id
855860 . as_ref ( )
856861 . unwrap_or ( & "JOSH_PUSH" . to_string ( ) )
857862 . to_string ( ) ,
0 commit comments