##// END OF EJS Templates
phabricator: warn if unable to amend, instead of aborting after posting...
phabricator: warn if unable to amend, instead of aborting after posting There was a divergence in behavior here between obsolete and strip based amending. I first noticed the abort when testing outside of the test harness, but then had trouble recreating it here after reverting the code changes. It turns out, strip based amend was successfully amending the public commit after it was posted! It looks like the protection is in the `commit --amend` command, not in the underlying code that it calls. I considered doing a preflight check and aborting. But the locks are only acquired at the end, if amending, and this is too large a section of code to be wrapped in a maybe-it's-held-or-not context manager for my tastes. Additionally, some people do post-push reviews, and amending is the default behavior, so they shouldn't see a misleading error message. The lack of a 'Differential Revision' entry in the commit message breaks a {phabreview} test, so it had to be partially conditionalized.

File last commit:

r37939:ea63a200 default
r41198:0101a35d default
Show More
test-directaccess.t
214 lines | 4.8 KiB | text/troff | Tads3Lexer
/ tests / test-directaccess.t
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 Tests for access level on hidden commits by various commands on based of their
type.
Setting the required config to start this
$ cat >> $HGRCPATH <<EOF
> [experimental]
> evolution=createmarkers, allowunstable
> directaccess=True
> directaccess.revnums=True
> [extensions]
> amend =
> EOF
$ hg init repo
$ cd repo
$ for ch in a b c; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; done
$ hg log -G -T '{rev}:{node} {desc}' --hidden
@ 2:28ad74487de9599d00d81085be739c61fc340652 Added c
|
o 1:29becc82797a4bc11ec8880b58eaecd2ab3e7760 Added b
|
o 0:18d04c59bb5d2d4090ad9a5b59bd6274adb63add Added a
$ echo "bar" >> c
$ hg amend
$ hg log -G -T '{rev}:{node} {desc}' --hidden
@ 3:2443a0e664694756d8b435d06b6ad84f941b6fc0 Added c
|
| x 2:28ad74487de9599d00d81085be739c61fc340652 Added c
|/
o 1:29becc82797a4bc11ec8880b58eaecd2ab3e7760 Added b
|
o 0:18d04c59bb5d2d4090ad9a5b59bd6274adb63add Added a
Testing read only commands on the hidden revision
Testing with rev number
$ hg exp 2 --config experimental.directaccess.revnums=False
Boris Feld
visibility: improve the message when accessing filtered obsolete rev...
r35589 abort: hidden revision '2' was rewritten as: 2443a0e66469!
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 (use --hidden to access hidden revisions)
[255]
$ hg exp 2
# HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID 28ad74487de9599d00d81085be739c61fc340652
# Parent 29becc82797a4bc11ec8880b58eaecd2ab3e7760
Added c
diff -r 29becc82797a -r 28ad74487de9 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+foo
$ hg log -r 2
changeset: 2:28ad74487de9
user: test
date: Thu Jan 01 00:00:00 1970 +0000
obsolete: rewritten using amend as 3:2443a0e66469
summary: Added c
$ hg identify -r 2
28ad74487de9
$ hg status --change 2
A c
$ hg status --change 2 --config experimental.directaccess.revnums=False
Boris Feld
visibility: improve the message when accessing filtered obsolete rev...
r35589 abort: hidden revision '2' was rewritten as: 2443a0e66469!
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 (use --hidden to access hidden revisions)
[255]
$ hg diff -c 2
diff -r 29becc82797a -r 28ad74487de9 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+foo
Testing with hash
`hg export`
$ hg exp 28ad74
# HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID 28ad74487de9599d00d81085be739c61fc340652
# Parent 29becc82797a4bc11ec8880b58eaecd2ab3e7760
Added c
diff -r 29becc82797a -r 28ad74487de9 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+foo
`hg log`
$ hg log -r 28ad74
changeset: 2:28ad74487de9
user: test
date: Thu Jan 01 00:00:00 1970 +0000
obsolete: rewritten using amend as 3:2443a0e66469
summary: Added c
`hg cat`
$ hg cat -r 28ad74 c
foo
`hg diff`
$ hg diff -c 28ad74
diff -r 29becc82797a -r 28ad74487de9 c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+foo
`hg files`
$ hg files -r 28ad74
a
b
c
`hg identify`
$ hg identify -r 28ad74
28ad74487de9
Pulkit Goyal
annotate: add support to specify hidden revs if directaccess config is set...
r35552 `hg annotate`
$ hg annotate -r 28ad74 a
0: foo
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 `hg status`
$ hg status --change 28ad74
A c
Pulkit Goyal
archive: add support to specify hidden revs if directaccess config is set...
r35553 `hg archive`
This should not throw error
$ hg archive -r 28ad74 foo
Pulkit Goyal
update: support updating to hidden cset if directaccess config is set...
r35536 `hg update`
$ hg up 28ad74
Martin von Zweigbergk
update: print warning about hidden changeset after update...
r37939 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to hidden changeset 28ad74487de9
Boris Feld
update: display the obsfate of hidden revision we update to...
r35729 (hidden revision '28ad74487de9' was rewritten as: 2443a0e66469)
Pulkit Goyal
update: support updating to hidden cset if directaccess config is set...
r35536
$ hg up 3
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Yuya Nishihara
update: fix crash on bare update when directaccess is enabled...
r35699 $ hg up
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Pulkit Goyal
revert: support reverting to hidden cset if directaccess config is set...
r35537 `hg revert`
$ hg revert -r 28ad74 --all
reverting c
$ hg diff
diff -r 2443a0e66469 c
--- a/c Thu Jan 01 00:00:00 1970 +0000
+++ b/c Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +1,1 @@
foo
-bar
Yuya Nishihara
directaccess: do not abort by 'ff...' hash...
r37112 Test special hash/rev
$ hg log -qr 'null:wdir() & 000000000000'
-1:000000000000
$ hg log -qr 'null:wdir() & ffffffffffff'
2147483647:ffffffffffff
$ hg log -qr 'null:wdir() & rev(-1)'
-1:000000000000
$ hg log -qr 'null:wdir() & rev(2147483647)'
2147483647:ffffffffffff
$ hg log -qr 'null:wdir() & 2147483647'
2147483647:ffffffffffff
Gregory Szorc
registrar: replace "cmdtype" with an intent-based mechanism (API)...
r37734 Commands with undefined intent should not work right now
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513
$ hg phase -r 28ad74
Boris Feld
visibility: improve the message when accessing filtered obsolete rev...
r35589 abort: hidden revision '28ad74' was rewritten as: 2443a0e66469!
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 (use --hidden to access hidden revisions)
[255]
$ hg phase -r 2
Boris Feld
visibility: improve the message when accessing filtered obsolete rev...
r35589 abort: hidden revision '2' was rewritten as: 2443a0e66469!
Pulkit Goyal
commands: use the new API to access hidden changesets in various commands...
r35513 (use --hidden to access hidden revisions)
[255]
Pulkit Goyal
bookmarks: add bookmarks to hidden revs if directaccess config is set...
r35629
Setting a bookmark will make that changeset unhidden, so this should come in end
$ hg bookmarks -r 28ad74 book
bookmarking hidden changeset 28ad74487de9
Boris Feld
bookmarks: display the obsfate of hidden revision we create a bookmark on...
r35730 (hidden revision '28ad74487de9' was rewritten as: 2443a0e66469)
Pulkit Goyal
bookmarks: add bookmarks to hidden revs if directaccess config is set...
r35629
$ hg bookmarks
book 2:28ad74487de9