787 base = opts.get('base') |
787 base = opts.get('base') |
788 if base: |
788 if base: |
789 if dest: |
789 if dest: |
790 raise util.Abort(_("--base is incompatible with specifiying " |
790 raise util.Abort(_("--base is incompatible with specifiying " |
791 "a destination")) |
791 "a destination")) |
|
792 base = [repo.lookup(rev) for rev in base] |
|
793 # create the right base |
|
794 # XXX: nodesbetween / changegroup* should be "fixed" instead |
792 o = [] |
795 o = [] |
|
796 has_set = sets.Set(base) |
793 for n in base: |
797 for n in base: |
794 o.extend(repo.changelog.children(repo.lookup(n))) |
798 has_set.update(repo.changelog.reachable(n)) |
795 # add common ancestor |
|
796 if revs: |
799 if revs: |
797 all = o + revs |
800 visit = list(revs) |
798 else: |
801 else: |
799 all = o + repo.changelog.heads() |
802 visit = repo.changelog.heads() |
800 ancestor = reduce(lambda a, b: repo.changelog.ancestor(a, b), all) |
803 while visit: |
801 o.append(ancestor) |
804 n = visit.pop(0) |
|
805 parents = [p for p in repo.changelog.parents(n) |
|
806 if p != nullid and p not in has_set] |
|
807 if len(parents) == 0: |
|
808 o.insert(0, n) |
|
809 else: |
|
810 visit.extend(parents) |
802 else: |
811 else: |
803 setremoteconfig(ui, opts) |
812 setremoteconfig(ui, opts) |
804 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
813 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
805 other = hg.repository(ui, dest) |
814 other = hg.repository(ui, dest) |
806 o = repo.findoutgoing(other, force=opts['force']) |
815 o = repo.findoutgoing(other, force=opts['force']) |