Skip to content

Instantly share code, notes, and snippets.

@gerasiov gerasiov/filter.py
Created Nov 16, 2017

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.