[meld] Add helper to identify unpushed commits to Git backend
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Add helper to identify unpushed commits to Git backend
- Date: Wed, 8 May 2013 19:44:17 +0000 (UTC)
commit fc72184b1f5c3fee463657bc374fecf0d9cf7d4f
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu May 9 05:39:30 2013 +1000
Add helper to identify unpushed commits to Git backend
meld/vc/git.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index a145934..743e226 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -97,6 +97,25 @@ class Vc(_vc.CachedVc):
# Prototyping VC interface version 2
+ def get_commits_to_push(self):
+ proc = _vc.popen([self.CMD, "for-each-ref",
+ "--format=%(refname:short) %(upstream:short)",
+ "refs/heads"], cwd=self.location)
+ branch_remotes = proc.read().split("\n")[:-1]
+
+ branch_revisions = {}
+ for line in branch_remotes:
+ try:
+ branch, remote = line.split()
+ except ValueError:
+ continue
+
+ proc = _vc.popen([self.CMD, "rev-list", branch, "^" + remote],
+ cwd=self.location)
+ revisions = proc.read().split("\n")[:-1]
+ branch_revisions[branch] = revisions
+ return branch_revisions
+
def get_files_to_commit(self, paths):
files = []
for p in paths:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]