@@ -747,6 +747,11 @@ mod render {
747747 /// The options to use when resolving the revset.
748748 pub resolve_revset_options : ResolveRevsetOptions ,
749749
750+ /// Deprecated
751+ /// Reverse the ordering of items in the smartlog output, list the most
752+ /// recent commits first.
753+ pub reverse : bool ,
754+
750755 /// Normally HEAD and the main branch are included. Set this to exclude them.
751756 pub exact : bool ,
752757 }
@@ -763,6 +768,7 @@ pub fn smartlog(
763768 event_id,
764769 revset,
765770 resolve_revset_options,
771+ reverse,
766772 exact,
767773 } = options;
768774
@@ -820,9 +826,22 @@ pub fn smartlog(
820826 exact,
821827 ) ?;
822828
823- let reverse = get_smartlog_reverse ( & repo) ?;
829+ if reverse {
830+ print ! (
831+ "\
832+ branchless: WARNING: The `--reverse` flag is deprecated.
833+ branchless: Please use the `branchless.smartlog.reverse` configuration option.
834+ "
835+ ) ;
836+ }
837+ let reverse_cfg = get_smartlog_reverse ( & repo) ?;
838+ let reverse_value = match ( reverse_cfg, reverse) {
839+ ( .., true ) => true ,
840+ _ => reverse_cfg,
841+ } ;
842+
824843 let mut lines = render_graph (
825- & effects. reverse_order ( reverse ) ,
844+ & effects. reverse_order ( reverse_value ) ,
826845 & repo,
827846 & dag,
828847 & graph,
@@ -845,7 +864,7 @@ pub fn smartlog(
845864 ] ,
846865 ) ?
847866 . into_iter ( ) ;
848- while let Some ( line) = if reverse {
867+ while let Some ( line) = if reverse_value {
849868 lines. next_back ( )
850869 } else {
851870 lines. next ( )
@@ -910,6 +929,7 @@ pub fn command_main(ctx: CommandContext, args: SmartlogArgs) -> EyreExitOr<()> {
910929 event_id,
911930 revset,
912931 resolve_revset_options,
932+ reverse,
913933 exact,
914934 } = args;
915935
@@ -920,6 +940,7 @@ pub fn command_main(ctx: CommandContext, args: SmartlogArgs) -> EyreExitOr<()> {
920940 event_id,
921941 revset,
922942 resolve_revset_options,
943+ reverse,
923944 exact,
924945 } ,
925946 )
0 commit comments