changeset 31723:bf64449b2779

hardlink: extract topic text logic of copyfiles The topic text shows whether it's "linking" or "copying", based on "hardlink" value. The function is extracted so a later patch can reuse it.
author Jun Wu <quark@fb.com>
date Wed, 29 Mar 2017 12:21:15 -0700
parents 62676bb8d534
children 456efd1b51fd
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Wed Mar 29 14:56:58 2017 +0530
+++ b/mercurial/util.py	Wed Mar 29 12:21:15 2017 -0700
@@ -1129,10 +1129,9 @@
     if hardlink is None:
         hardlink = (os.stat(src).st_dev ==
                     os.stat(os.path.dirname(dst)).st_dev)
-    if hardlink:
-        topic = _('linking')
-    else:
-        topic = _('copying')
+
+    gettopic = lambda: hardlink and _('linking') or _('copying')
+    topic = gettopic()
 
     if os.path.isdir(src):
         os.mkdir(dst)