Patchwork [4,of,5] test-simple-update: add test for -d DATE option

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 13, 2020, 10:24 a.m.
Message ID <feed6e5c69c48b703c9c.1599992654@mimosa>
Download mbox | patch
Permalink /patch/47151/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 13, 2020, 10:24 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1599988491 -32400
#      Sun Sep 13 18:14:51 2020 +0900
# Node ID feed6e5c69c48b703c9cc3eba48180363ae6ce30
# Parent  56d4b0b87912f6b3b53f339c23bf79f586765dd7
test-simple-update: add test for -d DATE option

I couldn't find any tests for cmdutil.finddate() except for the abort case.

Patch

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -19,7 +19,7 @@ 
   $ hg co
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo bar>>foo
-  $ hg commit -m "2"
+  $ hg commit -m "2" -d '1 0'
 
   $ cd ../test
 
@@ -30,7 +30,7 @@ 
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
-  new changesets 30aff43faee1
+  new changesets 84b9316f7b31
   1 local changesets published
   (run 'hg update' to get a working copy)
 
@@ -57,25 +57,47 @@  update to rev 0 with a date
   abort: you can't specify a revision and a date
   [255]
 
+update by date
+
+  $ hg update -d '<1970-01-01 00:00:02 +0000'
+  found revision 1 from Thu Jan 01 00:00:01 1970 +0000
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg update -d '<1970-01-01 00:00:01 +0000'
+  found revision 1 from Thu Jan 01 00:00:01 1970 +0000
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg update -d '<1970-01-01 00:00:00 +0000'
+  found revision 0 from Thu Jan 01 00:00:00 1970 +0000
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg update -d '>1970-01-01 00:00:02 +0000'
+  abort: revision matching date not found
+  [255]
+  $ hg update -d '>1970-01-01 00:00:01 +0000'
+  found revision 1 from Thu Jan 01 00:00:01 1970 +0000
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg update -d '>1970-01-01 00:00:00 +0000'
+  found revision 1 from Thu Jan 01 00:00:01 1970 +0000
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 update to default destination (with empty revspec)
 
   $ hg update -q null
   $ hg update
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id
-  30aff43faee1 tip
+  84b9316f7b31 tip
 
   $ hg update -q null
   $ hg update -r ''
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id
-  30aff43faee1 tip
+  84b9316f7b31 tip
 
   $ hg update -q null
   $ hg update ''
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id
-  30aff43faee1 tip
+  84b9316f7b31 tip
 
   $ cd ..