tests/test-subrepo-missing.t
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 03 Feb 2015 15:01:43 -0500
branchstable
changeset 24877 cc497780eaf9
parent 24645 b39afa36006a
child 25591 f1d46075b13a
permissions -rw-r--r--
subrepo: propagate the --hidden option to hg subrepositories With many commands accepting a '-S' or an explicit path to trigger recursing into subrepos, it seems that --hidden needs to be propagated too. Unfortunately, many of the subrepo layer methods discard the options map, so passing the option along explicitly isn't currently an option. It also isn't clear if other filtered views need to be propagated, so changing all of those commands may be insufficient anyway. The specific jam I got into was amending an ancestor of qbase in a subrepo, and then evolving. The patch ended up being hidden, and outgoing said it would only push one unrelated commit. But push aborted with an 'unknown revision' that I traced back to the patch. (Odd it didn't say 'filtered revision'.) A push with --hidden worked from the subrepo, but that wasn't possible from the parent repo before this. Since the underlying problem doesn't actually require a subrepo, there's probably more to investigate here in the discovery area. Yes, evolve + mq is not exactly sane, but I don't know what is seeing the hidden revision. In lieu of creating a test for the above situation (evolving mq should probably be blocked), the test here is a marginally useful case where --hidden is needed in a subrepo: cat'ing a file in a hidden revision. Without this change, cat aborts with: $ hg --hidden cat subrepo/a skipping missing subrepository: subrepo [1]
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
  $ hg init repo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
  $ cd repo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
  $ hg init subrepo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
  $ echo a > subrepo/a
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
  $ hg -R subrepo ci -Am adda
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
  adding a
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
  $ echo 'subrepo = subrepo' > .hgsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
  $ hg ci -Am addsubrepo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
  adding .hgsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
  $ echo b > subrepo/b
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
  $ hg -R subrepo ci -Am addb
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
  adding b
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
  $ hg ci -m updatedsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
16595
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    15
ignore blanklines in .hgsubstate
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    16
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    17
  >>> file('.hgsubstate', 'wb').write('\n\n   \t \n   \n')
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    18
  $ hg st --subrepos
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    19
  M .hgsubstate
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    20
  $ hg revert -qC .hgsubstate
2de6ac4ac17c subrepo: ignore blank lines in .hgsubstate (issue3424)
Patrick Mezard <patrick@mezard.eu>
parents: 16073
diff changeset
    21
16596
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    22
abort more gracefully on .hgsubstate parsing error
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    23
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    24
  $ cp .hgsubstate .hgsubstate.old
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    25
  >>> file('.hgsubstate', 'wb').write('\ninvalid')
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    26
  $ hg st --subrepos
24645
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    27
  abort: invalid subrepository revision specifier in '.hgsubstate' line 2
16596
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    28
  [255]
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    29
  $ mv .hgsubstate.old .hgsubstate
95ca6c8b38da subrepo: do not traceback on .hgsubstate parsing errors
Patrick Mezard <patrick@mezard.eu>
parents: 16595
diff changeset
    30
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
delete .hgsub and revert it
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
  $ rm .hgsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
  $ hg revert .hgsub
24645
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    35
  warning: subrepo spec file '.hgsub' not found
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    36
  warning: subrepo spec file '.hgsub' not found
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    37
  warning: subrepo spec file '.hgsub' not found
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
delete .hgsubstate and revert it
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
  $ rm .hgsubstate
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
  $ hg revert .hgsubstate
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
delete .hgsub and update
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
  $ rm .hgsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
  $ hg up 0
24645
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    48
  warning: subrepo spec file '.hgsub' not found
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    49
  warning: subrepo spec file '.hgsub' not found
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
  $ hg st
24645
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    52
  warning: subrepo spec file '.hgsub' not found
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
  ! .hgsub
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
  $ ls subrepo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
  a
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
delete .hgsubstate and update
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
  $ hg up -C
24645
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    60
  warning: subrepo spec file '.hgsub' not found
b39afa36006a subrepo: precisely identify the missing subrepo spec file
Matt Harbison <matt_harbison@yahoo.com>
parents: 24479
diff changeset
    61
  warning: subrepo spec file '.hgsub' not found
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
  $ rm .hgsubstate
17345
4f8054d3171b check-code: fix check for trailing whitespace on sh command lines
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
    64
  $ hg up 0
13017
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
  remote changed .hgsubstate which local deleted
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
  use (c)hanged version or leave (d)eleted? c
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
  $ hg st
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
  $ ls subrepo
d0e21c5fde41 subrepo: handle missing subrepo spec file as removed
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
  a
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16596
diff changeset
    71
20319
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    72
Enable obsolete
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    73
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    74
  $ cat >> $HGRCPATH << EOF
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    75
  > [ui]
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    76
  > logtemplate= {rev}:{node|short} {desc|firstline}
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    77
  > [phases]
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    78
  > publish=False
22955
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 20319
diff changeset
    79
  > [experimental]
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 20319
diff changeset
    80
  > evolution=createmarkers
20319
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    81
  > EOF
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    82
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    83
check that we can update parent repo with missing (amended) subrepo revision
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    84
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    85
  $ hg up --repository subrepo -r tip
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    86
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    87
  $ hg ci -m "updated subrepo to tip"
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    88
  created new head
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    89
  $ cd subrepo
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    90
  $ hg update -r tip
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    91
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    92
  $ echo foo > a
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    93
  $ hg commit --amend -m "addb (amended)"
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16596
diff changeset
    94
  $ cd ..
20319
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    95
  $ hg update --clean .
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    96
  revision 102a90ea7b4a in subrepo subrepo is hidden
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    97
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
    98
24877
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
    99
check that --hidden is propagated to the subrepo
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   100
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   101
  $ hg -R subrepo up tip
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   102
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   103
  $ hg ci -m 'commit with amended subrepo'
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   104
  $ echo bar > subrepo/a
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   105
  $ hg -R subrepo ci --amend -m "amend a (again)"
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   106
  $ hg --hidden cat subrepo/a
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   107
  foo
cc497780eaf9 subrepo: propagate the --hidden option to hg subrepositories
Matt Harbison <matt_harbison@yahoo.com>
parents: 24645
diff changeset
   108
20319
427d672c0e4e subrepo: make it possible to update to hidden subrepo revisions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17345
diff changeset
   109
  $ cd ..