Mercurial > hg
comparison hgext/rebase.py @ 44452:9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Built with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens
and then blackened. pyupgrade comes from
https://github.com/asottile/pyupgrade with a patch to let me preserve
extraneous parens (which we use for marking strings that shouldn't be
translated), and lets us clean up a bunch of idioms that have cruftily
accumulated over the years.
# skip-blame no-op automated code cleanups
Differential Revision: https://phab.mercurial-scm.org/D8255
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 06 Mar 2020 13:27:41 -0500 |
parents | f0021fbedea9 |
children | dc25de8117e4 |
comparison
equal
deleted
inserted
replaced
44449:ff72bd52d56a | 44452:9d2b2df2c2ba |
---|---|
1934 | 1934 |
1935 # This check isn't strictly necessary, since mq detects commits over an | 1935 # This check isn't strictly necessary, since mq detects commits over an |
1936 # applied patch. But it prevents messing up the working directory when | 1936 # applied patch. But it prevents messing up the working directory when |
1937 # a partially completed rebase is blocked by mq. | 1937 # a partially completed rebase is blocked by mq. |
1938 if b'qtip' in repo.tags(): | 1938 if b'qtip' in repo.tags(): |
1939 mqapplied = set(repo[s.node].rev() for s in repo.mq.applied) | 1939 mqapplied = {repo[s.node].rev() for s in repo.mq.applied} |
1940 if set(destmap.values()) & mqapplied: | 1940 if set(destmap.values()) & mqapplied: |
1941 raise error.Abort(_(b'cannot rebase onto an applied mq patch')) | 1941 raise error.Abort(_(b'cannot rebase onto an applied mq patch')) |
1942 | 1942 |
1943 # Get "cycle" error early by exhausting the generator. | 1943 # Get "cycle" error early by exhausting the generator. |
1944 sortedsrc = list(sortsource(destmap)) # a list of sorted revs | 1944 sortedsrc = list(sortsource(destmap)) # a list of sorted revs |
2119 return ret | 2119 return ret |
2120 | 2120 |
2121 | 2121 |
2122 def _filterobsoleterevs(repo, revs): | 2122 def _filterobsoleterevs(repo, revs): |
2123 """returns a set of the obsolete revisions in revs""" | 2123 """returns a set of the obsolete revisions in revs""" |
2124 return set(r for r in revs if repo[r].obsolete()) | 2124 return {r for r in revs if repo[r].obsolete()} |
2125 | 2125 |
2126 | 2126 |
2127 def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap): | 2127 def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap): |
2128 """Return (obsoletenotrebased, obsoletewithoutsuccessorindestination). | 2128 """Return (obsoletenotrebased, obsoletewithoutsuccessorindestination). |
2129 | 2129 |