2018-10-27 04:52:14 +03:00
|
|
|
TODO: Make this test compatibile with obsstore enabled.
|
|
|
|
$ setconfig experimental.evolution=
|
2017-08-24 17:45:02 +03:00
|
|
|
$ . "$TESTDIR/histedit-helpers.sh"
|
|
|
|
|
2014-07-23 20:47:35 +04:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [extensions]
|
2018-10-11 16:55:19 +03:00
|
|
|
> amend=
|
2017-08-24 17:45:02 +03:00
|
|
|
> histedit=
|
2018-10-11 16:55:19 +03:00
|
|
|
> rebase=
|
|
|
|
> tweakdefaults=
|
2017-07-24 15:37:45 +03:00
|
|
|
> [experimental]
|
|
|
|
> updatecheck=noconflict
|
2014-07-23 20:47:35 +04:00
|
|
|
> EOF
|
2018-10-18 15:45:47 +03:00
|
|
|
$ setconfig ui.suggesthgprev=True
|
2014-07-23 20:47:35 +04:00
|
|
|
|
|
|
|
Setup repo
|
|
|
|
|
|
|
|
$ hg init repo
|
|
|
|
$ cd repo
|
|
|
|
$ touch a
|
2015-10-23 01:50:59 +03:00
|
|
|
$ hg commit -Aqm a
|
2014-07-23 20:47:35 +04:00
|
|
|
$ mkdir dir
|
|
|
|
$ touch dir/b
|
2015-10-23 01:50:59 +03:00
|
|
|
$ hg commit -Aqm b
|
2014-07-23 20:47:35 +04:00
|
|
|
$ hg up -q 0
|
|
|
|
$ echo x >> a
|
2015-10-23 01:50:59 +03:00
|
|
|
$ hg commit -Aqm a2
|
2014-07-23 20:47:35 +04:00
|
|
|
$ hg up -q 1
|
|
|
|
|
2015-03-02 21:54:07 +03:00
|
|
|
Updating to a specific date isn't blocked by our extensions'
|
|
|
|
|
|
|
|
$ hg bookmark temp
|
|
|
|
$ hg up -d "<today"
|
|
|
|
found revision 2 from Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
2015-07-23 01:58:02 +03:00
|
|
|
(leaving bookmark temp)
|
2015-03-02 21:54:07 +03:00
|
|
|
$ hg up temp
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(activating bookmark temp)
|
|
|
|
$ hg bookmark --delete temp
|
|
|
|
|
2014-07-23 20:47:35 +04:00
|
|
|
Log is -f by default
|
|
|
|
|
|
|
|
$ hg log -G -T '{rev} {desc}\n'
|
|
|
|
@ 1 b
|
|
|
|
|
|
|
|
|
o 0 a
|
|
|
|
|
|
|
|
$ hg log -G -T '{rev} {desc}\n' --all
|
|
|
|
o 2 a2
|
|
|
|
|
|
|
|
|
| @ 1 b
|
|
|
|
|/
|
|
|
|
o 0 a
|
|
|
|
|
2017-07-24 15:37:45 +03:00
|
|
|
Dirty update to different rev fails with --check
|
2014-12-04 02:45:53 +03:00
|
|
|
|
|
|
|
$ echo x >> a
|
|
|
|
$ hg st
|
|
|
|
M a
|
2017-07-24 15:37:45 +03:00
|
|
|
$ hg update ".^" --check
|
2014-12-04 02:45:53 +03:00
|
|
|
abort: uncommitted changes
|
|
|
|
[255]
|
2014-12-14 05:13:41 +03:00
|
|
|
|
2017-07-24 15:37:45 +03:00
|
|
|
Dirty update allowed to same rev, with no conflicts, and --clean
|
2014-12-14 05:13:41 +03:00
|
|
|
|
|
|
|
$ hg update .
|
2014-12-04 02:45:53 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-07-24 15:37:45 +03:00
|
|
|
$ hg update ".^"
|
2014-12-14 05:13:41 +03:00
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
2018-04-07 10:36:56 +03:00
|
|
|
hint[update-prev]: use 'hg prev' to move to the parent changeset
|
|
|
|
hint[hint-ack]: use 'hg hint --ack update-prev' to silence these hints
|
2014-12-14 05:13:41 +03:00
|
|
|
$ hg update --clean 1
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2014-12-04 02:45:53 +03:00
|
|
|
|
2014-07-23 20:47:35 +04:00
|
|
|
Log on dir's works
|
|
|
|
|
|
|
|
$ hg log -T '{rev} {desc}\n' dir
|
|
|
|
1 b
|
|
|
|
|
|
|
|
$ hg log -T '{rev} {desc}\n' -I 'dir/*'
|
|
|
|
1 b
|
|
|
|
|
|
|
|
Empty rebase fails
|
|
|
|
|
|
|
|
$ hg rebase
|
|
|
|
abort: you must specify a destination (-d) for the rebase
|
|
|
|
[255]
|
|
|
|
$ hg rebase -d 2
|
2014-12-14 05:13:41 +03:00
|
|
|
rebasing 1:7b4cb4e1674c "b"
|
2017-07-11 19:44:53 +03:00
|
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/7b4cb4e1674c-f22b5b1e-rebase.hg (glob)
|
2014-07-23 20:47:35 +04:00
|
|
|
|
2018-11-14 03:32:44 +03:00
|
|
|
Empty rebase returns exit code 0:
|
2015-10-20 00:05:38 +03:00
|
|
|
|
2015-10-22 18:04:15 +03:00
|
|
|
$ hg rebase -s tip -d "tip^1"
|
2015-10-20 00:05:38 +03:00
|
|
|
nothing to rebase
|
|
|
|
|
2014-07-23 20:47:35 +04:00
|
|
|
Rebase fast forwards bookmark
|
|
|
|
|
|
|
|
$ hg book -r 1 mybook
|
|
|
|
$ hg up -q mybook
|
|
|
|
$ hg log -G -T '{rev} {desc} {bookmarks}\n'
|
|
|
|
@ 1 a2 mybook
|
|
|
|
|
|
|
|
|
o 0 a
|
|
|
|
|
|
|
|
$ hg rebase -d 2
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ hg log -G -T '{rev} {desc} {bookmarks}\n'
|
|
|
|
@ 2 b mybook
|
|
|
|
|
|
|
|
|
o 1 a2
|
|
|
|
|
|
|
|
|
o 0 a
|
|
|
|
|
2014-09-19 04:22:14 +04:00
|
|
|
Rebase works with hyphens
|
|
|
|
|
|
|
|
$ hg book -r 1 hyphen-book
|
|
|
|
$ hg book -r 2 hyphen-dest
|
|
|
|
$ hg up -q hyphen-book
|
|
|
|
$ hg log --all -G -T '{rev} {desc} {bookmarks}\n'
|
|
|
|
o 2 b hyphen-dest mybook
|
|
|
|
|
|
|
|
|
@ 1 a2 hyphen-book
|
|
|
|
|
|
|
|
|
o 0 a
|
|
|
|
|
|
|
|
$ hg rebase -d hyphen-dest
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ hg log --all -G -T '{rev} {desc} {bookmarks}\n'
|
|
|
|
@ 2 b hyphen-book hyphen-dest mybook
|
|
|
|
|
|
|
|
|
o 1 a2
|
|
|
|
|
|
|
|
|
o 0 a
|
|
|
|
|
2014-09-25 02:11:10 +04:00
|
|
|
Grep options work
|
|
|
|
|
2014-09-26 00:50:36 +04:00
|
|
|
$ mkdir -p dir1/subdir1
|
|
|
|
$ echo str1f1 >> dir1/f1
|
|
|
|
$ echo str1-v >> dir1/-v
|
|
|
|
$ echo str1space >> 'dir1/file with space'
|
|
|
|
$ echo str1sub >> dir1/subdir1/subf1
|
|
|
|
$ hg add -q dir1
|
|
|
|
|
2014-09-25 02:11:10 +04:00
|
|
|
$ hg grep x
|
|
|
|
a:x
|
|
|
|
$ hg grep -i X
|
|
|
|
a:x
|
|
|
|
$ hg grep -l x
|
|
|
|
a
|
|
|
|
$ hg grep -n x
|
|
|
|
a:1:x
|
2016-10-25 18:09:23 +03:00
|
|
|
#if osx
|
|
|
|
$ hg grep -V ''
|
|
|
|
#else
|
2014-09-25 02:11:10 +04:00
|
|
|
$ hg grep -V ''
|
2014-09-26 00:50:36 +04:00
|
|
|
[123]
|
2016-10-25 18:09:23 +03:00
|
|
|
#endif
|
2014-09-26 00:50:36 +04:00
|
|
|
|
|
|
|
Make sure grep works in subdirectories and with strange filenames
|
|
|
|
$ cd dir1
|
|
|
|
$ hg grep str1
|
|
|
|
-v:str1-v
|
|
|
|
f1:str1f1
|
|
|
|
file with space:str1space
|
|
|
|
subdir1/subf1:str1sub
|
|
|
|
$ hg grep str1 'relre:f[0-9]+'
|
|
|
|
f1:str1f1
|
|
|
|
subdir1/subf1:str1sub
|
|
|
|
|
|
|
|
Basic vs extended regular expressions
|
2016-10-25 18:09:23 +03:00
|
|
|
#if osx
|
|
|
|
$ hg grep 'str([0-9])'
|
|
|
|
[1]
|
|
|
|
#else
|
2014-09-26 00:50:36 +04:00
|
|
|
$ hg grep 'str([0-9])'
|
|
|
|
[123]
|
2016-10-25 18:09:23 +03:00
|
|
|
#endif
|
2014-09-26 00:50:36 +04:00
|
|
|
$ hg grep 'str\([0-9]\)'
|
|
|
|
-v:str1-v
|
|
|
|
f1:str1f1
|
|
|
|
file with space:str1space
|
|
|
|
subdir1/subf1:str1sub
|
2016-10-25 18:09:23 +03:00
|
|
|
#if osx
|
|
|
|
$ hg grep -F 'str[0-9]'
|
|
|
|
[1]
|
|
|
|
#else
|
2014-09-26 00:50:36 +04:00
|
|
|
$ hg grep -F 'str[0-9]'
|
|
|
|
[123]
|
2016-10-25 18:09:23 +03:00
|
|
|
#endif
|
2014-09-26 00:50:36 +04:00
|
|
|
$ hg grep -E 'str([0-9])'
|
|
|
|
-v:str1-v
|
|
|
|
f1:str1f1
|
|
|
|
file with space:str1space
|
|
|
|
subdir1/subf1:str1sub
|
|
|
|
|
|
|
|
Filesets
|
|
|
|
$ hg grep str1 'set:added()'
|
|
|
|
-v:str1-v
|
|
|
|
f1:str1f1
|
|
|
|
file with space:str1space
|
|
|
|
subdir1/subf1:str1sub
|
|
|
|
|
|
|
|
Crazy filenames
|
|
|
|
$ hg grep str1 -- -v
|
|
|
|
-v:str1-v
|
[tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../". This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.
This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns. Now you explicitly have to say
"glob:<pattern>" to get glob matching. However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.
Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.
Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3376605
Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-22 06:44:06 +03:00
|
|
|
$ hg grep str1 'glob:*v'
|
2014-09-26 00:50:36 +04:00
|
|
|
-v:str1-v
|
|
|
|
$ hg grep str1 'file with space'
|
|
|
|
file with space:str1space
|
[tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../". This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.
This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns. Now you explicitly have to say
"glob:<pattern>" to get glob matching. However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.
Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.
Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3376605
Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-22 06:44:06 +03:00
|
|
|
$ hg grep str1 'glob:*with*'
|
2014-09-26 00:50:36 +04:00
|
|
|
file with space:str1space
|
[tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../". This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.
This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns. Now you explicitly have to say
"glob:<pattern>" to get glob matching. However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.
Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.
Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3376605
Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-22 06:44:06 +03:00
|
|
|
$ hg grep str1 'glob:*f1'
|
2014-09-26 00:50:36 +04:00
|
|
|
f1:str1f1
|
|
|
|
$ hg grep str1 subdir1
|
|
|
|
subdir1/subf1:str1sub
|
[tweakdefaults] fix handling of grep file pattern arguments
Summary:
Previously grep only searched in the current directory, even if you gave it a
pattern like "../". This fixes the code to correctly honor the arguments, and
to accept mercurial file patterns just like most other mercurial commands.
This does change the file parsing behavior somewhat: previously "hg grep" would
treat all arguments as glob patterns. Now you explicitly have to say
"glob:<pattern>" to get glob matching. However, I suspect this won't impact
most users, since they would normally let their shell perform glob expansion
before the arguments are given to mercurial.
Test Plan:
Included new unit tests for grep, and updated the existing tests that were
affected by the change in glob behavior.
Reviewers: #sourcecontrol, durham, carenthomas, ttung, rmcelroy
Reviewed By: rmcelroy
Subscribers: quark, mwilliams, matthieu, meyering, yfeldblum, rmcelroy, net-systems-diffs@, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3376605
Signature: t1:3376605:1464841648:98bfb47866dec802ca34f55c821796f36532211f
2016-06-22 06:44:06 +03:00
|
|
|
$ hg grep str1 'glob:**/*f1'
|
2014-09-26 00:50:36 +04:00
|
|
|
f1:str1f1
|
|
|
|
subdir1/subf1:str1sub
|
2015-07-02 21:11:56 +03:00
|
|
|
|
2015-09-18 20:20:49 +03:00
|
|
|
Test that status is default relative
|
|
|
|
$ mkdir foo
|
|
|
|
$ cd foo
|
|
|
|
$ hg status
|
|
|
|
A ../-v
|
|
|
|
A ../f1
|
|
|
|
A ../file with space
|
|
|
|
A ../subdir1/subf1
|
|
|
|
$ hg status --root-relative
|
|
|
|
A dir1/-v
|
|
|
|
A dir1/f1
|
|
|
|
A dir1/file with space
|
|
|
|
A dir1/subdir1/subf1
|
|
|
|
$ hg status .
|
|
|
|
$ hg status ../subdir1
|
|
|
|
A ../subdir1/subf1
|
|
|
|
|
tweakdefaults: abort when combining --root-relative with patterns
Summary:
When people combine --root-relative with a file pattern, they would probably
expect the output to be relative to the root -- but it's not! In this case, it
would fall back to the default file pattern behavior, which is cwd-relative.
Instead of confusing the user with apprarently errorneous output, let's abort
explicitly and provide a helptful hint.
Test Plan: added a new test, existing tests still pass
Reviewers: #mercurial, simpkins, ttung, quark
Reviewed By: quark
Subscribers: quark, net-systems-diffs@, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3319366
Signature: t1:3319366:1463610688:3f129c97f68f43ac85d2b31b55fac5c859e85c04
2016-05-19 19:35:59 +03:00
|
|
|
Test that --root-relative and patterns abort
|
|
|
|
$ hg status --root-relative ""
|
|
|
|
abort: --root-relative not supported with patterns
|
|
|
|
(run from the repo root instead)
|
|
|
|
[255]
|
|
|
|
|
2015-09-18 20:20:49 +03:00
|
|
|
Don't break automation
|
|
|
|
$ HGPLAIN=1 hg status
|
|
|
|
A dir1/-v
|
|
|
|
A dir1/f1
|
|
|
|
A dir1/file with space
|
|
|
|
A dir1/subdir1/subf1
|
2015-09-24 21:29:41 +03:00
|
|
|
|
2018-10-15 18:02:29 +03:00
|
|
|
This tag is kept to keep the rest of the test consistent:
|
2015-09-24 21:29:41 +03:00
|
|
|
$ hg tag foo
|
2015-10-20 09:55:23 +03:00
|
|
|
|
2015-10-22 00:26:15 +03:00
|
|
|
Test graft date when tweakdefaults.graftkeepdate is not set
|
|
|
|
$ hg revert -a -q
|
|
|
|
$ hg up -q 1
|
|
|
|
$ hg graft -q 2
|
|
|
|
$ hg log -T "{rev}\n" -d "yesterday to today"
|
|
|
|
4
|
|
|
|
|
|
|
|
Test graft date when tweakdefaults.graftkeepdate is not set and --date is provided
|
|
|
|
$ hg up -q 1
|
|
|
|
$ hg graft -q 2 --date "1 1"
|
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
|
|
|
1.01 5
|
|
|
|
|
|
|
|
Test graft date when tweakdefaults.graftkeepdate is set
|
|
|
|
$ hg up -q 1
|
2015-11-12 12:36:21 +03:00
|
|
|
$ hg graft -q 5 --config tweakdefaults.graftkeepdate=True
|
2015-10-22 00:26:15 +03:00
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
2015-11-12 12:36:21 +03:00
|
|
|
1.01 6
|
2015-10-22 00:26:15 +03:00
|
|
|
|
2015-10-23 01:50:59 +03:00
|
|
|
Test amend date when tweakdefaults.amendkeepdate is not set
|
|
|
|
$ hg up -q 1
|
|
|
|
$ echo x > a
|
|
|
|
$ hg commit -Aqm "commit for amend"
|
|
|
|
$ echo x > a
|
|
|
|
$ hg amend -q -m "amended message"
|
|
|
|
$ hg log -T "{rev}\n" -d "yesterday to today"
|
|
|
|
7
|
|
|
|
|
|
|
|
Test amend date when tweakdefaults.amendkeepdate is set
|
|
|
|
$ touch new_file
|
|
|
|
$ hg commit -d "0 0" -Aqm "commit for amend"
|
|
|
|
$ echo x > new_file
|
2017-08-15 17:21:37 +03:00
|
|
|
$ hg amend -q -m "amended message" --config tweakdefaults.amendkeepdate=True
|
2015-10-23 01:50:59 +03:00
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
|
|
|
0.00 8
|
|
|
|
|
2017-11-25 20:19:09 +03:00
|
|
|
Test amend --to doesn't give a flag error when tweakdefaults.amendkeepdate is set
|
|
|
|
$ echo q > new_file
|
|
|
|
$ hg amend --to 8 --config tweakdefaults.amendkeepdate=False
|
|
|
|
hg: parse error: pick "3903775176ed" changeset was not a candidate
|
|
|
|
(only use listed changesets)
|
|
|
|
[255]
|
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
|
|
|
0.00 9
|
|
|
|
|
2015-10-23 01:50:59 +03:00
|
|
|
Test commit --amend date when tweakdefaults.amendkeepdate is set
|
|
|
|
$ echo a >> new_file
|
|
|
|
$ hg commit -d "0 0" -Aqm "commit for amend"
|
|
|
|
$ echo x > new_file
|
|
|
|
$ hg commit -q --amend -m "amended message" --config tweakdefaults.amendkeepdate=True
|
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
2017-11-25 20:19:09 +03:00
|
|
|
0.00 10
|
2015-10-23 01:50:59 +03:00
|
|
|
|
|
|
|
Test commit --amend date when tweakdefaults.amendkeepdate is not set and --date is provided
|
|
|
|
$ echo xxx > a
|
|
|
|
$ hg commit -d "0 0" -Aqm "commit for amend"
|
|
|
|
$ echo x > a
|
|
|
|
$ hg commit -q --amend -m "amended message" --date "1 1"
|
|
|
|
$ hg log -l 1 -T "{date} {rev}\n"
|
2017-11-25 20:19:09 +03:00
|
|
|
1.01 11
|
2015-10-23 01:50:59 +03:00
|
|
|
|
2015-11-12 12:36:21 +03:00
|
|
|
Test rebase date when tweakdefaults.rebasekeepdate is not set
|
|
|
|
$ echo test_1 > rebase_dest
|
|
|
|
$ hg commit --date "1 1" -Aqm "dest commit for rebase"
|
|
|
|
$ hg bookmark rebase_dest_test_1
|
2016-01-08 05:30:24 +03:00
|
|
|
$ hg up -q ".^"
|
2018-04-07 10:36:56 +03:00
|
|
|
hint[update-prev]: use 'hg prev' to move to the parent changeset
|
|
|
|
hint[hint-ack]: use 'hg hint --ack update-prev' to silence these hints
|
2015-11-12 12:36:21 +03:00
|
|
|
$ echo test_1 > rebase_source
|
|
|
|
$ hg commit --date "1 1" -Aqm "source commit for rebase"
|
|
|
|
$ hg bookmark rebase_source_test_1
|
|
|
|
$ hg rebase -q -s rebase_source_test_1 -d rebase_dest_test_1
|
|
|
|
$ hg log -l 1 -T "{rev}\n" -d "yesterday to today"
|
2017-11-25 20:19:09 +03:00
|
|
|
13
|
2015-11-12 12:36:21 +03:00
|
|
|
|
|
|
|
Test rebase date when tweakdefaults.rebasekeepdate is set
|
|
|
|
$ echo test_2 > rebase_dest
|
|
|
|
$ hg commit -Aqm "dest commit for rebase"
|
|
|
|
$ hg bookmark rebase_dest_test_2
|
2016-01-08 05:30:24 +03:00
|
|
|
$ hg up -q ".^"
|
2018-04-07 10:36:56 +03:00
|
|
|
hint[update-prev]: use 'hg prev' to move to the parent changeset
|
|
|
|
hint[hint-ack]: use 'hg hint --ack update-prev' to silence these hints
|
2015-11-12 12:36:21 +03:00
|
|
|
$ echo test_2 > rebase_source
|
|
|
|
$ hg commit -Aqm "source commit for rebase"
|
|
|
|
$ hg bookmark rebase_source_test_2
|
|
|
|
$ hg rebase -q -s rebase_source_test_2 -d rebase_dest_test_2 --config tweakdefaults.rebasekeepdate=True
|
|
|
|
$ hg log -l 2 -T "{date} {rev}\n"
|
2017-11-25 20:19:09 +03:00
|
|
|
0.00 15
|
2015-11-12 12:36:21 +03:00
|
|
|
0.00 14
|
|
|
|
|
2017-08-24 17:45:02 +03:00
|
|
|
Test histedit date when tweakdefaults.histeditkeepdate is set
|
|
|
|
$ hg bookmark histedit_test
|
|
|
|
$ echo test_1 > histedit_1
|
|
|
|
$ hg commit -Aqm "commit 1 for histedit"
|
|
|
|
$ echo test_2 > histedit_2
|
|
|
|
$ hg commit -Aqm "commit 2 for histedit"
|
|
|
|
$ echo test_3 > histedit_3
|
|
|
|
$ hg commit -Aqm "commit 3 for histedit"
|
2017-11-25 20:19:09 +03:00
|
|
|
$ hg histedit 16 --commands - --config tweakdefaults.histeditkeepdate=True 2>&1 <<EOF| fixbundle
|
2017-11-21 00:17:44 +03:00
|
|
|
> pick 16
|
2017-11-25 20:19:09 +03:00
|
|
|
> pick 18
|
|
|
|
> pick 17
|
2017-08-24 17:45:02 +03:00
|
|
|
> EOF
|
|
|
|
$ hg log -l 3 -T "{date} {rev} {desc}\n"
|
2017-11-25 20:19:09 +03:00
|
|
|
0.00 18 commit 2 for histedit
|
|
|
|
0.00 17 commit 3 for histedit
|
|
|
|
0.00 16 commit 1 for histedit
|
2017-08-24 17:45:02 +03:00
|
|
|
|
|
|
|
Test histedit date when tweakdefaults.histeditkeepdate is not set
|
2017-11-25 20:19:09 +03:00
|
|
|
$ hg histedit 16 --commands - 2>&1 <<EOF| fixbundle
|
2017-11-21 00:17:44 +03:00
|
|
|
> pick 16
|
2017-11-25 20:19:09 +03:00
|
|
|
> pick 18
|
|
|
|
> pick 17
|
2017-08-24 17:45:02 +03:00
|
|
|
> EOF
|
|
|
|
$ hg log -l 2 -T "{rev} {desc}\n" -d "yesterday to today"
|
2017-11-25 20:19:09 +03:00
|
|
|
18 commit 3 for histedit
|
|
|
|
17 commit 2 for histedit
|
2017-08-24 17:45:02 +03:00
|
|
|
|
2016-02-05 21:02:41 +03:00
|
|
|
Test non-remotenames use of pull --rebase and --update requires --dest
|
|
|
|
$ cd $TESTTMP
|
|
|
|
$ hg clone repo clone
|
|
|
|
updating to branch default
|
2017-08-24 17:45:02 +03:00
|
|
|
12 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-02-05 21:02:41 +03:00
|
|
|
$ cd clone
|
|
|
|
$ hg pull --rebase
|
|
|
|
abort: you must use a bookmark with tracking or manually specify a destination for the rebase
|
|
|
|
(set up tracking with `hg book <name> -t <destination>` or manually supply --dest / -d)
|
|
|
|
[255]
|
|
|
|
$ hg pull --update
|
|
|
|
abort: you must specify a destination for the update
|
|
|
|
(use `hg pull --update --dest <destination>`)
|
|
|
|
[255]
|
|
|
|
$ echo foo > foo
|
|
|
|
$ hg commit -Am 'foo'
|
|
|
|
adding foo
|
|
|
|
$ hg pull --rebase -d default
|
|
|
|
pulling from $TESTTMP/repo (glob)
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
nothing to rebase - working directory parent is also destination
|
|
|
|
$ hg pull --update -d default
|
|
|
|
pulling from $TESTTMP/repo (glob)
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg pull --rebase --config tweakdefaults.defaultdest=default
|
|
|
|
pulling from $TESTTMP/repo (glob)
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
nothing to rebase - working directory parent is also destination
|
|
|
|
$ hg pull --update --config tweakdefaults.defaultdest=default
|
|
|
|
pulling from $TESTTMP/repo (glob)
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-06-12 01:25:13 +03:00
|
|
|
$ cd $TESTTMP
|
|
|
|
|
2018-10-10 19:59:49 +03:00
|
|
|
Prepare a repo for testing divergence warnings with respect to inhibit
|
2016-06-12 01:25:13 +03:00
|
|
|
and allowance of prune rebases
|
|
|
|
$ hg init repodiv && cd repodiv
|
|
|
|
$ cat >> .hg/hgrc << EOF
|
|
|
|
> [experimental]
|
|
|
|
> evolution=createmarkers
|
2017-10-24 05:31:43 +03:00
|
|
|
> evolution.allowdivergence=off
|
2016-06-12 01:25:13 +03:00
|
|
|
> [extensions]
|
2018-10-11 16:55:19 +03:00
|
|
|
> amend=
|
2016-06-12 01:25:13 +03:00
|
|
|
> EOF
|
|
|
|
$ echo root > root && hg ci -Am root # rev 0
|
|
|
|
adding root
|
|
|
|
$ echo a > a && hg ci -Am a # rev 1
|
|
|
|
adding a
|
|
|
|
$ hg up 0 && echo b > b && hg ci -Am b # rev 2
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
adding b
|
|
|
|
$ hg up 0 && echo c > c && hg ci -Am c # rev 3
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
adding c
|
|
|
|
$ hg up 0 && echo d > d && hg ci -Am d # rev 4
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
adding d
|
|
|
|
$ hg rebase -r 1 -d 2
|
|
|
|
rebasing 1:09d39afb522a "a"
|
|
|
|
|
2018-10-10 19:59:49 +03:00
|
|
|
Test that we do not show divergence warning
|
2016-06-12 01:25:13 +03:00
|
|
|
$ hg rebase -r 1 -d 3 --hidden
|
|
|
|
rebasing 1:09d39afb522a "a"
|
|
|
|
|
|
|
|
Test that we allow pure prune rebases
|
2019-02-25 14:50:46 +03:00
|
|
|
$ hg prune 4
|
2016-06-12 01:25:13 +03:00
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
working directory now at 1e4be0697311
|
|
|
|
1 changesets pruned
|
2018-04-07 10:36:49 +03:00
|
|
|
hint[strip-hide]: 'hg strip' may be deprecated in the future - use 'hg hide' instead
|
|
|
|
hint[hint-ack]: use 'hg hint --ack strip-hide' to silence these hints
|
2016-06-12 01:25:13 +03:00
|
|
|
$ hg rebase -r 4 -d 3 --hidden
|
|
|
|
rebasing 4:31aefaa21905 "d"
|
2017-06-13 13:38:54 +03:00
|
|
|
|
|
|
|
Test diff --per-file-stat
|
|
|
|
$ echo a >> a
|
|
|
|
$ echo b > b
|
|
|
|
$ hg add a b
|
|
|
|
$ hg ci -m A
|
|
|
|
$ hg diff -r ".^" -r .
|
|
|
|
diff -r 1e4be0697311 -r d17770b7624d a
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+a
|
|
|
|
diff -r 1e4be0697311 -r d17770b7624d b
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/b Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+b
|
|
|
|
$ hg diff -r ".^" -r . --per-file-stat-json
|
|
|
|
{"a": {"adds": 1, "isbinary": false, "removes": 0}, "b": {"adds": 1, "isbinary": false, "removes": 0}}
|
2017-06-25 09:18:52 +03:00
|
|
|
|
2017-07-25 14:50:28 +03:00
|
|
|
Test rebase with showupdated=True
|
|
|
|
$ cd $TESTTMP
|
|
|
|
$ hg init showupdated
|
|
|
|
$ cd showupdated
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [tweakdefaults]
|
|
|
|
> showupdated=True
|
|
|
|
> rebasekeepdate=True
|
|
|
|
> EOF
|
|
|
|
$ touch a && hg commit -Aqm a
|
|
|
|
$ touch b && hg commit -Aqm b
|
|
|
|
$ hg up -q 0
|
|
|
|
$ touch c && hg commit -Aqm c
|
|
|
|
$ hg log -G -T '{node} {rev} {bookmarks}' -r 'all()'
|
|
|
|
@ d5e255ef74f8ec83b3a2a3f3254c699451c89e29 2
|
|
|
|
|
|
|
|
|
| o 0e067c57feba1a5694ca4844f05588bb1bf82342 1
|
|
|
|
|/
|
|
|
|
o 3903775176ed42b1458a6281db4a0ccf4d9f287a 0
|
|
|
|
|
|
|
|
$ hg rebase -r 1 -d 2
|
|
|
|
rebasing 1:0e067c57feba "b"
|
|
|
|
0e067c57feba -> a602e0d56f83 "b"
|
|
|
|
saved backup bundle to $TESTTMP/showupdated/.hg/strip-backup/0e067c57feba-ca6d05e3-rebase.hg (glob)
|
|
|
|
|
|
|
|
Test rebase with showupdate=True and a lot of source revisions
|
|
|
|
$ hg up -q 0
|
|
|
|
$ for i in `$TESTDIR/seq.py 11`; do touch "$i" && hg commit -Aqm "$i" && hg up -q 0; done
|
|
|
|
$ hg log -G -T '{node} {rev} {bookmarks}' -r 'all()'
|
|
|
|
o 6e3ddf6f49efd0a836a470a2d45e953db915c262 13
|
|
|
|
|
|
|
|
|
| o e02ec9861284762c93b8a4c9e0bac0abfbb59ac7 12
|
|
|
|
|/
|
|
|
|
| o 14218977adef919e86466c688defa3fb893a5638 11
|
|
|
|
|/
|
|
|
|
| o 6a01a2bb0a9f7a6f01c6f49ce90e60bf85de79d0 10
|
|
|
|
|/
|
|
|
|
| o e5ec40f709911f69eafada5746d3f5b969005738 9
|
|
|
|
|/
|
|
|
|
| o 73800d52e8ddab37a1f9177299d1fdfb563c061a 8
|
|
|
|
|/
|
|
|
|
| o 657f1516f142d51ba06b98413ce35a884f7f8af0 7
|
|
|
|
|/
|
|
|
|
| o 4e6ba707bdb81e60d96b84099c2d1c56530ee6f1 6
|
|
|
|
|/
|
|
|
|
| o 7ab24e484dafd1d2ebf51a4fa4523431b81b99aa 5
|
|
|
|
|/
|
|
|
|
| o ee71024c6e8c4a45ee1d3e462431bfec85ac215a 4
|
|
|
|
|/
|
|
|
|
| o 46a418a0abd225d8ad876102f495d209907b79d9 3
|
|
|
|
|/
|
|
|
|
| o a602e0d56f83e5816ebcbb78095e259ffbce94aa 2
|
|
|
|
| |
|
|
|
|
| o d5e255ef74f8ec83b3a2a3f3254c699451c89e29 1
|
|
|
|
|/
|
|
|
|
@ 3903775176ed42b1458a6281db4a0ccf4d9f287a 0
|
|
|
|
|
|
|
|
$ hg rebase -r 'all() - 0 - 12' -d 12
|
|
|
|
rebasing 1:d5e255ef74f8 "c"
|
|
|
|
rebasing 2:a602e0d56f83 "b"
|
|
|
|
rebasing 3:46a418a0abd2 "1"
|
|
|
|
rebasing 4:ee71024c6e8c "2"
|
|
|
|
rebasing 5:7ab24e484daf "3"
|
|
|
|
rebasing 6:4e6ba707bdb8 "4"
|
|
|
|
rebasing 7:657f1516f142 "5"
|
|
|
|
rebasing 8:73800d52e8dd "6"
|
|
|
|
rebasing 9:e5ec40f70991 "7"
|
|
|
|
rebasing 10:6a01a2bb0a9f "8"
|
|
|
|
rebasing 11:14218977adef "9"
|
|
|
|
rebasing 13:6e3ddf6f49ef "11" (tip)
|
|
|
|
14218977adef -> 2d12dd93bf8b "9"
|
|
|
|
46a418a0abd2 -> 645dc4557ba8 "1"
|
|
|
|
4e6ba707bdb8 -> b9598afdff23 "4"
|
|
|
|
657f1516f142 -> 906a55b270d4 "5"
|
|
|
|
6a01a2bb0a9f -> f5a7b375c4a9 "8"
|
|
|
|
6e3ddf6f49ef -> ad74bbdbdb75 "11"
|
|
|
|
73800d52e8dd -> 3145d47a5692 "6"
|
|
|
|
7ab24e484daf -> 03a9e0e4badc "3"
|
|
|
|
a602e0d56f83 -> e7a99f1fea2a "b"
|
|
|
|
d5e255ef74f8 -> 72d850a207d5 "c"
|
|
|
|
...
|
|
|
|
ee71024c6e8c -> 0c42bb4bf23f "2"
|
|
|
|
saved backup bundle to $TESTTMP/showupdated/.hg/strip-backup/6e3ddf6f49ef-4b18babd-rebase.hg (glob)
|
|
|
|
|
2017-08-02 17:56:58 +03:00
|
|
|
Test rebase with showupdate=True and a long commit message
|
|
|
|
$ touch longfile && hg add -q
|
|
|
|
$ hg commit -qm "This is a long commit message which will be truncated."
|
|
|
|
$ hg rebase -d 1
|
|
|
|
rebasing 14:e915a57d67db "This is a long commit message which will be truncated." (tip)
|
|
|
|
e915a57d67db -> 5444f740ff6c "This is a long commit message which will be tru..."
|
|
|
|
saved backup bundle to $TESTTMP/showupdated/.hg/strip-backup/e915a57d67db-ad3372b5-rebase.hg (glob)
|