Skip to content

Commit ea2626c

Browse files
update rit github create branch formula
Signed-off-by: GuillaumeFalourd <[email protected]>
1 parent 276e3c4 commit ea2626c

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed
101 KB
Loading
97.6 KB
Loading
-94.6 KB
Binary file not shown.

github/create/branch/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ rit github create branch
1515

1616
This formula allows the user to create a new branch remotely on a repository he can access, and to set it as default if needed.
1717

18+
If the repository only has one branch, it used as default to create the new one as reference.
19+
If the repositoy has more than one branch, the user will need to choose which one to use as reference to create the new one.
20+
1821
## Demo
1922

20-
<img class="special-img-class" src="/docs/img/rit-github-create-branch.png"/>
23+
### Sample 1
24+
25+
<img class="special-img-class" src="/docs/img/rit-github-create-branch-1.png"/>
26+
27+
### Sample 2
28+
29+
<img class="special-img-class" src="/docs/img/rit-github-create-branch-2.png"/>

github/create/branch/src/formula/formula.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def run(token, owner, repository, branch, default):
2828

2929
if len(shas.keys()) == 1:
3030
reference = [*shas][0]
31-
print(f"⚙️ There is only one branch available on the repository.")
32-
print(f"⚙️ Therefore, branch \033[36m{reference}\033[0m will be used as reference.")
31+
print(f"⚙️ There is only one branch available on the repository: \033[36m{reference}\033[0m")
3332

3433
# If more than one branch on the repo, ask which one to use as reference
3534
else:
@@ -42,7 +41,7 @@ def run(token, owner, repository, branch, default):
4241
answers = inquirer.prompt(questions)
4342
reference = answers["reference"]
4443

45-
print(f"⚙️ Creating new \033[36m{branch}\033[0m branch based on \033[36m{reference}\033[0m branch...")
44+
print(f"⚙️ Creating \033[36m{branch}\033[0m branch based on \033[36m{reference}\033[0m branch...")
4645

4746
data = {}
4847
data["ref"] = f"refs/heads/{branch}"
@@ -60,7 +59,7 @@ def run(token, owner, repository, branch, default):
6059
print(f"✅ Branch \033[36m{branch}\033[0m successfully created on {owner}'s \033[36m{repository}\033[0m repository")
6160

6261
if default == "yes":
63-
print("⚙️ Updating default branch...")
62+
print(f"⚙️ Updating repository default branch to \033[36m{branch}\033[0m...")
6463
input_flag_cmd = f"rit github update default-branch --rit_repo_owner={owner} --rit_git_repo={repository} --rit_repo_branch={branch}"
6564
os.system(f"{input_flag_cmd}")
6665

0 commit comments

Comments
 (0)