changeset 23477:689540e6007e stable

update: add tests for untracked local file We don't seem to have any tests for updating to another revision when there are untracked files on the local side that conflict with the those on the remote side, so let's add tests. This shows how we overwrite untracked ignored files when updating to a revision that tracks the file.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 02 Dec 2014 17:11:01 -0800
parents 57d35d3c1cf1
children 30b602168c3b
files tests/test-up-local-change.t
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-up-local-change.t	Tue Dec 02 11:06:38 2014 -0800
+++ b/tests/test-up-local-change.t	Tue Dec 02 17:11:01 2014 -0800
@@ -217,6 +217,39 @@
   +abc
 
 
+test conflicting untracked files
+
+  $ hg up -qC 0
+  $ echo untracked > b
+  $ hg st
+  ? b
+  $ hg up 1
+  b: untracked file differs
+  abort: untracked files in working directory differ from files in requested revision
+  [255]
+  $ rm b
+
+test conflicting untracked ignored file
+
+BROKEN: the ignored file gets overwritten by the remote version
+
+  $ hg up -qC 0
+  $ echo ignored > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m 'add .hgignore'
+  created new head
+  $ echo ignored > ignored
+  $ hg add ignored
+  $ hg ci -m 'add ignored file'
+
+  $ hg up -q 'desc("add .hgignore")'
+  $ echo untracked > ignored
+  $ hg st
+  $ hg up 'desc("add ignored file")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat ignored
+  ignored
+
 test a local add
 
   $ cd ..