Patchwork [2,of,5] convert: remove incorrect and unused handling of removed svn directories

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 25, 2014, 1:23 a.m.
Message ID <77a4e641523da0d07f85.1408929780@localhost.localdomain>
Download mbox | patch
Permalink /patch/5585/
State Superseded
Commit a74d05878a8dc8c4616a51ddb5bfde25a15f9534
Headers show

Comments

Mads Kiilerich - Aug. 25, 2014, 1:23 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1408927601 -7200
#      Mon Aug 25 02:46:41 2014 +0200
# Node ID 77a4e641523da0d07f85ac07366c2b3369371f5e
# Parent  705fb28816fda33dc8be24aa5f658ad5459fdbaf
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 = []