comparison tests/test-graft.t @ 42582:5171937ad0f9

abort: added support for graft This adds support of `graft` to `hg abort` plan. The patch creates a seperate function `cmdutil.hgabortgraft` so that abort logic for graft can be called independently. This logic is registered to the statedetection API as `abortfunc`. Results are shown as tests. Differential Revision: https://phab.mercurial-scm.org/D6567
author Taapas Agrawal <taapas2897@gmail.com>
date Sun, 23 Jun 2019 22:31:31 +0530
parents 12243f15d53e
children 2e672ccc2220
comparison
equal deleted inserted replaced
42581:bb135a784b70 42582:5171937ad0f9
1 #testcases abortcommand abortflag
2
1 $ cat >> $HGRCPATH <<EOF 3 $ cat >> $HGRCPATH <<EOF
2 > [extdiff] 4 > [extdiff]
3 > # for portability: 5 > # for portability:
4 > pdiff = sh "$RUNTESTDIR/pdiff" 6 > pdiff = sh "$RUNTESTDIR/pdiff"
5 > EOF 7 > EOF
8
9 #if abortflag
10 $ cat >> $HGRCPATH <<EOF
11 > [alias]
12 > abort = graft --abort
13 > EOF
14 #endif
6 15
7 Create a repo with some stuff in it: 16 Create a repo with some stuff in it:
8 17
9 $ hg init a 18 $ hg init a
10 $ cd a 19 $ cd a
1984 o 0:9092f1db7931 added a 1993 o 0:9092f1db7931 added a
1985 1994
1986 $ hg up 9150fe93bec6 1995 $ hg up 9150fe93bec6
1987 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 1996 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1988 1997
1989 $ hg graft --abort 1998 $ hg abort
1990 abort: no interrupted graft to abort 1999 abort: no interrupted graft to abort (abortflag !)
2000 abort: no operation in progress (abortcommand !)
1991 [255] 2001 [255]
1992 2002
1993 when stripping is required 2003 when stripping is required
1994 $ hg graft -r 4 -r 5 2004 $ hg graft -r 4 -r 5
1995 grafting 4:863a25e1a9ea "added x" 2005 grafting 4:863a25e1a9ea "added x"
2014 2024
2015 $ hg graft --abort --edit 2025 $ hg graft --abort --edit
2016 abort: cannot specify any other flag with '--abort' 2026 abort: cannot specify any other flag with '--abort'
2017 [255] 2027 [255]
2018 2028
2019 $ hg graft --abort 2029 #if abortcommand
2030 when in dry-run mode
2031 $ hg abort --dry-run
2032 graft in progress, will be aborted
2033 #endif
2034
2035 $ hg abort
2020 graft aborted 2036 graft aborted
2021 working directory is now at 9150fe93bec6 2037 working directory is now at 9150fe93bec6
2022 $ hg log -GT "{rev}:{node|short} {desc}" 2038 $ hg log -GT "{rev}:{node|short} {desc}"
2023 o 5:36b793615f78 added foo to c 2039 o 5:36b793615f78 added foo to c
2024 | 2040 |
2039 warning: conflicts while merging c! (edit, then use 'hg resolve --mark') 2055 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2040 abort: unresolved conflicts, can't continue 2056 abort: unresolved conflicts, can't continue
2041 (use 'hg resolve' and 'hg graft --continue') 2057 (use 'hg resolve' and 'hg graft --continue')
2042 [255] 2058 [255]
2043 2059
2044 $ hg graft --abort 2060 $ hg abort
2045 graft aborted 2061 graft aborted
2046 working directory is now at 9150fe93bec6 2062 working directory is now at 9150fe93bec6
2047 $ hg log -GT "{rev}:{node|short} {desc}" 2063 $ hg log -GT "{rev}:{node|short} {desc}"
2048 o 5:36b793615f78 added foo to c 2064 o 5:36b793615f78 added foo to c
2049 | 2065 |
2083 | 2099 |
2084 o 0:9092f1db7931 added a 2100 o 0:9092f1db7931 added a
2085 2101
2086 $ hg phase -r 6 --public 2102 $ hg phase -r 6 --public
2087 2103
2088 $ hg graft --abort 2104 $ hg abort
2089 cannot clean up public changesets 6ec71c037d94 2105 cannot clean up public changesets 6ec71c037d94
2090 graft aborted 2106 graft aborted
2091 working directory is now at 6ec71c037d94 2107 working directory is now at 6ec71c037d94
2092 2108
2093 when we created new changesets on top of existing one 2109 when we created new changesets on top of existing one
2160 adding file changes 2176 adding file changes
2161 added 1 changesets with 1 changes to 1 files (+1 heads) 2177 added 1 changesets with 1 changes to 1 files (+1 heads)
2162 new changesets 311dfc6cf3bf (1 drafts) 2178 new changesets 311dfc6cf3bf (1 drafts)
2163 (run 'hg heads .' to see heads, 'hg merge' to merge) 2179 (run 'hg heads .' to see heads, 'hg merge' to merge)
2164 2180
2165 $ hg graft --abort 2181 $ hg abort
2166 new changesets detected on destination branch, can't strip 2182 new changesets detected on destination branch, can't strip
2167 graft aborted 2183 graft aborted
2168 working directory is now at 6b98ff0062dd 2184 working directory is now at 6b98ff0062dd
2169 2185
2170 $ cd .. 2186 $ cd ..