Skip to content

Commit

Permalink
feat(scm): Add revset aliases for next and prev (#448)
Browse files Browse the repository at this point in the history
Summary:
feat(scm): Add revset aliases for `next` and `prev`

 In the same way you can `sl go top`, it seems logical to also have
`sl go next`. However, instead it is `sl next`.  While I normally remember to
do `sl prev`, I sometimes accidentally do `sl go prev` out of habbit and get an
error.  Instead, let's simply add two revset aliases for `next` and `prev` to
make sl more intuitive.

The revset functions were added by D43383303.
This change adds convenient aliases so one can use `next`, `prev` without typing `()`:

  next
  prev
  previous

Number of steps can still be specified using the function form:

  next(2)
  prev(3)
  previous(4)

Closes #444

Pull Request resolved: #448

Test Plan:
Automated tested blocked on #447

Manually tested by running `sl go next` and `sl go prev` and verifying I ended
up in the right spot.

Reviewed By: muirdm

Differential Revision: D43329058

Pulled By: quark-zju

fbshipit-source-id: 6fa5c6e6e41971f8f15b784586176b089c5f0027
  • Loading branch information
vegerot authored and facebook-github-bot committed Feb 17, 2023
1 parent 78c687b commit 9192b33
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions eden/scm/lib/config/loader/src/builtin_static/sapling.rs
Expand Up @@ -426,8 +426,11 @@ style=sl_default
[revsetalias]
sb(n)=first(sort(bookmark(), -rev), n)
sba=sort(bookmark(), -rev)
top=heads(. ::)
bottom=first(draft() & ::.)
top=top()
bottom=bottom()
next=next()
prev=previous
previous=previous()
base=last(public() & ::.)
obsrelated(x)=mutrelated(x)
focusedsmartlog(x)=focusedbranch(x) + draftbranch(x)^ + present(master)
Expand Down
15 changes: 15 additions & 0 deletions eden/scm/tests/test-movement-revset.t
Expand Up @@ -38,6 +38,21 @@ Linear stack:
$ sl log -r 'bottom()'
E
With revset aliases:
$ sl config -q --local 'revsetalias.prev=previous' 'revsetalias.previous=previous()'
$ sl log -r prev
F
$ sl log -r 'prev(2)'
E
$ sl log -r 'previous'
F
$ sl log -r 'previous()'
F
$ sl log -r 'previous(2)'
E
Multiple choices:
$ newclientrepo
Expand Down

0 comments on commit 9192b33

Please sign in to comment.