MCPcopy
hub / github.com/gitless-vcs/gitless / _do_list

Function _do_list

gitless/cli/gl_branch.py:91–114  ·  view source on GitHub ↗
(repo, list_remote, v=False)

Source from the content-addressed store, hash-verified

89
90
91def _do_list(repo, list_remote, v=False):
92 pprint.msg('List of branches:')
93 pprint.exp('do gl branch -c b to create branch b')
94 pprint.exp('do gl branch -d b to delete branch b')
95 pprint.exp('do gl switch b to switch to branch b')
96 pprint.exp('* = current branch')
97 pprint.blank()
98
99
100 for b in (repo.lookup_branch(n) for n in sorted(repo.listall_branches())):
101 current_str = '*' if b.is_current else ' '
102 upstream_str = '(upstream is {0})'.format(b.upstream) if b.upstream else ''
103 color = colored.green if b.is_current else colored.yellow
104 pprint.item(
105 '{0} {1} {2}'.format(current_str, color(b.branch_name), upstream_str))
106 if v:
107 pprint.item(' ➜ head is {0}'.format(pprint.commit_str(b.head)))
108
109 if list_remote:
110 for r in sorted(repo.remotes, key=lambda r: r.name):
111 for b in (r.lookup_branch(n) for n in sorted(r.listall_branches())):
112 pprint.item(' {0}'.format(colored.yellow(str(b))))
113 if v:
114 pprint.item(' ➜ head is {0}'.format(pprint.commit_str(b.head)))
115
116
117def _do_create(create_b, dp, repo):

Callers 1

mainFunction · 0.70

Calls 2

lookup_branchMethod · 0.45
listall_branchesMethod · 0.45

Tested by

no test coverage detected