Patchwork [3,of,6,v2] convert: remove incorrect and unused handling of removed svn directories

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 26, 2014, 8:04 p.m.
Message ID <89a3f792fdfa7d31abc2.1409083443@mk-desktop>
Download mbox | patch
Permalink /patch/5603/
State Accepted
Headers show

Comments

Mads Kiilerich - Aug. 26, 2014, 8:04 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1409083412 -7200
#      Tue Aug 26 22:03:32 2014 +0200
# Node ID 89a3f792fdfa7d31abc218f327e70a92c6565240
# Parent  7aef70dd18a9fa570ca15038d3955b2362b98fe1
convert: remove incorrect and unused handling of removed svn directories

Since it was introduced in f0c58fd4b798, tidy_dirs has been comparing the
result of os.listdir with a string - which never can be true. Convert do
apparently work anyway and there is no test coverage of it.

It also seems like it could make a bigger difference on older svn versions but
is less relevant with more recent versions.

Instead of trying to fix the code, we take the low risk option and remove it.

Patch

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1211,16 +1211,6 @@  class svn_sink(converter_sink, commandli
             self.xargs(files, 'add', quiet=True)
         return files
 
-    def tidy_dirs(self, names):
-        deleted = []
-        for d in sorted(self.dirs_of(names), reverse=True):
-            wd = self.wjoin(d)
-            if os.listdir(wd) == '.svn':
-                self.run0('delete', d)
-                self.manifest.remove(d)
-                deleted.append(d)
-        return deleted
-
     def addchild(self, parent, child):
         self.childmap[parent] = child
 
@@ -1258,7 +1248,6 @@  class svn_sink(converter_sink, commandli
                 self.manifest.remove(f)
             self.delete = []
         entries.update(self.add_files(files.difference(entries)))
-        entries.update(self.tidy_dirs(entries))
         if self.delexec:
             self.xargs(self.delexec, 'propdel', 'svn:executable')
             self.delexec = []