Patchwork [stable] convert: update use of deprecated bzrlib property

login
register
mail settings
Submitter Kevin Bullock
Date July 19, 2016, 4:16 p.m.
Message ID <a5c7375e0221a5499b38.1468944974@billings.local>
Download mbox | patch
Permalink /patch/15956/
State Accepted
Headers show

Comments

Kevin Bullock - July 19, 2016, 4:16 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock+mercurial@ringworld.org>
# Date 1468944032 18000
#      Tue Jul 19 11:00:32 2016 -0500
# Branch stable
# Node ID a5c7375e0221a5499b38638b1c6ab72f853f287b
# Parent  754f6367122953efdc7b5539a53c99308ee90216
convert: update use of deprecated bzrlib property

The inventory property was deprecated in favor of root_inventory in bzr
2.5.0. Current version is 2.7.0.

I noticed this when testing locally on Python 2.6.9, which has warnings
turned on by default. The failure that occurs without this patch can be
seen on Python 2.7 by running with warnings enabled:

     $ PYTHONWARNINGS=::DeprecationWarning make 'test-convert-bzr*'
Anton Shestakov - July 19, 2016, 4:59 p.m.
20.07.2016, 00:16, "Kevin Bullock" <kbullock+mercurial@ringworld.org>:
> # HG changeset patch
> # User Kevin Bullock <kbullock+mercurial@ringworld.org>
> # Date 1468944032 18000
> # Tue Jul 19 11:00:32 2016 -0500
> # Branch stable
> # Node ID a5c7375e0221a5499b38638b1c6ab72f853f287b
> # Parent 754f6367122953efdc7b5539a53c99308ee90216
> convert: update use of deprecated bzrlib property

LGTM, warnings are gone.
Matt Mackall - July 19, 2016, 5:56 p.m.
On Tue, 2016-07-19 at 11:16 -0500, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock+mercurial@ringworld.org>
> # Date 1468944032 18000
> #      Tue Jul 19 11:00:32 2016 -0500
> # Branch stable
> # Node ID a5c7375e0221a5499b38638b1c6ab72f853f287b
> # Parent  754f6367122953efdc7b5539a53c99308ee90216
> convert: update use of deprecated bzrlib property
> 
> The inventory property was deprecated in favor of root_inventory in bzr
> 2.5.0. Current version is 2.7.0.
> 
> I noticed this when testing locally on Python 2.6.9, which has warnings
> turned on by default. The failure that occurs without this patch can be
> seen on Python 2.7 by running with warnings enabled:

Queued after fixing a long line, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/hgext/convert/bzr.py b/hgext/convert/bzr.py
--- a/hgext/convert/bzr.py
+++ b/hgext/convert/bzr.py
@@ -228,9 +228,9 @@  class bzr_source(common.converter_source
                     renaming = paths[0] != paths[1]
                     # neither an add nor an delete - a move
                     # rename all directory contents manually
-                    subdir = origin.inventory.path2id(paths[0])
+                    subdir = origin.root_inventory.path2id(paths[0])
                     # get all child-entries of the directory
-                    for name, entry in origin.inventory.iter_entries(subdir):
+                    for name, entry in origin.root_inventory.iter_entries(subdir):
                         # hg does not track directory renames
                         if entry.kind == 'directory':
                             continue