Patchwork [1,of,3] dirstate: state that getcwd() shouldn't be used to get real file path

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 22, 2015, 9:27 a.m.
Message ID <070f6327fd0155d32712.1442914037@mimosa>
Download mbox | patch
Permalink /patch/10574/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 22, 2015, 9:27 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1442747302 -32400
#      Sun Sep 20 20:08:22 2015 +0900
# Node ID 070f6327fd0155d32712d01881432c01f43a2da5
# Parent  4b685712fa454919c121d8d1c967da35b0522dd5
dirstate: state that getcwd() shouldn't be used to get real file path

hgweb will force it to be '' so that file patterns can be resolved relative
to the repository root. I want to clarify that is correct.

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -220,6 +220,12 @@  class dirstate(object):
         return os.getcwd()
 
     def getcwd(self):
+        '''Return the path from which a canonical path is calculated.
+
+        This path should be used to resolve file patterns or to convert
+        canonical paths back to file paths for display. It shouldn't be
+        used to get real file paths. Use vfs functions instead.
+        '''
         cwd = self._cwd
         if cwd == self._root:
             return ''