108,110c108,111
< def list_revs(upstream, branch):
< """Get a generator that lists git revisions that exist in 'branch' but
< not in 'upstream'.
---
> def list_revs(branch, baseline=None):
> """Get a generator that lists git revisions that exist in 'branch'. If
> the optional parameter 'baseline' is specified, the generator
> excludes commits that exist on that branch.
116,117c117,120
< changes = subprocess.check_output(
< [ "git", "rev-list", "%s..%s" % (upstream, branch) ])
---
> if baseline is not None:
> query = "%s..%s" % (branch, baseline)
> else:
> query = str(branch)
118a122,123
> changes = subprocess.check_output([ "git", "rev-list", query ])
>
167a173,175
> parser.add_argument("--deep-search", action="store_true",
> help="Use a deep search to find incorrectly " \
> "rebased changes")
202a211,221
> if args.deep_search:
> print "Incorrectly rebased changes:"
> all_upstream_revs = list_revs(args.upstream)
> all_upstream_cids = dict([
> (c.change_id, c) for c in all_upstream_revs \
> if c.change_id is not None ])
> incorrect_outgoing = filter(
> lambda r: r.change_id in all_upstream_cids,
> outgoing)
> for rev in incorrect_outgoing:
> print rev
204a224,225
>
>