tests/test-merge-subrepos.t
author Matt Harbison <matt_harbison@yahoo.com>
Wed, 28 Jun 2017 21:30:46 -0400
changeset 33196 439b4d005b4a
parent 19803 0f64af33fb63
child 33359 583aa1e3658b
permissions -rw-r--r--
tests: demonstrate inconsistencies with dirty state in various commands Not only is the output of these commands inconsistent with respect to each other when a file is deleted, they are internally inconsistent depending upon whether the deleted file is in the top level repo or a subrepo. It seemed easier to show the problems, rather than describe them. The original goal was to fix the summary command with respect to deleted files. I haven't fixed any of the other issues yet, in case anybody believes the current subrepo behavior is correct. I think a natural understanding of clean/dirty is that they are two opposite values of a single binary repo state. If `hg update --clean -r .` changes a file, then naturally that repo was dirty, and `hg update --check` should have blocked it. Deleted files are special, in that they don't block a commit. But they make the filesystem content not the same as a clean checkout.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13437
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     1
  $ hg init
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     2
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     3
  $ echo a > a
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     4
  $ hg ci -qAm 'add a'
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     5
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     6
  $ hg init subrepo
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     7
  $ echo 'subrepo = http://example.net/libfoo' > .hgsub
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     8
  $ hg ci -qAm 'added subrepo'
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
     9
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    10
  $ hg up -qC 0
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    11
  $ echo ax > a
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    12
  $ hg ci -m 'changed a'
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    13
  created new head
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    14
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    15
  $ hg up -qC 1
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    16
  $ cd subrepo
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    17
  $ echo b > b
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    18
  $ hg add b
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    19
  $ cd ..
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    20
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    21
Should fail, since there are added files to subrepo:
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    22
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    23
  $ hg merge
19803
0f64af33fb63 merge: standardize error message for dirty subrepo
Siddharth Agarwal <sid0@fb.com>
parents: 13437
diff changeset
    24
  abort: uncommitted changes in subrepository 'subrepo'
13437
6169493ac3f9 Do not allow merging with uncommitted changes in a subrepo
Oleg Stepanov <oleg.stepanov@jetbrains.com>
parents:
diff changeset
    25
  [255]
33196
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    26
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    27
Deleted files trigger a '+' marker in top level repos.  Deleted files are also
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    28
noticed by `update --check` in the top level repo.
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    29
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    30
  $ hg ci -Sqm 'add b'
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    31
  $ rm a
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    32
  $ hg id
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    33
  cb66ec850af7+ tip
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    34
  $ hg sum
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    35
  parent: 3:cb66ec850af7 tip
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    36
   add b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    37
  branch: default
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    38
  commit: 1 deleted (clean)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    39
  update: 1 new changesets, 2 branch heads (merge)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    40
  phases: 4 draft
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    41
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    42
  $ hg up --check -r '.^'
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    43
  abort: uncommitted changes
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    44
  [255]
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    45
  $ hg st -S
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    46
  ! a
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    47
  $ hg up -Cq .
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    48
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    49
Test that dirty is consistent through subrepos
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    50
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    51
  $ rm subrepo/b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    52
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    53
TODO: a deleted subrepo file should be flagged as dirty, like the top level repo
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    54
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    55
  $ hg id
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    56
  cb66ec850af7 tip
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    57
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    58
TODO: a deleted file should be listed as such, like the top level repo
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    59
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    60
  $ hg sum
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    61
  parent: 3:cb66ec850af7 tip
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    62
   add b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    63
  branch: default
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    64
  commit: (clean)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    65
  update: 1 new changesets, 2 branch heads (merge)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    66
  phases: 4 draft
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    67
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    68
Modified subrepo files are noticed by `update --check` and `summary`
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    69
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    70
  $ echo mod > subrepo/b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    71
  $ hg st -S
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    72
  M subrepo/b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    73
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    74
  $ hg up -r '.^' --check
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    75
  abort: uncommitted changes in subrepository 'subrepo'
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    76
  [255]
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    77
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    78
  $ hg sum
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    79
  parent: 3:cb66ec850af7 tip
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    80
   add b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    81
  branch: default
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    82
  commit: 1 subrepos
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    83
  update: 1 new changesets, 2 branch heads (merge)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    84
  phases: 4 draft
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    85
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    86
TODO: why is -R needed here?  If it's because the subrepo is treated as a
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    87
discrete unit, then this should probably warn or something.
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    88
  $ hg revert -R subrepo --no-backup subrepo/b -r .
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    89
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    90
  $ rm subrepo/b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    91
  $ hg st -S
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    92
  ! subrepo/b
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    93
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    94
TODO: --check should notice a subrepo with a missing file.  It already notices
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    95
a modified file.
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    96
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    97
  $ hg up -r '.^' --check
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    98
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
    99
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   100
TODO: update without --clean shouldn't restore a deleted subrepo file, since it
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   101
doesn't restore a deleted top level repo file.
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   102
  $ hg st -S
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   103
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   104
  $ hg bookmark -r tip @other
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   105
  $ echo xyz > subrepo/c
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   106
  $ hg ci -SAm 'add c'
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   107
  adding subrepo/c
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   108
  committing subrepository subrepo
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   109
  created new head
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   110
  $ rm subrepo/c
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   111
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   112
Merge sees deleted subrepo files as an uncommitted change
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   113
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   114
  $ hg merge @other
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   115
   subrepository subrepo diverged (local revision: 2b4750dcc93f, remote revision: cde40f86152f)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   116
  (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   117
  abort: uncommitted changes (in subrepo subrepo)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   118
  (use 'hg status' to list changes)
439b4d005b4a tests: demonstrate inconsistencies with dirty state in various commands
Matt Harbison <matt_harbison@yahoo.com>
parents: 19803
diff changeset
   119
  [255]