tests/test-clone-update-order.t
author Manuel Jacob <me@manueljacob.de>
Mon, 11 Jul 2022 01:51:20 +0200
branchstable
changeset 49378 094a5fa3cf52
parent 45827 8d72e29ad1e0
child 49621 55c6ebd11cb9
permissions -rw-r--r--
procutil: make stream detection in make_line_buffered more correct and strict In make_line_buffered(), we don’t want to wrap the stream if we know that lines get flushed to the underlying raw stream already. Previously, the heuristic was too optimistic. It assumed that any stream which is not an instance of io.BufferedIOBase doesn’t need wrapping. However, there are buffered streams that aren’t instances of io.BufferedIOBase, like Mercurial’s own winstdout. The new logic is different in two ways: First, only for the check, if unwraps any combination of WriteAllWrapper and winstdout. Second, it skips wrapping the stream only if it is an instance of io.RawIOBase (or already wrapped). If it is an instance of io.BufferedIOBase, it gets wrapped. In any other case, the function raises an exception. This ensures that, if an unknown stream is passed or we add another wrapper in the future, we don’t wrap the stream if it’s already line buffered or not wrap the stream if it’s not line buffered. In fact, this was already helpful during development of this change. Without it, I possibly would have forgot that WriteAllWrapper needs to be ignored for the check, leading to unnecessary wrapping if stdout is unbuffered. The alternative would have been to always wrap unknown streams. However, I don’t think that anyone would benefit from being less strict. We can expect streams from the standard library to be subclassing either io.RawIOBase or io.BufferedIOBase, so running Mercurial in the standard way should not regress by this change. Py2exe might replace sys.stdout and sys.stderr, but that currently breaks Mercurial anyway and also these streams don’t claim to be interactive, so this function is not called for them.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     1
  $ hg init
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     2
  $ echo foo > bar
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     3
  $ hg commit -Am default
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     4
  adding bar
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     5
  $ hg up -r null
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     6
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     7
  $ hg branch mine
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
     8
  marked working directory as branch mine
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12847
diff changeset
     9
  (branches are permanent and global, did you want a bookmark?)
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    10
  $ echo hello > world
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    11
  $ hg commit -Am hello
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    12
  adding world
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    13
  $ hg up -r null
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    14
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    15
  $ hg branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    16
  marked working directory as branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    17
  $ echo good > bye
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    18
  $ hg commit -Am other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    19
  adding bye
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    20
  $ hg up -r mine
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    21
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    22
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    23
  $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    24
  abort: cannot specify both --noupdate and --updaterev
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
    25
  [10]
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    26
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    27
  $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    28
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    29
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    30
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    31
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    32
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    33
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    34
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    35
  $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    36
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    37
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    38
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    39
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    40
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    41
  updating to branch mine
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    42
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    43
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    44
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    45
  $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    46
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    47
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    48
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    49
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    50
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    51
  updating to branch default
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    52
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    53
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    54
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    55
  $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    56
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    57
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    58
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    59
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    60
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    61
  updating to branch mine
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    62
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    63
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    64
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    65
  $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    66
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    67
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    68
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    69
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    70
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    71
  updating to branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    72
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    73
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    74
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    75
Test -r mine ... mine is ignored:
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    76
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    77
  $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    78
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    79
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    80
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    81
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    82
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    83
  updating to branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    84
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    85
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    86
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    87
  $ hg clone .#other ../b -b default -b mine
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    88
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    89
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    90
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    91
  added 3 changesets with 3 changes to 3 files (+2 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
    92
  new changesets 8c68ee086fd0:fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    93
  updating to branch default
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    94
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    95
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
    96
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    97
  $ hg clone .#other ../b
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    98
  adding changesets
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
    99
  adding manifests
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   100
  adding file changes
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   101
  added 1 changesets with 1 changes to 1 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 25295
diff changeset
   102
  new changesets fcc393352796
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   103
  updating to branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   104
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   105
  $ rm -rf ../b
10637
7ce62865d72a commands: document and test hg clone update priority
timeless <timeless@gmail.com>
parents:
diff changeset
   106
12286
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   107
  $ hg clone -U . ../c -r 1 -r 2 > /dev/null
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   108
  $ hg clone ../c ../b
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   109
  updating to branch other
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   110
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   111
  $ rm -rf ../b ../c
63352a7a8c1c tests: unify test-clone-update-order
Adrian Buehlmann <adrian@cadifra.com>
parents: 10637
diff changeset
   112