tests/test-share-safe.t
author Pulkit Goyal <7895pulkit@gmail.com>
Thu, 17 Sep 2020 18:49:57 -0700
changeset 45486 ac7a3da0dbb6
parent 45485 b71858b42963
child 45487 78f0bb37f52d
permissions -rw-r--r--
config: add `--shared` flag to edit config file of shared source With `format.exp-share-safe` enabled, we now read the `.hg/hgrc` of the shared source also. This patch adds `--shared` flag to `hg config` command which can be used to edit that shared source config file. It only works if the repository is shared one and is shared using the safe method. Differential Revision: https://phab.mercurial-scm.org/D8659
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45483
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     1
setup
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     2
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     3
  $ cat >> $HGRCPATH <<EOF
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     4
  > [extensions]
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     5
  > share =
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     6
  > [format]
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     7
  > exp-share-safe = True
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     8
  > EOF
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     9
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    10
prepare source repo
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    11
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    12
  $ hg init source
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    13
  $ cd source
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    14
  $ cat .hg/requires
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    15
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    16
  $ cat .hg/store/requires
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    17
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    18
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    19
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    20
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    21
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    22
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    23
  $ hg debugrequirements
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    24
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    25
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    26
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    27
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    28
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    29
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    30
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    31
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    32
  $ echo a > a
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    33
  $ hg ci -Aqm "added a"
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    34
  $ echo b > b
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    35
  $ hg ci -Aqm "added b"
45486
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    36
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    37
  $ HGEDITOR=cat hg config --shared
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    38
  abort: repository is not shared; can't use --shared
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    39
  [255]
45483
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    40
  $ cd ..
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    41
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    42
Create a shared repo and check the requirements are shared and read correctly
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    43
  $ hg share source shared1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    44
  updating working directory
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    45
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    46
  $ cd shared1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    47
  $ cat .hg/requires
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    48
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    49
  shared
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    50
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    51
  $ hg debugrequirements -R ../source
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    52
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    53
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    54
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    55
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    56
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    57
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    58
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    59
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    60
  $ hg debugrequirements
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    61
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    62
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    63
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    64
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    65
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    66
  shared
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    67
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    68
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    69
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    70
  $ echo c > c
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    71
  $ hg ci -Aqm "added c"
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    72
45485
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    73
Check that config of the source repository is also loaded
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    74
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    75
  $ hg showconfig ui.curses
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    76
  [1]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    77
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    78
  $ echo "[ui]" >> ../source/.hg/hgrc
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    79
  $ echo "curses=true" >> ../source/.hg/hgrc
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    80
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    81
  $ hg showconfig ui.curses
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    82
  true
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    83
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    84
However, local .hg/hgrc should override the config set by share source
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    85
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    86
  $ echo "[ui]" >> .hg/hgrc
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    87
  $ echo "curses=false" >> .hg/hgrc
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    88
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    89
  $ hg showconfig ui.curses
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    90
  false
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    91
45486
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    92
  $ HGEDITOR=cat hg config --shared
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    93
  [ui]
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    94
  curses=true
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    95
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    96
  $ HGEDITOR=cat hg config --local
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    97
  [ui]
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    98
  curses=false
ac7a3da0dbb6 config: add `--shared` flag to edit config file of shared source
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45485
diff changeset
    99
45485
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   100
Testing that hooks set in source repository also runs in shared repo
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   101
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   102
  $ cd ../source
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   103
  $ cat <<EOF >> .hg/hgrc
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   104
  > [extensions]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   105
  > hooklib=
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   106
  > [hooks]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   107
  > pretxnchangegroup.reject_merge_commits = \
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   108
  >   python:hgext.hooklib.reject_merge_commits.hook
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   109
  > EOF
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   110
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   111
  $ cd ..
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   112
  $ hg clone source cloned
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   113
  updating to branch default
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   114
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   115
  $ cd cloned
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   116
  $ hg up 0
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   117
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   118
  $ echo bar > bar
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   119
  $ hg ci -Aqm "added bar"
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   120
  $ hg merge
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   121
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   122
  (branch merge, don't forget to commit)
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   123
  $ hg ci -m "merge commit"
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   124
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   125
  $ hg push ../source
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   126
  pushing to ../source
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   127
  searching for changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   128
  adding changesets
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   129
  adding manifests
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   130
  adding file changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   131
  error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   132
  transaction abort!
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   133
  rollback completed
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   134
  abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   135
  [255]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   136
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   137
  $ hg push ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   138
  pushing to ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   139
  searching for changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   140
  adding changesets
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   141
  adding manifests
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   142
  adding file changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   143
  error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   144
  transaction abort!
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   145
  rollback completed
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   146
  abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   147
  [255]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   148
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   149
Test that if share source config is untrusted, we dont read it
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   150
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   151
  $ cd ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   152
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   153
  $ cat << EOF > $TESTTMP/untrusted.py
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   154
  > from mercurial import scmutil, util
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   155
  > def uisetup(ui):
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   156
  >     class untrustedui(ui.__class__):
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   157
  >         def _trusted(self, fp, f):
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   158
  >             if util.normpath(fp.name).endswith(b'source/.hg/hgrc'):
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   159
  >                 return False
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   160
  >             return super(untrustedui, self)._trusted(fp, f)
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   161
  >     ui.__class__ = untrustedui
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   162
  > EOF
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   163
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   164
  $ hg showconfig hooks
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   165
  hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   166
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   167
  $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   168
  [1]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   169
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   170
Unsharing works
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   171
45483
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   172
  $ hg unshare
45485
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   173
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   174
Test that source config is added to the shared one after unshare, and the config
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   175
of current repo is still respected over the config which came from source config
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   176
  $ cd ../cloned
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   177
  $ hg push ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   178
  pushing to ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   179
  searching for changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   180
  adding changesets
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   181
  adding manifests
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   182
  adding file changes
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   183
  error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   184
  transaction abort!
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   185
  rollback completed
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   186
  abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   187
  [255]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   188
  $ hg showconfig ui.curses -R ../shared1
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   189
  false