Skip to content

Commit

Permalink
helptext: fix the help doc of directory branching
Browse files Browse the repository at this point in the history
Summary:
This diff updates the help doc of directory branching:
* Use "subtree copy" for creating directory branches.
* Use "subtree graft" for grafting changes between directory branches.

Reviewed By: muirdm

Differential Revision: D67088053

fbshipit-source-id: 1789c026f7f7e233895f2ac137f394fb28e0f854
  • Loading branch information
zzl0 authored and facebook-github-bot committed Dec 12, 2024
1 parent 23ae842 commit e9493c5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions eden/scm/sapling/helptext.py
Original file line number Diff line number Diff line change
Expand Up @@ -4654,26 +4654,28 @@
Branch Creation
===============
To create a branch, simply copy the directory::
To branch the directory "my-project" of commit A into the directory "my-branch", use ``subtree copy``::
$ @prog@ cp my-project my-branch
$ @prog@ commit -m "branch my-project"
$ @prog@ subtree cp -r A --from-path my-project --to-path my-branch
Grafting Between Branches (AKA Cherry Picking)
==============================================
Use the ``graft`` command to copy a commit from one branch to another::
Use ``subtree graft`` to copy a commit from one branch to another::
$ touch my-project/file
$ @prog@ commit -m "add file"
$ @prog@ graft -r . --from-path my-project --to-path my-branch
$ @prog@ commit -Am "add file"
$ @prog@ subtree graft -r . --from-path my-project --to-path my-branch
Files in the grafted commit(s) outside of ``--from-path`` are ignored,
and files in the destination commit outside of ``--to-path`` are
ignored.
If you’ve already created a directory branch using the ``@prog@ cp`` or ``cp`` commands,
you can still use ``subtree graft`` to move changes between directories.
Comparing Branches
==================
Expand All @@ -4693,15 +4695,13 @@
Directory branching aware operations support multiple ``--from-path``/``--to-path`` mappings::
# Create two directory branches:
$ @prog@ cp my-project my-branch1
$ @prog@ cp my-project my-branch2
$ @prog@ commit -m "add branches"
$ @prog@ subtree cp --from-path my-project --to-path my-branch1 --from-path my-project --to-path my-branch2
$ touch my-project/file
$ @prog@ commit -m "add file"
# Copy working parent commit "." onto both my-branch1 and my-branch2 directories:
$ @prog@ graft -r . --from-path my-project --to-path my-branch1 --from-path my-project --to-path my-branch2
$ @prog@ subtree graft -r . --from-path my-project --to-path my-branch1 --from-path my-project --to-path my-branch2
# Modify "file" in both branches and then diff both branches against "my-project":
$ echo branch1 > my-branch1/file
Expand Down

0 comments on commit e9493c5

Please sign in to comment.