In Git, I can get the root directory from any subdirectory like this:
git rev-parse --show-toplevel
From here: Is there a way to get the git root directory in one command?
Unfortunately this same command does not work in a repo cloned with Sapling, it just returns the current directory.
Could someone tell me how to do this with Sapling, ideally with a similarly simple one-liner?
In Sapling, it is simply sl root
.
Note that Sapling has in-product help for finding the analogue to a Git command via sl git
. In this case, sl git -- rev-parse --show-toplevel
returns sl root
, as desired.