Mercurial > hg > config
comparison python/git_merge_master.py @ 640:3059ee249888
STUB: python/git_merge_master.py
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Tue, 04 Mar 2014 16:19:37 -0800 |
| parents | 3be3b16aeda0 |
| children |
comparison
equal
deleted
inserted
replaced
| 639:3be3b16aeda0 | 640:3059ee249888 |
|---|---|
| 29 if branch == 'master': | 29 if branch == 'master': |
| 30 raise AssertionError("Cannot be on the master branch") | 30 raise AssertionError("Cannot be on the master branch") |
| 31 merge_base = subprocess.check_output(['git', 'merge-base', 'HEAD', 'master']).strip() | 31 merge_base = subprocess.check_output(['git', 'merge-base', 'HEAD', 'master']).strip() |
| 32 return subprocess.check_output(['git', 'diff', merge_base]) | 32 return subprocess.check_output(['git', 'diff', merge_base]) |
| 33 | 33 |
| 34 def checkout(self, branch): | |
| 35 subprocess.check_output(['git', 'checkout', branch]) | |
| 36 | |
| 37 def pull(self, branch='master'): | |
| 38 current_branch = self.branch() | |
| 39 if current_branch != branch: | |
| 40 self.checkout(branch) | |
| 41 subprocess.check_output(['git', 'pull', 'origin', branch]) | |
| 42 if current_branch != branch: | |
| 43 self.checkout(current_branch) | |
| 44 | |
| 34 def merge(self): | 45 def merge(self): |
| 35 pass | 46 pass |
| 36 | 47 |
| 37 def main(args=sys.argv[1:]): | 48 def main(args=sys.argv[1:]): |
| 38 | 49 |
