tests/test-mq-qrename.t
author Brodie Rao <brodie@bitheap.org>
Wed, 30 Mar 2011 20:03:05 -0700
changeset 13826 e574207e3bcd
parent 12875 b59b5193d4d0
child 15322 c8e2a5ea7062
permissions -rw-r--r--
url: refactor util.drop_scheme() and hg.localpath() into url.localpath() This replaces util.drop_scheme() with url.localpath(), using url.url for parsing instead of doing it on its own. The function is moved from util to url to avoid an import cycle. hg.localpath() is removed in favor of using url.localpath(). This provides more consistent behavior between "hg clone" and other commands. To preserve backwards compatibility, URLs like bundle://../foo still refer to ../foo, not /foo. If a URL contains a scheme, percent-encoded entities are decoded. When there's no scheme, all characters are left untouched. Comparison of old and new behaviors: URL drop_scheme() hg.localpath() url.localpath() === ============= ============== =============== file://foo/foo /foo foo/foo /foo file://localhost:80/foo /foo localhost:80/foo /foo file://localhost:/foo /foo localhost:/foo /foo file://localhost/foo /foo /foo /foo file:///foo /foo /foo /foo file://foo (empty string) foo / file:/foo /foo /foo /foo file:foo foo foo foo file:foo%23bar foo%23bar foo%23bar foo#bar foo%23bar foo%23bar foo%23bar foo%23bar /foo /foo /foo /foo Windows-related paths on Windows: URL drop_scheme() hg.localpath() url.localpath() === ============= ============== =============== file:///C:/foo C:/C:/foo /C:/foo C:/foo file:///D:/foo C:/D:/foo /D:/foo D:/foo file://C:/foo C:/foo C:/foo C:/foo file://D:/foo C:/foo D:/foo D:/foo file:////foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar \\foo\bar //foo/bar //foo/bar \\foo\bar Windows-related paths on other platforms: file:///C:/foo C:/C:/foo /C:/foo C:/foo file:///D:/foo C:/D:/foo /D:/foo D:/foo file://C:/foo C:/foo C:/foo C:/foo file://D:/foo C:/foo D:/foo D:/foo file:////foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar //foo/bar \\foo\bar //foo/bar //foo/bar \\foo\bar For more information about file:// URL handling, see: http://www-archive.mozilla.org/quality/networking/testing/filetests.html Related issues: - issue1153: File URIs aren't handled correctly in windows This patch should preserve the fix implemented in 2770d03ae49f. However, it goes a step further and "promotes" Windows-style drive letters from being interpreted as host names to being part of the path. - issue2154: Cannot escape '#' in Mercurial URLs (#1172 in THG) The fragment is still interpreted as a revision or a branch, even in paths to bundles. However, when file: is used, percent-encoded entities are decoded, so file:test%23bundle.hg can refer to test#bundle.hg ond isk.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     1
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     2
  $ echo "[extensions]" >> $HGRCPATH
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     3
  $ echo "mq=" >> $HGRCPATH
3083
82c9d1aac308 Make qrename handle directory targets; closes #333.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     5
  $ hg init a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     6
  $ cd a
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     7
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     8
  $ echo 'base' > base
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
     9
  $ hg ci -Ambase
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    10
  adding base
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    11
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    12
  $ hg qnew -mmqbase mqbase
3083
82c9d1aac308 Make qrename handle directory targets; closes #333.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    13
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    14
  $ hg qrename mqbase renamed
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    15
  $ mkdir .hg/patches/foo
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    16
  $ hg qrename renamed foo
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    17
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    18
  $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    19
  foo/renamed
3083
82c9d1aac308 Make qrename handle directory targets; closes #333.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    20
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    21
  $ ls .hg/patches/foo
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    22
  renamed
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    23
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    24
  $ mkdir .hg/patches/bar
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    25
  $ hg qrename foo/renamed bar
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    26
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    27
  $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    28
  bar/renamed
3083
82c9d1aac308 Make qrename handle directory targets; closes #333.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    29
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    30
  $ ls .hg/patches/bar
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    31
  renamed
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    32
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    33
  $ hg qrename bar/renamed baz
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    34
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    35
  $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    36
  baz
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    37
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    38
  $ ls .hg/patches/baz
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    39
  .hg/patches/baz
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    40
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    41
  $ hg qrename baz new/dir
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    42
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    43
  $ hg qseries
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    44
  new/dir
3083
82c9d1aac308 Make qrename handle directory targets; closes #333.
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    45
12324
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    46
  $ ls .hg/patches/new/dir
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    47
  .hg/patches/new/dir
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    48
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    49
  $ cd ..
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    50
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    51
Test patch being renamed before committed:
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    52
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    53
  $ hg init b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    54
  $ cd b
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    55
  $ hg qinit -c
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    56
  $ hg qnew x
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    57
  $ hg qrename y
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    58
  $ hg qcommit -m rename
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    59
b701610f6c56 tests: unify some of test-mq*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11513
diff changeset
    60
  $ cd ..
6649
05a682c8907d test-mq-qrename: test added patch renaming
Patrick Mezard <pmezard@gmail.com>
parents: 3083
diff changeset
    61
12361
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    62
Test overlapping renames (issue2388)
6649
05a682c8907d test-mq-qrename: test added patch renaming
Patrick Mezard <pmezard@gmail.com>
parents: 3083
diff changeset
    63
12361
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    64
  $ hg init c
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    65
  $ cd c
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    66
  $ hg qinit -c
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    67
  $ echo a > a
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    68
  $ hg add
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    69
  adding a
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    70
  $ hg qnew patcha
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    71
  $ echo b > b
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    72
  $ hg add
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    73
  adding b
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    74
  $ hg qnew patchb
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    75
  $ hg ci --mq -m c1
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    76
  $ hg qrename patchb patchc
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    77
  $ hg qrename patcha patchb
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    78
  $ hg st --mq
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    79
  M patchb
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    80
  M series
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    81
  A patchc
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    82
  R patcha
2754c8273132 Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12360 12324
diff changeset
    83
  $ cd ..
12875
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    84
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    85
Test renames with mq repo (issue2097)
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    86
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    87
  $ hg init issue2097
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    88
  $ cd issue2097
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    89
  $ hg qnew p0
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    90
  $ (cd .hg/patches && hg init)
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    91
  $ hg qren p0 p1
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    92
  $ hg debugstate --mq
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    93
  $ hg ci --mq -mq0
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    94
  nothing changed
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    95
  [1]
b59b5193d4d0 mq: qrename should not touch the dirstate if src is untracked (issue2460)
Patrick Mezard <pmezard@gmail.com>
parents: 12361
diff changeset
    96
  $ cd ..