guestrepo / tests / test-summary.t

The default branch has multiple heads

# Guestrepo: A Mercurial Extension for the managing of components
# Copyright (C) 2012   Schweitzer Engineering Laboratories, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# Contact information:


# Schweitzer Engineering Laboratories, Inc.
# 2350 NE Hopkins Court
# Pullman, WA 99163 - USA

  $ TESTDIR=`pwd`

Make a host and guest repo
  $ hg init gr
  $ cd gr
  $ echo c0 > f
  $ hg add f
  $ hg commit -m 0

  $ cd $TESTDIR
  $ hg init host
  $ cd host
  $ echo mygr = mygr-name default >> .hgguestrepo
  $ echo mygr-name = `readlink -f -n ../gr` >> .hggrmapping
  $ hg add .hgguestrepo .hggrmapping
  $ hg commit -m 0

Sync and test summary
  $ hg grupdate
  cloning mygr
  updating to branch default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved

  $ hg grsummary
  mygr (default) tip

Add some bookmarks
  $ hg bookmark mark -R $TESTDIR/host/mygr
  $ hg bookmark currentmark -R $TESTDIR/host/mygr
  $ hg grsummary
  mygr (default) tip currentmark/mark *currentmark

Make a change
  $ echo c1 > $TESTDIR/host/mygr/f
  $ hg grsummary
  mygr (default) tip currentmark/mark *currentmark *

Validate -i option
  $ ID=$(echo  $(hg -R mygr id -i) | sed -r -e 's/\+$//')
  $ SUMMARY=$(hg grsummary -i)
  $ EXPECTED="mygr (default) $ID tip currentmark/mark *currentmark *"
  $ bash -c "[ \"$EXPECTED\"  == \"$SUMMARY\" ]"