view tests/test-share-safe.t @ 45483:d252f51ab032

share: introduce config option to store requires in .hg/store This introduces a config option which enabled stores the requirements on a repository in store instead. When enabled, `.hg/requires` will contain the `share-safe` requirement which marks that the requirements are present in the store. This is done so that repository requirements can be shared with shares made using `hg share` command. After this patch, `hg share` checks whether the source repository has share-safe requirement, if yes, it does not copy the requirements. Test for the new functionality is added and a test case in exitsing share tests is also added. Differential Revision: https://phab.mercurial-scm.org/D8633
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 14 Apr 2020 21:07:09 +0530
parents
children b71858b42963
line wrap: on
line source

setup

  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > share =
  > [format]
  > exp-share-safe = True
  > EOF

prepare source repo

  $ hg init source
  $ cd source
  $ cat .hg/requires
  exp-sharesafe
  $ cat .hg/store/requires
  dotencode
  fncache
  generaldelta
  revlogv1
  sparserevlog
  store
  $ hg debugrequirements
  dotencode
  exp-sharesafe
  fncache
  generaldelta
  revlogv1
  sparserevlog
  store

  $ echo a > a
  $ hg ci -Aqm "added a"
  $ echo b > b
  $ hg ci -Aqm "added b"
  $ cd ..

Create a shared repo and check the requirements are shared and read correctly
  $ hg share source shared1
  updating working directory
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ cd shared1
  $ cat .hg/requires
  exp-sharesafe
  shared

  $ hg debugrequirements -R ../source
  dotencode
  exp-sharesafe
  fncache
  generaldelta
  revlogv1
  sparserevlog
  store

  $ hg debugrequirements
  dotencode
  exp-sharesafe
  fncache
  generaldelta
  revlogv1
  shared
  sparserevlog
  store

  $ echo c > c
  $ hg ci -Aqm "added c"

  $ hg unshare