Mercurial > evolve
comparison hgext3rd/evolve/evolvecmd.py @ 4798:2e14a9386316
abort: added support for evolve to hg abort
This patch adds support of `hg evolve --abort` to `hg abort`
plan.
This involves creating a `hgabortevolve()` function under
`evolvecmd` which ensures abortion of evolve via `hg abort`.
This function is then registered using `addunfinished()` in
`__init__.py`.
Results are shown as tests.
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Thu, 11 Jul 2019 22:56:46 +0530 |
parents | 8c780c3eb116 |
children | 16c1398b0063 |
comparison
equal
deleted
inserted
replaced
4797:8c780c3eb116 | 4798:2e14a9386316 |
---|---|
1910 % nodemod.hex(startnode)[:12]) | 1910 % nodemod.hex(startnode)[:12]) |
1911 else: | 1911 else: |
1912 raise error.Abort(_("unable to abort interrupted evolve, use 'hg " | 1912 raise error.Abort(_("unable to abort interrupted evolve, use 'hg " |
1913 "evolve --stop' to stop evolve")) | 1913 "evolve --stop' to stop evolve")) |
1914 | 1914 |
1915 def hgabortevolve(ui, repo): | |
1916 """logic for aborting evolve using 'hg abort'""" | |
1917 with repo.wlock(), repo.lock(): | |
1918 evolvestate = state.cmdstate(repo) | |
1919 evolvestate.load() | |
1920 if evolvestate['command'] != 'evolve': | |
1921 pctx = repo['.'] | |
1922 hg.updaterepo(repo, pctx.node(), True) | |
1923 ui.status(_('evolve aborted\n')) | |
1924 ui.status(_('working directory is now at %s\n') | |
1925 % pctx.hex()[:12]) | |
1926 evolvestate.delete() | |
1927 return 0 | |
1928 return abortevolve(ui, repo, evolvestate) | |
1929 | |
1915 def continueevolve(ui, repo, evolvestate): | 1930 def continueevolve(ui, repo, evolvestate): |
1916 """logic for handling of `hg evolve --continue`""" | 1931 """logic for handling of `hg evolve --continue`""" |
1917 | 1932 |
1918 ms = merge.mergestate.read(repo) | 1933 ms = merge.mergestate.read(repo) |
1919 mergeutil.checkunresolved(ms) | 1934 mergeutil.checkunresolved(ms) |