# HG changeset patch # User Martin von Zweigbergk # Date 1432328524 25200 # Node ID 947771ad5174fef25519ffa375dc47667db0c2fc # Parent 56eed3923dbc4994f548f72dda2a61227fc9674d copies: document hack for adding '' to set of dirs The root directory is not normally added to 'dirs' instances (although I think it should be). In copies.mergecopies, we call dirname() to get the directory of a path and then check for containment in the 'dirs' instances ('d1' and 'd2'). In order to easily handle files in the root directory, '/' is added to d1/d2. This results in the empty string being added to the sets, since what comes before the slash in '/' is an empty string. This seems less than obvious, so let's document it. diff -r 56eed3923dbc -r 947771ad5174 mercurial/copies.py --- a/mercurial/copies.py Tue May 26 23:14:50 2015 +0900 +++ b/mercurial/copies.py Fri May 22 14:02:04 2015 -0700 @@ -370,6 +370,7 @@ # generate a directory move map d1, d2 = c1.dirs(), c2.dirs() + # Hack for adding '', which is not otherwise added, to d1 and d2 d1.addpath('/') d2.addpath('/') invalid = set()