view tests/test-topic-shell-prompt.t @ 5568:7f8055eb07c7

compat: add implementations of new merge.update() and merge.clean_update() This adds `compat.update()`, `compat.clean_update()`, which will delegate to the same functions from `mercurial.merge` when they are available, or fall back to calling `hg.updaterepo()` when they're not.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 02 Oct 2020 10:09:14 -0700
parents ce5ebd9c859b
children
line wrap: on
line source

  $ . $TESTDIR/testlib/topic_setup.sh

Code logically equivalent to the following is used in Zsh to show the branch
and topic (if set) in the prompt. If the format of the files is changed in a
way that it breaks the test, a mail should be sent to zsh-workers@zsh.org.

  $ get_branch_like_zsh() {
  >     branchfile=".hg/branch"
  >     topicfile=".hg/topic"
  >     if [ -r "${branchfile}" ] ; then
  >         r_branch=$(cat "${branchfile}")
  >     fi
  >     if [ -f "${topicfile}" ] && [ -r "${topicfile}" ] && [ -s "${topicfile}" ] ; then
  >         IFS= read -r REPLY < ${topicfile}
  >         r_branch=${r_branch}:${REPLY}
  >     fi
  >     echo $r_branch
  > }

  $ hg init
  $ hg branch branch -q
  $ get_branch_like_zsh
  branch
  $ hg topic topic -q
  $ get_branch_like_zsh
  branch:topic
  $ hg topic --clear -q
  $ get_branch_like_zsh
  branch