Patchwork deprecation: enforce thew 'tr' argument of 'dirstate.write'

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 2, 2016, 3:10 p.m.
Message ID <9241cf0c635bb60b7f5f.1470150619@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16039/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 2, 2016, 3:10 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1470149487 -7200
#      Tue Aug 02 16:51:27 2016 +0200
# Node ID 9241cf0c635bb60b7f5fbb85de1dbaf6e7b57c95
# Parent  bdc81970853df8bdf0f470095af334d5b51b2ba6
# EXP-Topic deprecation
deprecation: enforce thew 'tr' argument of 'dirstate.write'

Compatibility was meant to be drop after 3.9 is released.
Yuya Nishihara - Aug. 3, 2016, 1:01 p.m.
On Tue, 02 Aug 2016 17:10:19 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1470149487 -7200
> #      Tue Aug 02 16:51:27 2016 +0200
> # Node ID 9241cf0c635bb60b7f5fbb85de1dbaf6e7b57c95
> # Parent  bdc81970853df8bdf0f470095af334d5b51b2ba6
> # EXP-Topic deprecation
> deprecation: enforce thew 'tr' argument of 'dirstate.write'
> 
> Compatibility was meant to be drop after 3.9 is released.

LGTM, queued, thanks. Should we mark this kind of deprecation as (API) ?
Pierre-Yves David - Aug. 3, 2016, 1:07 p.m.
On 08/03/2016 03:01 PM, Yuya Nishihara wrote:
> On Tue, 02 Aug 2016 17:10:19 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1470149487 -7200
>> #      Tue Aug 02 16:51:27 2016 +0200
>> # Node ID 9241cf0c635bb60b7f5fbb85de1dbaf6e7b57c95
>> # Parent  bdc81970853df8bdf0f470095af334d5b51b2ba6
>> # EXP-Topic deprecation
>> deprecation: enforce thew 'tr' argument of 'dirstate.write'
>>
>> Compatibility was meant to be drop after 3.9 is released.
>
> LGTM, queued, thanks. Should we mark this kind of deprecation as (API) ?

Hum good, point, we should tag them a (API) both at deprecation and 
removal time. Can you fix it in flight?

Cheers.
Yuya Nishihara - Aug. 3, 2016, 1:18 p.m.
On Wed, 3 Aug 2016 15:07:24 +0200, Pierre-Yves David wrote:
> On 08/03/2016 03:01 PM, Yuya Nishihara wrote:
> > On Tue, 02 Aug 2016 17:10:19 +0200, Pierre-Yves David wrote:
> >> # HG changeset patch
> >> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> >> # Date 1470149487 -7200
> >> #      Tue Aug 02 16:51:27 2016 +0200
> >> # Node ID 9241cf0c635bb60b7f5fbb85de1dbaf6e7b57c95
> >> # Parent  bdc81970853df8bdf0f470095af334d5b51b2ba6
> >> # EXP-Topic deprecation
> >> deprecation: enforce thew 'tr' argument of 'dirstate.write'
> >>
> >> Compatibility was meant to be drop after 3.9 is released.
> >
> > LGTM, queued, thanks. Should we mark this kind of deprecation as (API) ?
> 
> Hum good, point, we should tag them a (API) both at deprecation and 
> removal time. Can you fix it in flight?

Marked as an API change and pushed.

Patch

diff -r bdc81970853d -r 9241cf0c635b mercurial/dirstate.py
--- a/mercurial/dirstate.py	Sat Jul 23 13:08:43 2016 +0900
+++ b/mercurial/dirstate.py	Tue Aug 02 16:51:27 2016 +0200
@@ -74,8 +74,6 @@  def _trypending(root, vfs, filename):
                 raise
     return (vfs(filename), False)
 
-_token = object()
-
 class dirstate(object):
 
     def __init__(self, opener, ui, root, validate):
@@ -692,22 +690,12 @@  class dirstate(object):
         self._pl = (parent, nullid)
         self._dirty = True
 
-    def write(self, tr=_token):
+    def write(self, tr):
         if not self._dirty:
             return
 
         filename = self._filename
-        if tr is _token: # not explicitly specified
-            self._ui.deprecwarn('use dirstate.write with '
-                               'repo.currenttransaction()',
-                               '3.9')
-
-            if self._opener.lexists(self._pendingfilename):
-                # if pending file already exists, in-memory changes
-                # should be written into it, because it has priority
-                # to '.hg/dirstate' at reading under HG_PENDING mode
-                filename = self._pendingfilename
-        elif tr:
+        if tr:
             # 'dirstate.write()' is not only for writing in-memory
             # changes out, but also for dropping ambiguous timestamp.
             # delayed writing re-raise "ambiguous timestamp issue".