[PATCH 5 of 6 misc] shelve: introduce secret option for using fixed date for temporary commit

Mads Kiilerich mads at kiilerich.com
Mon Apr 7 21:11:37 UTC 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1396905020 -7200
#      Mon Apr 07 23:10:20 2014 +0200
# Node ID 133a99eb8d0aef2c1f2a9cb69ea14f09985639b9
# Parent  645cf5d94000e9bd69a291a611edc372a6ae527c
shelve: introduce secret option for using fixed date for temporary commit

Using a fixed date makes hashes stable and makes debugging simpler. The date
and hashes of this changeset are normally not exposed.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -458,7 +458,9 @@ def unshelvecontinue(ui, repo, state, op
           ('c', 'continue', None,
            _('continue an incomplete unshelve operation')),
           ('', 'keep', None,
-           _('keep shelve after unshelving'))],
+           _('keep shelve after unshelving')),
+          ('', 'date', '',
+           _('set date for temporary commits (DEPRECATED)'), _('DATE'))],
          _('hg unshelve [SHELVED]'))
 def unshelve(ui, repo, *shelved, **opts):
     """restore a shelved change to the working directory
@@ -553,6 +555,7 @@ def unshelve(ui, repo, *shelved, **opts)
 
             tempopts = {}
             tempopts['message'] = "pending changes temporary commit"
+            tempopts['date'] = opts.get('date')
             ui.quiet = True
             node = cmdutil.commit(ui, repo, commitfunc, [], tempopts)
             tmpwctx = repo[node]
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -577,7 +577,7 @@ unshelve and conflicts with untracked fi
   
   $ mv f.orig f
   $ echo other change >> a
-  $ hg unshelve
+  $ hg unshelve --date '1073741824 0'
   unshelving change 'default'
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
@@ -586,16 +586,16 @@ unshelve and conflicts with untracked fi
   merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
   [1]
-  $ hg log -G --template '{rev}  {desc|firstline}  {author}'
-  @  5  changes to 'commit stuff'  shelve at localhost
+  $ hg log -G --template '{rev}  {desc|firstline}  {author}  {date|isodate}'
+  @  5  changes to 'commit stuff'  shelve at localhost  1970-01-01 00:00 +0000
   |
-  | @  4  pending changes temporary commit  shelve at localhost
+  | @  4  pending changes temporary commit  shelve at localhost  2004-01-10 13:37 +0000
   |/
-  o  3  commit stuff  test
+  o  3  commit stuff  test  1970-01-01 00:00 +0000
   |
-  | o  2  c  test
+  | o  2  c  test  1970-01-01 00:00 +0000
   |/
-  o  0  a  test
+  o  0  a  test  1970-01-01 00:00 +0000
   
   $ hg st
   M f



More information about the Mercurial-devel mailing list