equal
deleted
inserted
replaced
3077 # way to the graftstate. With --force, any revisions we would have otherwise |
3077 # way to the graftstate. With --force, any revisions we would have otherwise |
3078 # skipped would not have been filtered out, and if they hadn't been applied |
3078 # skipped would not have been filtered out, and if they hadn't been applied |
3079 # already, they'd have been in the graftstate. |
3079 # already, they'd have been in the graftstate. |
3080 if not (cont or opts.get(b'force')) and basectx is None: |
3080 if not (cont or opts.get(b'force')) and basectx is None: |
3081 # check for ancestors of dest branch |
3081 # check for ancestors of dest branch |
3082 crev = repo[b'.'].rev() |
3082 ancestors = repo.revs(b'%ld & (::.)', revs) |
3083 ancestors = repo.changelog.ancestors([crev], inclusive=True) |
3083 for rev in ancestors: |
3084 # XXX make this lazy in the future |
3084 ui.warn(_(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev])) |
3085 for rev in revs: |
3085 |
3086 if rev in ancestors: |
|
3087 ui.warn( |
|
3088 _(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev]) |
|
3089 ) |
|
3090 revs = [r for r in revs if r not in ancestors] |
3086 revs = [r for r in revs if r not in ancestors] |
3091 |
3087 |
3092 if not revs: |
3088 if not revs: |
3093 return -1 |
3089 return -1 |
3094 |
3090 |
3103 # check ancestors for earlier grafts |
3099 # check ancestors for earlier grafts |
3104 ui.debug(b'scanning for duplicate grafts\n') |
3100 ui.debug(b'scanning for duplicate grafts\n') |
3105 |
3101 |
3106 # The only changesets we can be sure doesn't contain grafts of any |
3102 # The only changesets we can be sure doesn't contain grafts of any |
3107 # revs, are the ones that are common ancestors of *all* revs: |
3103 # revs, are the ones that are common ancestors of *all* revs: |
3108 for rev in repo.revs(b'only(%d,ancestor(%ld))', crev, revs): |
3104 for rev in repo.revs(b'only(%d,ancestor(%ld))', repo[b'.'].rev(), revs): |
3109 ctx = repo[rev] |
3105 ctx = repo[rev] |
3110 n = ctx.extra().get(b'source') |
3106 n = ctx.extra().get(b'source') |
3111 if n in ids: |
3107 if n in ids: |
3112 try: |
3108 try: |
3113 r = repo[n].rev() |
3109 r = repo[n].rev() |