Commits

Yuya Nishihara committed 79dd159

tests: add basic tests for hgrcd.py hook

Comments (0)

Files changed (2)

 \.py[co]$
 ~$
+^tests/[\w\-.]+\.err$

tests/test-hgrcd.t

+Tests for hgrcd hook
+
+  $ mkdir repos
+  $ hg init hgrc.d
+  $ cat <<EOT > hgrc.d/.hg/hgrc
+  > [hooks]
+  > changegroup.hgrcd = python:$TESTDIR/../hgrcd.py:hook
+  > [hgrcd]
+  > targetdir = $TESTTMP/repos
+  > createrepo = true
+  > deleterepo = bundle
+  > EOT
+
+  $ hg clone hgrc.d myhgrc.d
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd myhgrc.d
+
+new repository:
+
+  $ touch foo.hgrc
+  $ hg ci -Am 'add foo'
+  adding foo.hgrc
+  $ hg push
+  pushing to $TESTTMP/hgrc.d
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  hgrcd: creating $TESTTMP/repos/foo
+  $ hg id ../repos/foo
+  000000000000 tip
+  $ readlink ../repos/foo/.hg/hgrc
+  ../../../hgrc.d/foo.hgrc
+
+bundle removed repository:
+
+  $ touch ../repos/foo/bar
+  $ hg ci -R ../repos/foo -Am 'add bar'
+  adding bar
+
+  $ hg rm foo.hgrc
+  $ hg ci -m 'remove foo'
+  $ hg push
+  pushing to $TESTTMP/hgrc.d
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  hgrcd: deleting $TESTTMP/repos/foo
+  1 changesets found
+  $ ls ../repos
+  foo.hg~