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

Function _do_delete

gitless/cli/gl_branch.py:151–178  ·  view source on GitHub ↗
(delete_b, repo)

Source from the content-addressed store, hash-verified

149
150
151def _do_delete(delete_b, repo):
152 errors_found = False
153
154 for b_name in delete_b:
155 try:
156 b = helpers.get_branch(b_name, repo)
157
158 branch_str = 'Branch {0} will be removed'.format(b.branch_name)
159 remote_str = ''
160 if isinstance(b, core.RemoteBranch):
161 remote_str = ' from remote repository {0}'.format(b.remote_name)
162 if not pprint.conf_dialog('{0}{1}'.format(branch_str, remote_str)):
163 pprint.msg('Aborted: removal of branch {0}'.format(b))
164 continue
165
166 b.delete()
167 pprint.ok('Branch {0} removed successfully'.format(b))
168 except ValueError as e:
169 pprint.err(e)
170 errors_found = True
171 except core.BranchIsCurrentError as e:
172 pprint.err(e)
173 pprint.err_exp(
174 'do gl branch b to create or switch to another branch b and then '
175 'gl branch -d {0} to remove branch {0}'.format(b))
176 errors_found = True
177
178 return not errors_found
179
180
181def _do_set_upstream(upstream, repo):

Callers 1

mainFunction · 0.70

Calls 1

deleteMethod · 0.45

Tested by

no test coverage detected