Sapling is a cross-platform, highly extensible and Git-compatible version management system designed to provide a user-friendly and powerful user interface while having excellent scalability to cope with warehouse usage scenarios containing millions of files and submissions .

Sapling SCM consists of three main components:

  • Sapling Client: ClientslCommand line and web interfaces for users to interact with Sapling SCM.
  • Mononoke: Highly scalable distributed source control server. (Not yet publicly supported.)
  • EdenFS: A virtual filesystem for efficient checkout of large repositories. (Not yet publicly supported.)

Sapling SCM’s scalability goal is to ensure that all source control operations scale with the number of files used by developers rather than the size of the repository itself, even on large repositories with millions of files and extremely long commit histories You can also get a fast and efficient experience in the library.

Example usage:


# Clones the repository into the sapling directory.
# For git support, it uses git under the hood for clone/push/pull.
$ sl clone --git https://github.com/facebookexperimental/sapling
remote: Enumerating objects: 639488, done.
...
$ cd sapling

# 'sl' with no arguments prints the smartlog.
# It shows the commit you are on (@) and all of your local commits
# (none in this example since we just cloned). For each local commit it shows
# the short hash, the commit date, who made it, any remote bookmarks,
# and the commit title. With some configuration it can also show
# information from inside the commit message, like task numbers or
# pull request numbers.
$ sl
@  c448e50fe  Today at 11:06  aaron  remote/main
│  Use cached values
~

# Checkout a commit in main that I want to debug.
# The dashed line in smartlog indicates we're not showing some commits
# between main and my checked out commit.
$ sl checkout a555d064c
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷
@  a555d064c  Today at 09:06  jordan
│  workingcopy: Give Rust status exclusive ownership of TreeState
~

$ vim broken_file.rs
$ vim new_file.txt

# 'sl status' shows which files have pending changes. 'sl st' also works.
# 'M' indicates the file is modified. '?' indicates it is present but not tracked.
$ sl status
M broken_file.rs
? new_file.txt

# 'sl add' marks the untracked file as new and tracked.
# It will now show up as 'A' in status.
$ sl add new_file.txt

$ sl commit -m "Fix bug"
$ vim broken_file.rs
$ sl commit -m "Add test"
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ @  13811857c  1 second ago  mary
╷ │  Add test
╷ │
╷ o  95e6c6b86  10 seconds ago  mary
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# Go to the previous commit.
$ hg prev
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ o  13811857c  21 seconds ago  mary
╷ │  Add test
╷ │
╷ @  95e6c6b86  30 seconds ago  mary
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# Amend the first commit
$ vim build.sh
$ sl amend
95e6c6b863b7 -> 35740664b28a "Fix bug"
automatically restacking children!
rebasing 13811857cc1e "Add test"
13811857cc1e -> d9368dec77e1 "Add test"

# Note how the stack remained together, despite editing the first commit.
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ o  d9368dec7  81 seconds ago  mary
╷ │  Add test
╷ │
╷ @  35740664b  17 seconds ago  mary
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# You can optionally create a local bookmark if you want.
$ sl bookmark my_task
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ o  d9368dec7  107 seconds ago  mary
╷ │  Add test
╷ │
╷ @  35740664b  43 seconds ago  mary  my_task*
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# Abandon the second commit.
$ sl hide -r d9368dec7
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ @  35740664b  68 seconds ago  mary  my_task*
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# Let's bring back the original version of the first commit.
# Note how smartlog marks the original commit as obsolete ('x')
# and explains how 95e6c6b86 was amended to become 35740664b.
$ sl unhide -r 95e6c6b86
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ @  35740664b  110 seconds ago  mary  my_task*
╭─╯  Fix bug
│
│ x  95e6c6b86 [Amended as 35740664b28a]  3 minutes ago  mary
├─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~

# Rollback the amend we did earlier.
$ sl unamend
$ sl
o  c448e50fe  Today at 11:06  remote/main
╷
╷ @  95e6c6b86  4 minutes ago  mary  my_task*
╭─╯  Fix bug
│
o  a555d064c  Today at 09:06
│
~
$ sl status
M build.sh
$ sl revert --all

# Push the commit to the remote main branch.
# Note, when pushing to Git you would have to rebase onto main
# first via 'sl rebase --dest main'. When pushing to a Sapling server,
# the server would perform the rebase for you, as shown here.
$ sl push --to main
$ sl
@  e97a27666  1 minute ago  mary  remote/main
│  Fix bug
~

#Sapling #Homepage #Documentation #Downloads #Highly #Scalable #Version #Control #System #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *