Created
November 16, 2017 10:05
-
-
Save gerasiov/bfc52b593e4ab36b1e7247c678ba2c43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import subprocess | |
parents = filter(lambda p: p!='-p', sys.stdin.readline().split() ) | |
output = [] | |
for parent in parents: | |
result=subprocess.check_output(["git", "rev-list", parent] + map(lambda p: "^%s"%p, filter(lambda p: p != parent, parents))) | |
if result: | |
output.append(parent) | |
if len(output) == 0 and len(parents) != 0: | |
output.append(parents[0]) | |
print(" ".join(map(lambda p: "-p %s"%p, output))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment