view tests/test-convert-bzr-ghosts.t @ 41704:3b0ba4575c8c

exchange: raise error.Abort instead of ValueError Raising ValueError results in an uncaught exception and a traceback being printed. In the context of servers, it can result in an HTTP 500 and an exception being logged in the error log. I don't think this is proper behavior. The bundle2 code paths have a mechanism for translating an error.Abort into an error message reported to the clients. I think we should use that instead. This commit replaces some ValueError with Abort so that servers can error more gracefully. Differential Revision: https://phab.mercurial-scm.org/D5972
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 15 Feb 2019 11:31:17 -0800
parents 5abc47d4ca6b
children 26127236b229
line wrap: on
line source

#require bzr

  $ . "$TESTDIR/bzr-definitions"
  $ cat > ghostcreator.py <<EOF
  > import sys
  > from bzrlib import workingtree
  > wt = workingtree.WorkingTree.open('.')
  > 
  > message, ghostrev = sys.argv[1:]
  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev])
  > wt.commit(message)
  > EOF

ghost revisions

  $ mkdir test-ghost-revisions
  $ cd test-ghost-revisions
  $ bzr init -q source
  $ cd source
  $ echo content > somefile
  $ bzr add -q somefile
  $ bzr commit -q -m 'Initial layout setup'
  $ echo morecontent >> somefile
  $ "$PYTHON" ../../ghostcreator.py 'Commit with ghost revision' ghostrev
  $ cd ..
  $ hg convert source source-hg
  initializing destination source-hg repository
  scanning source...
  sorting...
  converting...
  1 Initial layout setup
  0 Commit with ghost revision
  $ glog -R source-hg
  o  1@source "Commit with ghost revision" files+: [], files-: [], files: [somefile]
  |
  o  0@source "Initial layout setup" files+: [somefile], files-: [], files: []
  

  $ cd ..