tests/test-share-safe.t
author Pulkit Goyal <7895pulkit@gmail.com>
Thu, 02 Jul 2020 16:23:36 +0530
changeset 45485 b71858b42963
parent 45483 d252f51ab032
child 45486 ac7a3da0dbb6
permissions -rw-r--r--
localrepo: load the share source .hg/hgrc also in share-safe mode (API) The second part of the Share Safe Plan is to share source repo config also. This patch adds logic to load the source repo .hg/hgrc if we are in share safe mode. On unshare, we copy and prepend source config to current repo so that config which was shared is persisted. A test is added to show that now if we enable a hook on the source repo, that also runs on the shared repositories. API change as a new optional argument sharedvfs added to localrepo.loadhgrc() Differential Revision: https://phab.mercurial-scm.org/D8656
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"
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    36
  $ cd ..
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    37
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    38
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
    39
  $ hg share source shared1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    40
  updating working directory
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    41
  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
    42
  $ cd shared1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    43
  $ cat .hg/requires
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    44
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    45
  shared
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    46
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    47
  $ hg debugrequirements -R ../source
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    48
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    49
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    50
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    51
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    52
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    53
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    54
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    55
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    56
  $ hg debugrequirements
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    57
  dotencode
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    58
  exp-sharesafe
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    59
  fncache
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    60
  generaldelta
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    61
  revlogv1
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    62
  shared
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    63
  sparserevlog
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    64
  store
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    65
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    66
  $ echo c > c
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    67
  $ hg ci -Aqm "added c"
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    68
45485
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    69
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
    70
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    71
  $ 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
    72
  [1]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    73
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    74
  $ 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
    75
  $ 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
    76
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    77
  $ 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
    78
  true
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    79
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    80
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
    81
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    82
  $ 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
    83
  $ 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
    84
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    85
  $ 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
    86
  false
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    87
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    88
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
    89
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    90
  $ 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
    91
  $ 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
    92
  > [extensions]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    93
  > hooklib=
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    94
  > [hooks]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    95
  > 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
    96
  >   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
    97
  > EOF
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    98
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
    99
  $ cd ..
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   100
  $ 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
   101
  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
   102
  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
   103
  $ 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
   104
  $ 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
   105
  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
   106
  $ 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
   107
  $ 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
   108
  $ 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
   109
  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
   110
  (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
   111
  $ 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
   112
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   113
  $ 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
   114
  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
   115
  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
   116
  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
   117
  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
   118
  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
   119
  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
   120
  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
   121
  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
   122
  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
   123
  [255]
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 ../shared1
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 ../shared1
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
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
   138
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   139
  $ 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
   140
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   141
  $ 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
   142
  > 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
   143
  > 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
   144
  >     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
   145
  >         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
   146
  >             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
   147
  >                 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
   148
  >             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
   149
  >     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
   150
  > EOF
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   151
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   152
  $ 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
   153
  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
   154
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   155
  $ 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
   156
  [1]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   157
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   158
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
   159
45483
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   160
  $ 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
   161
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   162
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
   163
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
   164
  $ 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
   165
  $ 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
   166
  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
   167
  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
   168
  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
   169
  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
   170
  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
   171
  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
   172
  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
   173
  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
   174
  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
   175
  [255]
b71858b42963 localrepo: load the share source .hg/hgrc also in share-safe mode (API)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45483
diff changeset
   176
  $ 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
   177
  false