Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 31718: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 | 1ed57a7dd904 |
children | 456efd1b51fd |
comparison
equal
deleted
inserted
replaced
31717:62676bb8d534 | 31718:bf64449b2779 |
---|---|
1127 num = 0 | 1127 num = 0 |
1128 | 1128 |
1129 if hardlink is None: | 1129 if hardlink is None: |
1130 hardlink = (os.stat(src).st_dev == | 1130 hardlink = (os.stat(src).st_dev == |
1131 os.stat(os.path.dirname(dst)).st_dev) | 1131 os.stat(os.path.dirname(dst)).st_dev) |
1132 if hardlink: | 1132 |
1133 topic = _('linking') | 1133 gettopic = lambda: hardlink and _('linking') or _('copying') |
1134 else: | 1134 topic = gettopic() |
1135 topic = _('copying') | |
1136 | 1135 |
1137 if os.path.isdir(src): | 1136 if os.path.isdir(src): |
1138 os.mkdir(dst) | 1137 os.mkdir(dst) |
1139 for name, kind in osutil.listdir(src): | 1138 for name, kind in osutil.listdir(src): |
1140 srcname = os.path.join(src, name) | 1139 srcname = os.path.join(src, name) |