sapling/tests/test-tweakdefaults-remotenames.t
Jun Wu 4a936cee21 codemod: remove extpath in tests
Summary:
Previously, the following pattern is common in our tests:

```
   $ extpath=`dirname $TESTDIR`
   $ cp $extpath/hgext3rd/name.py $TESTTMP # use $TESTTMP substitution in message
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTTMP/name.py
   > EOF
```

Now, it gets simplified to:

```
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTDIR/../hgext3rd/name.py
   > EOF
```

This removes unnecessary `dirname` and `cp`.

Also fixed a regex that does not match `bytes`:

```
-  transferred 268 bytes in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
+  transferred 268 bytes in 0.3 seconds (939 bytes/sec)
```

Test Plan: arc unit

Reviewers: #mercurial, phillco

Reviewed By: phillco

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5270897

Signature: t1:5270897:1497663052:bf860a0b480c751b1e4b53cebf6526193f0f6652
2017-06-16 18:31:25 -07:00

136 lines
4.0 KiB
Perl

Check for remotenames and skip if not present
$ . $TESTDIR/require-ext.sh remotenames
Set up
$ cat >> $HGRCPATH << EOF
> [extensions]
> rebase=
> remotenames=
> tweakdefaults=$TESTDIR/../hgext3rd/tweakdefaults.py
> EOF
$ hg init repo
$ echo a > repo/a
$ hg -R repo commit -qAm aa
$ hg -R repo bookmark one -i
$ echo b > repo/b
$ hg -R repo commit -qAm bb
$ hg -R repo bookmark two -i
$ echo c > repo/c
$ hg -R repo commit -qAm cc
$ hg -R repo bookmark three -i
$ hg clone -q repo clone
$ cd clone
Test that hg pull --rebase aborts without --dest
$ hg log -G --all -T '{node|short} {bookmarks} {remotenames}'
@ 083f922fc4a9 default/three default/default
|
o 301d76bdc3ae default/two
|
o 8f0162e483d0 default/one
$ hg up -q default/one
$ touch foo
$ hg commit -qAm 'foo'
$ 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 bookmark bm
$ 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 -t <destination>` or manually supply --dest / -d)
[255]
$ hg book bm -t default/two
$ hg pull --rebase
pulling from $TESTTMP/repo (glob)
searching for changes
no changes found
rebasing 3:3de6bbccf693 "foo" (tip bm)
saved backup bundle to $TESTTMP/clone/.hg/strip-backup/3de6bbccf693-0dce0663-backup.hg (glob)
$ hg pull --rebase --dest three
pulling from $TESTTMP/repo (glob)
searching for changes
no changes found
rebasing 3:54ac787ff1c5 "foo" (tip bm)
saved backup bundle to $TESTTMP/clone/.hg/strip-backup/54ac787ff1c5-4c2ca3a1-backup.hg (glob)
Test that hg pull --update aborts without --dest
$ hg pull --update
abort: you must specify a destination for the update
(use `hg pull --update --dest <destination>`)
[255]
$ hg pull --update --dest one
pulling from $TESTTMP/repo (glob)
searching for changes
no changes found
0 files updated, 0 files merged, 3 files removed, 0 files unresolved
(leaving bookmark bm)
Test that setting a defaultdest allows --update and --rebase to work
$ hg pull --update --config tweakdefaults.defaultdest=two
pulling from $TESTTMP/repo (glob)
searching for changes
no changes found
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -G --all -T '{node|short} {bookmarks} {remotenames}'
o 5413b62180b7 bm
|
o 083f922fc4a9 default/three default/default
|
@ 301d76bdc3ae default/two
|
o 8f0162e483d0 default/one
$ echo d > d
$ hg commit -qAm d
$ hg pull --rebase --config tweakdefaults.defaultdest=three
pulling from $TESTTMP/repo (glob)
searching for changes
no changes found
rebasing 4:50f3f60b4841 "d" (tip)
saved backup bundle to * (glob)
$ hg log -G --all -T '{node|short} {bookmarks} {remotenames}'
@ ba0f83735c95
|
| o 5413b62180b7 bm
|/
o 083f922fc4a9 default/three default/default
|
o 301d76bdc3ae default/two
|
o 8f0162e483d0 default/one
Test that hg pull --rebase also works with a --tool argument
$ echo d created at remote > ../repo/d
$ hg -R ../repo update three -q
$ hg -R ../repo commit -qAm 'remote d'
$ hg pull --rebase --dest three --tool internal:union
pulling from $TESTTMP/repo (glob)
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads .' to see heads, 'hg merge' to merge)
rebasing 4:ba0f83735c95 "d"
merging d
saved backup bundle to $TESTTMP/clone/.hg/strip-backup/ba0f83735c95-ba455273-backup.hg (glob)
$ hg log -G --all -T '{node|short} {bookmarks} {remotenames}'
@ d6553cf01770
|
o e8aa3bc9f3f0 default/three default/default
|
| o 5413b62180b7 bm
|/
o 083f922fc4a9
|
o 301d76bdc3ae default/two
|
o 8f0162e483d0 default/one
$ cat d
d created at remote
d