tests/test-import-unknown.t
author Mads Kiilerich <mads@kiilerich.com>
Thu, 04 Aug 2011 02:51:29 +0200
branchstable
changeset 15018 e89f62dcd723
parent 14453 ea3d548132cc
child 16913 f2719b387380
permissions -rw-r--r--
url: really handle urls of the form file:///c:/foo/bar/ correctly 28edd65000d9 made sure that paths that seemed to start with a windows drive letter would not get an extra leading slash. localpath should thus not try to handle this case by removing a leading slash, and this special handling is thus removed. (The localpath handling of this case was wrong anyway, because paths that look like they start with a windows drive letter can't have a leading slash.) A quick verification of this is to run 'hg id file:///c:/foo/bar/'.

  $ cat <<EOF >> $HGRCPATH
  > [extensions]
  > purge =
  > EOF

  $ hg init test
  $ cd test
  $ echo a > changed
  $ echo a > removed
  $ echo a > source
  $ hg ci -Am addfiles
  adding changed
  adding removed
  adding source
  $ echo a >> changed
  $ echo a > added
  $ hg add added
  $ hg rm removed
  $ hg cp source copied
  $ hg diff --git > ../unknown.diff

Test adding on top of an unknown file

  $ hg up -qC 0
  $ hg purge
  $ echo a > added
  $ hg import --no-commit ../unknown.diff
  applying ../unknown.diff
  file added already exists
  1 out of 1 hunks FAILED -- saving rejects to file added.rej
  abort: patch failed to apply
  [255]

Test modifying an unknown file

  $ hg revert -aq
  $ hg purge
  $ hg rm changed
  $ hg ci -m removechanged
  $ echo a > changed
  $ hg import --no-commit ../unknown.diff
  applying ../unknown.diff
  abort: cannot patch changed: file is not tracked
  [255]

Test removing an unknown file

  $ hg up -qC 0
  $ hg purge
  $ hg rm removed
  $ hg ci -m removeremoved
  created new head
  $ echo a > removed
  $ hg import --no-commit ../unknown.diff
  applying ../unknown.diff
  abort: cannot patch removed: file is not tracked
  [255]

Test copying onto an unknown file

  $ hg up -qC 0
  $ hg purge
  $ echo a > copied
  $ hg import --no-commit ../unknown.diff
  applying ../unknown.diff
  abort: cannot create copied: destination already exists
  [255]