changeset 20960:8e5b21ce8ee9

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.
author Mads Kiilerich <madski@unity3d.com>
date Mon, 07 Apr 2014 23:10:20 +0200
parents b6e0616d08cb
children 6c40ea34ecc1
files hgext/shelve.py tests/test-shelve.t
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Mon Apr 07 23:10:20 2014 +0200
+++ b/hgext/shelve.py	Mon Apr 07 23:10:20 2014 +0200
@@ -458,7 +458,9 @@
           ('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 @@
 
             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]
--- a/tests/test-shelve.t	Mon Apr 07 23:10:20 2014 +0200
+++ b/tests/test-shelve.t	Mon Apr 07 23:10:20 2014 +0200
@@ -577,7 +577,7 @@
   
   $ 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 @@
   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@localhost
+  $ hg log -G --template '{rev}  {desc|firstline}  {author}  {date|isodate}'
+  @  5  changes to 'commit stuff'  shelve@localhost  1970-01-01 00:00 +0000
   |
-  | @  4  pending changes temporary commit  shelve@localhost
+  | @  4  pending changes temporary commit  shelve@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