Patchwork [evolve-ext] evolve: switch away from deprecated repo.opener

login
register
mail settings
Submitter via Mercurial-devel
Date March 7, 2017, 5:47 p.m.
Message ID <5cf7a405f0e5c089a6da.1488908865@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/18966/
State Accepted
Headers show

Comments

via Mercurial-devel - March 7, 2017, 5:47 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1488908857 28800
#      Tue Mar 07 09:47:37 2017 -0800
# Node ID 5cf7a405f0e5c089a6da86583eed7c3f99c4ccde
# Parent  a4b09789117a64e4672ba6a2626bbaf965476e91
evolve: switch away from deprecated repo.opener
Pierre-Yves David - March 7, 2017, 11:44 p.m.
On 03/07/2017 06:47 PM, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1488908857 28800
> #      Tue Mar 07 09:47:37 2017 -0800
> # Node ID 5cf7a405f0e5c089a6da86583eed7c3f99c4ccde
> # Parent  a4b09789117a64e4672ba6a2626bbaf965476e91
> evolve: switch away from deprecated repo.opener

Pushed, thanks :-)

Patch

diff -r a4b09789117a -r 5cf7a405f0e5 hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Thu Mar 02 20:13:47 2017 +0100
+++ b/hgext3rd/evolve/__init__.py	Tue Mar 07 09:47:37 2017 -0800
@@ -1735,7 +1735,7 @@ 
         # XXX This is a terrible terrible hack, please get rid of it.
         lock = repo.wlock()
         try:
-            repo.opener.write('graftstate', orig.hex() + '\n')
+            repo.vfs.write('graftstate', orig.hex() + '\n')
             try:
                 graftcmd = commands.table['graft'][0]
                 ret = graftcmd(ui, repo, old_obsolete=True, **{'continue': True})
@@ -1949,7 +1949,7 @@ 
                 tmpctx = repo[tmpid]
                 obsolete.createmarkers(repo, [(bumped, (tmpctx,))])
         except MergeFailure:
-            repo.opener.write('graftstate', bumped.hex() + '\n')
+            repo.vfs.write('graftstate', bumped.hex() + '\n')
             repo.ui.write_err(_('evolution failed!\n'))
             msg = _("fix conflict and run 'hg evolve --continue'\n")
             repo.ui.write_err(msg)
@@ -3267,7 +3267,7 @@ 
         lock = repo.lock()
         if kwargs.get('old_obsolete'):
             if kwargs.get('continue'):
-                obsoleted.extend(repo.opener.read('graftstate').splitlines())
+                obsoleted.extend(repo.vfs.read('graftstate').splitlines())
             else:
                 obsoleted.extend(revs)
         # convert obsolete target into revs to avoid alias joke
diff -r a4b09789117a -r 5cf7a405f0e5 hgext3rd/evolve/legacy.py
--- a/hgext3rd/evolve/legacy.py	Thu Mar 02 20:13:47 2017 +0100
+++ b/hgext3rd/evolve/legacy.py	Tue Mar 07 09:47:37 2017 -0800
@@ -51,7 +51,7 @@ 
         if 'debugc' in arg:
             break
     else:
-        data = repo.opener.tryread('obsolete-relations')
+        data = repo.vfs.tryread('obsolete-relations')
         if not data:
             data = repo.svfs.tryread('obsoletemarkers')
         if data:
@@ -90,7 +90,7 @@ 
             store = repo.obsstore
             ### very first format
             try:
-                f = repo.opener('obsolete-relations')
+                f = repo.vfs('obsolete-relations')
                 try:
                     some = True
                     for line in f: