Sapling高扩展性版本控制系统
Sapling 是一个跨平台、高扩展性并兼容 Git 的版本管理系统,旨在提供用户友好且强大的用户界面的同时,具备极佳的扩展性,以应对包含百万级别文件和提交的仓库使用场景。
Sapling SCM 由三个主要组成部分组成:
- Sapling 客户端:客户端
sl
命令行和 Web 界面,供用户与 Sapling SCM 交互。 - Mononoke:高度可扩展的分布式源代码控制服务器。(尚未公开支持。)
- EdenFS:一个用于高效检出大型存储库的虚拟文件系统。(尚未公开支持。)
Sapling SCM 的可扩展性目标是确保所有源代码控制操作都随着开发人员使用的文件数量而不是存储库本身的大小而扩展,即使在拥有数百万个文件和极长提交历史记录的大型存储库中也能获得快速、高效的体验。
使用示例:
# 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
~
评论