Patchwork [2,of,3] update: add tests for untracked local file

login
register
mail settings
Submitter Martin von Zweigbergk
Date Dec. 3, 2014, 1:42 a.m.
Message ID <580066d004512f5fabbf.1417570975@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6966/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Dec. 3, 2014, 1:42 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1417569061 28800
#      Tue Dec 02 17:11:01 2014 -0800
# Node ID 580066d004512f5fabbf83d1a47d09af1546edd5
# Parent  530ec01e5ec31acd0e147756a8f6797847c186c9
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.

Patch

diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -167,6 +167,39 @@ 
   (commit and merge, or update --clean to discard changes)
   [255]
 
+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 ..