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

login
register
mail settings
Submitter Mads Kiilerich
Date April 7, 2014, 9:11 p.m.
Message ID <133a99eb8d0aef2c1f2a.1396905097@mk-desktop>
Download mbox | patch
Permalink /patch/4250/
State Accepted
Commit 8e5b21ce8ee94222fc2e2f90e183f6ff6b9d141e
Headers show

Comments

Mads Kiilerich - April 7, 2014, 9:11 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.
Mads Kiilerich - April 7, 2014, 9:14 p.m.
On 04/07/2014 11:11 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@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

- now passing the date as suggested on 
http://markmail.org/thread/ku5lqbgeumfhjrge#query:+page:1+mid:eslanjqyxlkzs7kn+state:results

/Mads
Sean Farley - April 7, 2014, 9:31 p.m.
Mads Kiilerich <mads@kiilerich.com> writes:

> On 04/07/2014 11:11 PM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@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
>
> - now passing the date as suggested on 
> http://markmail.org/thread/ku5lqbgeumfhjrge#query:+page:1+mid:eslanjqyxlkzs7kn+state:results

Awesome!

Patch

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@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