def update_remote_branches(self,*rest): """Update the remote branch name when a branch is selected""" widget = self.remote_branches branches = self.filtered_remote_branches selection = qtutils.selected_item(widget, branches) if not selection: return branch = utils.strip_one(selection) if branch == 'HEAD': return self.set_remote_branch(branch)
def update_remote_branches(self, *rest): """Update the remote branch name when a branch is selected""" widget = self.remote_branches branches = self.filtered_remote_branches selection = qtutils.selected_item(widget, branches) if not selection: return branch = utils.strip_one(selection) if branch == 'HEAD': return self.set_remote_branch(branch)
def test_strip_one_basename(self): expect = 'git' actual = utils.strip_one('git') self.assertEqual(expect, actual)
def test_strip_one_nested_relpath(self): expect = 'bin/git' actual = utils.strip_one('local/bin/git') self.assertEqual(expect, actual)
def test_strip_one_abspath(self): expect = 'bin/git' actual = utils.strip_one('/usr/bin/git') self.assertEqual(expect, actual)
def test_strip_one_basename(): expect = 'git' actual = utils.strip_one('git') assert expect == actual
def test_strip_one_nested_relpath(): expect = 'bin/git' actual = utils.strip_one('local/bin/git') assert expect == actual
def test_strip_one_relpath(): expect = 'git' actual = utils.strip_one('bin/git') assert expect == actual
def test_strip_one_abspath(): expect = 'bin/git' actual = utils.strip_one('/usr/bin/git') assert expect == actual