Mercurial > hg
comparison hgext/histedit.py @ 48053:6256c7525222
histedit: remove redundant checks for unfinished histedit state
Both text-based and curses-based histedit already check for unfinished
operations (not just unfinished histedit), so there's no need to check
specifically for unfinished histedit.
Differential Revision: https://phab.mercurial-scm.org/D11508
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 28 Sep 2021 09:25:05 -0700 |
parents | 7a430116f639 |
children | f27a83399abb |
comparison
equal
deleted
inserted
replaced
48052:d07d38ef6362 | 48053:6256c7525222 |
---|---|
1695 keep = opts.get(b'keep') | 1695 keep = opts.get(b'keep') |
1696 revs = opts.get(b'rev', [])[:] | 1696 revs = opts.get(b'rev', [])[:] |
1697 cmdutil.checkunfinished(repo) | 1697 cmdutil.checkunfinished(repo) |
1698 cmdutil.bailifchanged(repo) | 1698 cmdutil.bailifchanged(repo) |
1699 | 1699 |
1700 if os.path.exists(os.path.join(repo.path, b'histedit-state')): | |
1701 raise error.Abort( | |
1702 _( | |
1703 b'history edit already in progress, try ' | |
1704 b'--continue or --abort' | |
1705 ) | |
1706 ) | |
1707 revs.extend(freeargs) | 1700 revs.extend(freeargs) |
1708 if not revs: | 1701 if not revs: |
1709 defaultrev = destutil.desthistedit(ui, repo) | 1702 defaultrev = destutil.desthistedit(ui, repo) |
1710 if defaultrev is not None: | 1703 if defaultrev is not None: |
1711 revs.append(defaultrev) | 1704 revs.append(defaultrev) |
1926 else: | 1919 else: |
1927 with open(path, b'rb') as f: | 1920 with open(path, b'rb') as f: |
1928 return f.read() | 1921 return f.read() |
1929 | 1922 |
1930 | 1923 |
1931 def _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs): | 1924 def _validateargs(ui, repo, freeargs, opts, goal, rules, revs): |
1932 # TODO only abort if we try to histedit mq patches, not just | 1925 # TODO only abort if we try to histedit mq patches, not just |
1933 # blanket if mq patches are applied somewhere | 1926 # blanket if mq patches are applied somewhere |
1934 mq = getattr(repo, 'mq', None) | 1927 mq = getattr(repo, 'mq', None) |
1935 if mq and mq.applied: | 1928 if mq and mq.applied: |
1936 raise error.Abort(_(b'source has mq patches applied')) | 1929 raise error.Abort(_(b'source has mq patches applied')) |
1952 if any((outg, revs, freeargs)): | 1945 if any((outg, revs, freeargs)): |
1953 raise error.Abort( | 1946 raise error.Abort( |
1954 _(b'only --commands argument allowed with --edit-plan') | 1947 _(b'only --commands argument allowed with --edit-plan') |
1955 ) | 1948 ) |
1956 else: | 1949 else: |
1957 if state.inprogress(): | |
1958 raise error.Abort( | |
1959 _( | |
1960 b'history edit already in progress, try ' | |
1961 b'--continue or --abort' | |
1962 ) | |
1963 ) | |
1964 if outg: | 1950 if outg: |
1965 if revs: | 1951 if revs: |
1966 raise error.Abort(_(b'no revisions allowed with --outgoing')) | 1952 raise error.Abort(_(b'no revisions allowed with --outgoing')) |
1967 if len(freeargs) > 1: | 1953 if len(freeargs) > 1: |
1968 raise error.Abort( | 1954 raise error.Abort( |
1988 revs = opts.get(b'rev', []) | 1974 revs = opts.get(b'rev', []) |
1989 nobackup = not ui.configbool(b'rewrite', b'backup-bundle') | 1975 nobackup = not ui.configbool(b'rewrite', b'backup-bundle') |
1990 rules = opts.get(b'commands', b'') | 1976 rules = opts.get(b'commands', b'') |
1991 state.keep = opts.get(b'keep', False) | 1977 state.keep = opts.get(b'keep', False) |
1992 | 1978 |
1993 _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs) | 1979 _validateargs(ui, repo, freeargs, opts, goal, rules, revs) |
1994 | 1980 |
1995 hastags = False | 1981 hastags = False |
1996 if revs: | 1982 if revs: |
1997 revs = scmutil.revrange(repo, revs) | 1983 revs = scmutil.revrange(repo, revs) |
1998 ctxs = [repo[rev] for rev in revs] | 1984 ctxs = [repo[rev] for rev in revs] |