Skip to content

Commit

Permalink
Adding "pull/push current branch" commands -properly this time
Browse files Browse the repository at this point in the history
  • Loading branch information
Can Yilmaz committed Feb 10, 2012
1 parent f2bea18 commit 3ddedf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Default.sublime-commands
Expand Up @@ -83,10 +83,18 @@
"caption": "Git: Pull",
"command": "git_pull"
}
,{
"caption": "Git: Pull Current Branch",
"command": "git_pull_current_branch"
}
,{
"caption": "Git: Push",
"command": "git_push"
}
,{
"caption": "Git: Push Current Branch",
"command": "git_push_current_branch"
}
,{
"caption": "Git: Show Current File",
"command": "git_show"
Expand Down
18 changes: 18 additions & 0 deletions git.py
Expand Up @@ -721,11 +721,29 @@ def run(self):
self.run_command(['git', 'pull'], callback=self.panel)


class GitPullCurrentBranchCommand(GitWindowCommand):
def run(self):
self.run_command(['git', 'describe', '--contains', '--all', 'HEAD'], callback=self.pull_current_branch_done)

def pull_current_branch_done(self, result):
result = result.strip()
self.run_command(['git', 'pull', 'origin', result], callback=self.panel)


class GitPushCommand(GitWindowCommand):
def run(self):
self.run_command(['git', 'push'], callback=self.panel)


class GitPushCurrentBranchCommand(GitWindowCommand):
def run(self):
self.run_command(['git', 'describe', '--contains', '--all', 'HEAD'], callback=self.push_current_branch_done)

def push_current_branch_done(self, result):
result = result.strip()
self.run_command(['git', 'push', 'origin', result], callback=self.panel)


class GitCustomCommand(GitTextCommand):
may_change_files = True

Expand Down

0 comments on commit 3ddedf9

Please sign in to comment.