mercurial/cmdutil.py
changeset 38493 da2a7d8354b2
parent 38461 8459e8d2f729
child 38539 b1bbff1dd99a
--- a/mercurial/cmdutil.py	Thu Jun 28 21:24:47 2018 +0530
+++ b/mercurial/cmdutil.py	Thu Jun 28 18:07:22 2018 -0700
@@ -1242,7 +1242,8 @@
                              dryrun=dryrun, cwd=cwd)
         if rename and not dryrun:
             if not after and srcexists and not samefile:
-                repo.wvfs.unlinkpath(abssrc)
+                rmdir = repo.ui.configbool('experimental', 'removeemptydirs')
+                repo.wvfs.unlinkpath(abssrc, rmdir=rmdir)
             wctx.forget([abssrc])
 
     # pat: ossep
@@ -2269,7 +2270,9 @@
                 for f in list:
                     if f in added:
                         continue # we never unlink added files on remove
-                    repo.wvfs.unlinkpath(f, ignoremissing=True)
+                    rmdir = repo.ui.configbool('experimental',
+                                               'removeemptydirs')
+                    repo.wvfs.unlinkpath(f, ignoremissing=True, rmdir=rmdir)
             repo[None].forget(list)
 
     if warn:
@@ -3029,7 +3032,8 @@
 
     def doremove(f):
         try:
-            repo.wvfs.unlinkpath(f)
+            rmdir = repo.ui.configbool('experimental', 'removeemptydirs')
+            repo.wvfs.unlinkpath(f, rmdir=rmdir)
         except OSError:
             pass
         repo.dirstate.remove(f)