Show More
@@ -1,283 +1,283 | |||||
1 | # windows.py - Windows utility function implementations for Mercurial |
|
1 | # windows.py - Windows utility function implementations for Mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others |
|
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2, incorporated herein by reference. |
|
6 | # GNU General Public License version 2, incorporated herein by reference. | |
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | import osutil, error |
|
9 | import osutil, error | |
10 | import errno, msvcrt, os, re, sys |
|
10 | import errno, msvcrt, os, re, sys | |
11 |
|
11 | |||
12 | nulldev = 'NUL:' |
|
12 | nulldev = 'NUL:' | |
13 | umask = 002 |
|
13 | umask = 002 | |
14 |
|
14 | |||
15 | # wrap osutil.posixfile to provide friendlier exceptions |
|
15 | # wrap osutil.posixfile to provide friendlier exceptions | |
16 | def posixfile(name, mode='r', buffering=-1): |
|
16 | def posixfile(name, mode='r', buffering=-1): | |
17 | try: |
|
17 | try: | |
18 | return osutil.posixfile(name, mode, buffering) |
|
18 | return osutil.posixfile(name, mode, buffering) | |
19 | except WindowsError, err: |
|
19 | except WindowsError, err: | |
20 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) |
|
20 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) | |
21 | posixfile.__doc__ = osutil.posixfile.__doc__ |
|
21 | posixfile.__doc__ = osutil.posixfile.__doc__ | |
22 |
|
22 | |||
23 | class winstdout(object): |
|
23 | class winstdout(object): | |
24 | '''stdout on windows misbehaves if sent through a pipe''' |
|
24 | '''stdout on windows misbehaves if sent through a pipe''' | |
25 |
|
25 | |||
26 | def __init__(self, fp): |
|
26 | def __init__(self, fp): | |
27 | self.fp = fp |
|
27 | self.fp = fp | |
28 |
|
28 | |||
29 | def __getattr__(self, key): |
|
29 | def __getattr__(self, key): | |
30 | return getattr(self.fp, key) |
|
30 | return getattr(self.fp, key) | |
31 |
|
31 | |||
32 | def close(self): |
|
32 | def close(self): | |
33 | try: |
|
33 | try: | |
34 | self.fp.close() |
|
34 | self.fp.close() | |
35 | except: pass |
|
35 | except: pass | |
36 |
|
36 | |||
37 | def write(self, s): |
|
37 | def write(self, s): | |
38 | try: |
|
38 | try: | |
39 | # This is workaround for "Not enough space" error on |
|
39 | # This is workaround for "Not enough space" error on | |
40 | # writing large size of data to console. |
|
40 | # writing large size of data to console. | |
41 | limit = 16000 |
|
41 | limit = 16000 | |
42 | l = len(s) |
|
42 | l = len(s) | |
43 | start = 0 |
|
43 | start = 0 | |
44 | self.softspace = 0; |
|
44 | self.softspace = 0; | |
45 | while start < l: |
|
45 | while start < l: | |
46 | end = start + limit |
|
46 | end = start + limit | |
47 | self.fp.write(s[start:end]) |
|
47 | self.fp.write(s[start:end]) | |
48 | start = end |
|
48 | start = end | |
49 | except IOError, inst: |
|
49 | except IOError, inst: | |
50 | if inst.errno != 0: raise |
|
50 | if inst.errno != 0: raise | |
51 | self.close() |
|
51 | self.close() | |
52 | raise IOError(errno.EPIPE, 'Broken pipe') |
|
52 | raise IOError(errno.EPIPE, 'Broken pipe') | |
53 |
|
53 | |||
54 | def flush(self): |
|
54 | def flush(self): | |
55 | try: |
|
55 | try: | |
56 | return self.fp.flush() |
|
56 | return self.fp.flush() | |
57 | except IOError, inst: |
|
57 | except IOError, inst: | |
58 | if inst.errno != errno.EINVAL: raise |
|
58 | if inst.errno != errno.EINVAL: raise | |
59 | self.close() |
|
59 | self.close() | |
60 | raise IOError(errno.EPIPE, 'Broken pipe') |
|
60 | raise IOError(errno.EPIPE, 'Broken pipe') | |
61 |
|
61 | |||
62 | sys.stdout = winstdout(sys.stdout) |
|
62 | sys.stdout = winstdout(sys.stdout) | |
63 |
|
63 | |||
64 | def _is_win_9x(): |
|
64 | def _is_win_9x(): | |
65 | '''return true if run on windows 95, 98 or me.''' |
|
65 | '''return true if run on windows 95, 98 or me.''' | |
66 | try: |
|
66 | try: | |
67 | return sys.getwindowsversion()[3] == 1 |
|
67 | return sys.getwindowsversion()[3] == 1 | |
68 | except AttributeError: |
|
68 | except AttributeError: | |
69 | return 'command' in os.environ.get('comspec', '') |
|
69 | return 'command' in os.environ.get('comspec', '') | |
70 |
|
70 | |||
71 | def openhardlinks(): |
|
71 | def openhardlinks(): | |
72 | return not _is_win_9x() and "win32api" in globals() |
|
72 | return not _is_win_9x() and "win32api" in globals() | |
73 |
|
73 | |||
74 | def system_rcpath(): |
|
74 | def system_rcpath(): | |
75 | try: |
|
75 | try: | |
76 | return system_rcpath_win32() |
|
76 | return system_rcpath_win32() | |
77 | except: |
|
77 | except: | |
78 | return [r'c:\mercurial\mercurial.ini'] |
|
78 | return [r'c:\mercurial\mercurial.ini'] | |
79 |
|
79 | |||
80 | def user_rcpath(): |
|
80 | def user_rcpath(): | |
81 | '''return os-specific hgrc search path to the user dir''' |
|
81 | '''return os-specific hgrc search path to the user dir''' | |
82 | try: |
|
82 | try: | |
83 | path = user_rcpath_win32() |
|
83 | path = user_rcpath_win32() | |
84 | except: |
|
84 | except: | |
85 | home = os.path.expanduser('~') |
|
85 | home = os.path.expanduser('~') | |
86 | path = [os.path.join(home, 'mercurial.ini'), |
|
86 | path = [os.path.join(home, 'mercurial.ini'), | |
87 | os.path.join(home, '.hgrc')] |
|
87 | os.path.join(home, '.hgrc')] | |
88 | userprofile = os.environ.get('USERPROFILE') |
|
88 | userprofile = os.environ.get('USERPROFILE') | |
89 | if userprofile: |
|
89 | if userprofile: | |
90 | path.append(os.path.join(userprofile, 'mercurial.ini')) |
|
90 | path.append(os.path.join(userprofile, 'mercurial.ini')) | |
91 | path.append(os.path.join(userprofile, '.hgrc')) |
|
91 | path.append(os.path.join(userprofile, '.hgrc')) | |
92 | return path |
|
92 | return path | |
93 |
|
93 | |||
94 | def parse_patch_output(output_line): |
|
94 | def parse_patch_output(output_line): | |
95 | """parses the output produced by patch and returns the filename""" |
|
95 | """parses the output produced by patch and returns the filename""" | |
96 | pf = output_line[14:] |
|
96 | pf = output_line[14:] | |
97 | if pf[0] == '`': |
|
97 | if pf[0] == '`': | |
98 | pf = pf[1:-1] # Remove the quotes |
|
98 | pf = pf[1:-1] # Remove the quotes | |
99 | return pf |
|
99 | return pf | |
100 |
|
100 | |||
101 | def sshargs(sshcmd, host, user, port): |
|
101 | def sshargs(sshcmd, host, user, port): | |
102 | '''Build argument list for ssh or Plink''' |
|
102 | '''Build argument list for ssh or Plink''' | |
103 | pflag = 'plink' in sshcmd.lower() and '-P' or '-p' |
|
103 | pflag = 'plink' in sshcmd.lower() and '-P' or '-p' | |
104 | args = user and ("%s@%s" % (user, host)) or host |
|
104 | args = user and ("%s@%s" % (user, host)) or host | |
105 | return port and ("%s %s %s" % (args, pflag, port)) or args |
|
105 | return port and ("%s %s %s" % (args, pflag, port)) or args | |
106 |
|
106 | |||
107 | def testpid(pid): |
|
107 | def testpid(pid): | |
108 | '''return False if pid dead, True if running or not known''' |
|
108 | '''return False if pid dead, True if running or not known''' | |
109 | return True |
|
109 | return True | |
110 |
|
110 | |||
111 | def set_flags(f, l, x): |
|
111 | def set_flags(f, l, x): | |
112 | pass |
|
112 | pass | |
113 |
|
113 | |||
114 | def set_binary(fd): |
|
114 | def set_binary(fd): | |
115 | # When run without console, pipes may expose invalid |
|
115 | # When run without console, pipes may expose invalid | |
116 | # fileno(), usually set to -1. |
|
116 | # fileno(), usually set to -1. | |
117 | if hasattr(fd, 'fileno') and fd.fileno() >= 0: |
|
117 | if hasattr(fd, 'fileno') and fd.fileno() >= 0: | |
118 | msvcrt.setmode(fd.fileno(), os.O_BINARY) |
|
118 | msvcrt.setmode(fd.fileno(), os.O_BINARY) | |
119 |
|
119 | |||
120 | def pconvert(path): |
|
120 | def pconvert(path): | |
121 | return '/'.join(path.split(os.sep)) |
|
121 | return '/'.join(path.split(os.sep)) | |
122 |
|
122 | |||
123 | def localpath(path): |
|
123 | def localpath(path): | |
124 | return path.replace('/', '\\') |
|
124 | return path.replace('/', '\\') | |
125 |
|
125 | |||
126 | def normpath(path): |
|
126 | def normpath(path): | |
127 | return pconvert(os.path.normpath(path)) |
|
127 | return pconvert(os.path.normpath(path)) | |
128 |
|
128 | |||
129 | def samestat(s1, s2): |
|
129 | def samestat(s1, s2): | |
130 | return False |
|
130 | return False | |
131 |
|
131 | |||
132 | # A sequence of backslashes is special iff it precedes a double quote: |
|
132 | # A sequence of backslashes is special iff it precedes a double quote: | |
133 | # - if there's an even number of backslashes, the double quote is not |
|
133 | # - if there's an even number of backslashes, the double quote is not | |
134 | # quoted (i.e. it ends the quoted region) |
|
134 | # quoted (i.e. it ends the quoted region) | |
135 | # - if there's an odd number of backslashes, the double quote is quoted |
|
135 | # - if there's an odd number of backslashes, the double quote is quoted | |
136 | # - in both cases, every pair of backslashes is unquoted into a single |
|
136 | # - in both cases, every pair of backslashes is unquoted into a single | |
137 | # backslash |
|
137 | # backslash | |
138 | # (See http://msdn2.microsoft.com/en-us/library/a1y7w461.aspx ) |
|
138 | # (See http://msdn2.microsoft.com/en-us/library/a1y7w461.aspx ) | |
139 | # So, to quote a string, we must surround it in double quotes, double |
|
139 | # So, to quote a string, we must surround it in double quotes, double | |
140 | # the number of backslashes that preceed double quotes and add another |
|
140 | # the number of backslashes that preceed double quotes and add another | |
141 | # backslash before every double quote (being careful with the double |
|
141 | # backslash before every double quote (being careful with the double | |
142 | # quote we've appended to the end) |
|
142 | # quote we've appended to the end) | |
143 | _quotere = None |
|
143 | _quotere = None | |
144 | def shellquote(s): |
|
144 | def shellquote(s): | |
145 | global _quotere |
|
145 | global _quotere | |
146 | if _quotere is None: |
|
146 | if _quotere is None: | |
147 | _quotere = re.compile(r'(\\*)("|\\$)') |
|
147 | _quotere = re.compile(r'(\\*)("|\\$)') | |
148 | return '"%s"' % _quotere.sub(r'\1\1\\\2', s) |
|
148 | return '"%s"' % _quotere.sub(r'\1\1\\\2', s) | |
149 |
|
149 | |||
150 | def quotecommand(cmd): |
|
150 | def quotecommand(cmd): | |
151 | """Build a command string suitable for os.popen* calls.""" |
|
151 | """Build a command string suitable for os.popen* calls.""" | |
152 | # The extra quotes are needed because popen* runs the command |
|
152 | # The extra quotes are needed because popen* runs the command | |
153 | # through the current COMSPEC. cmd.exe suppress enclosing quotes. |
|
153 | # through the current COMSPEC. cmd.exe suppress enclosing quotes. | |
154 | return '"' + cmd + '"' |
|
154 | return '"' + cmd + '"' | |
155 |
|
155 | |||
156 | def popen(command, mode='r'): |
|
156 | def popen(command, mode='r'): | |
157 | # Work around "popen spawned process may not write to stdout |
|
157 | # Work around "popen spawned process may not write to stdout | |
158 | # under windows" |
|
158 | # under windows" | |
159 | # http://bugs.python.org/issue1366 |
|
159 | # http://bugs.python.org/issue1366 | |
160 | command += " 2> %s" % nulldev |
|
160 | command += " 2> %s" % nulldev | |
161 | return os.popen(quotecommand(command), mode) |
|
161 | return os.popen(quotecommand(command), mode) | |
162 |
|
162 | |||
163 | def explain_exit(code): |
|
163 | def explain_exit(code): | |
164 | return _("exited with status %d") % code, code |
|
164 | return _("exited with status %d") % code, code | |
165 |
|
165 | |||
166 | # if you change this stub into a real check, please try to implement the |
|
166 | # if you change this stub into a real check, please try to implement the | |
167 | # username and groupname functions above, too. |
|
167 | # username and groupname functions above, too. | |
168 | def isowner(st): |
|
168 | def isowner(st): | |
169 | return True |
|
169 | return True | |
170 |
|
170 | |||
171 | def find_exe(command): |
|
171 | def find_exe(command): | |
172 | '''Find executable for command searching like cmd.exe does. |
|
172 | '''Find executable for command searching like cmd.exe does. | |
173 | If command is a basename then PATH is searched for command. |
|
173 | If command is a basename then PATH is searched for command. | |
174 | PATH isn't searched if command is an absolute or relative path. |
|
174 | PATH isn't searched if command is an absolute or relative path. | |
175 | An extension from PATHEXT is found and added if not present. |
|
175 | An extension from PATHEXT is found and added if not present. | |
176 | If command isn't found None is returned.''' |
|
176 | If command isn't found None is returned.''' | |
177 | pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') |
|
177 | pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') | |
178 | pathexts = [ext for ext in pathext.lower().split(os.pathsep)] |
|
178 | pathexts = [ext for ext in pathext.lower().split(os.pathsep)] | |
179 | if os.path.splitext(command)[1].lower() in pathexts: |
|
179 | if os.path.splitext(command)[1].lower() in pathexts: | |
180 | pathexts = [''] |
|
180 | pathexts = [''] | |
181 |
|
181 | |||
182 | def findexisting(pathcommand): |
|
182 | def findexisting(pathcommand): | |
183 | 'Will append extension (if needed) and return existing file' |
|
183 | 'Will append extension (if needed) and return existing file' | |
184 | for ext in pathexts: |
|
184 | for ext in pathexts: | |
185 | executable = pathcommand + ext |
|
185 | executable = pathcommand + ext | |
186 | if os.path.exists(executable): |
|
186 | if os.path.exists(executable): | |
187 | return executable |
|
187 | return executable | |
188 | return None |
|
188 | return None | |
189 |
|
189 | |||
190 | if os.sep in command: |
|
190 | if os.sep in command: | |
191 | return findexisting(command) |
|
191 | return findexisting(command) | |
192 |
|
192 | |||
193 | for path in os.environ.get('PATH', '').split(os.pathsep): |
|
193 | for path in os.environ.get('PATH', '').split(os.pathsep): | |
194 | executable = findexisting(os.path.join(path, command)) |
|
194 | executable = findexisting(os.path.join(path, command)) | |
195 | if executable is not None: |
|
195 | if executable is not None: | |
196 | return executable |
|
196 | return executable | |
197 | return None |
|
197 | return None | |
198 |
|
198 | |||
199 | def set_signal_handler(): |
|
199 | def set_signal_handler(): | |
200 | try: |
|
200 | try: | |
201 | set_signal_handler_win32() |
|
201 | set_signal_handler_win32() | |
202 | except NameError: |
|
202 | except NameError: | |
203 | pass |
|
203 | pass | |
204 |
|
204 | |||
205 | def statfiles(files): |
|
205 | def statfiles(files): | |
206 | '''Stat each file in files and yield stat or None if file does not exist. |
|
206 | '''Stat each file in files and yield stat or None if file does not exist. | |
207 | Cluster and cache stat per directory to minimize number of OS stat calls.''' |
|
207 | Cluster and cache stat per directory to minimize number of OS stat calls.''' | |
208 | ncase = os.path.normcase |
|
208 | ncase = os.path.normcase | |
209 | sep = os.sep |
|
209 | sep = os.sep | |
210 | dircache = {} # dirname -> filename -> status | None if file does not exist |
|
210 | dircache = {} # dirname -> filename -> status | None if file does not exist | |
211 | for nf in files: |
|
211 | for nf in files: | |
212 | nf = ncase(nf) |
|
212 | nf = ncase(nf) | |
213 | dir, base = os.path.split(nf) |
|
213 | dir, base = os.path.split(nf) | |
214 | if not dir: |
|
214 | if not dir: | |
215 | dir = '.' |
|
215 | dir = '.' | |
216 | cache = dircache.get(dir, None) |
|
216 | cache = dircache.get(dir, None) | |
217 | if cache is None: |
|
217 | if cache is None: | |
218 | try: |
|
218 | try: | |
219 | dmap = dict([(ncase(n), s) |
|
219 | dmap = dict([(ncase(n), s) | |
220 | for n, k, s in osutil.listdir(dir, True)]) |
|
220 | for n, k, s in osutil.listdir(dir, True)]) | |
221 | except OSError, err: |
|
221 | except OSError, err: | |
222 | # handle directory not found in Python version prior to 2.5 |
|
222 | # handle directory not found in Python version prior to 2.5 | |
223 | # Python <= 2.4 returns native Windows code 3 in errno |
|
223 | # Python <= 2.4 returns native Windows code 3 in errno | |
224 | # Python >= 2.5 returns ENOENT and adds winerror field |
|
224 | # Python >= 2.5 returns ENOENT and adds winerror field | |
225 | # EINVAL is raised if dir is not a directory. |
|
225 | # EINVAL is raised if dir is not a directory. | |
226 | if err.errno not in (3, errno.ENOENT, errno.EINVAL, |
|
226 | if err.errno not in (3, errno.ENOENT, errno.EINVAL, | |
227 | errno.ENOTDIR): |
|
227 | errno.ENOTDIR): | |
228 | raise |
|
228 | raise | |
229 | dmap = {} |
|
229 | dmap = {} | |
230 | cache = dircache.setdefault(dir, dmap) |
|
230 | cache = dircache.setdefault(dir, dmap) | |
231 | yield cache.get(base, None) |
|
231 | yield cache.get(base, None) | |
232 |
|
232 | |||
233 | def getuser(): |
|
233 | def getuser(): | |
234 | '''return name of current user''' |
|
234 | '''return name of current user''' | |
235 | raise error.Abort(_('user name not available - set USERNAME ' |
|
235 | raise error.Abort(_('user name not available - set USERNAME ' | |
236 | 'environment variable')) |
|
236 | 'environment variable')) | |
237 |
|
237 | |||
238 | def username(uid=None): |
|
238 | def username(uid=None): | |
239 | """Return the name of the user with the given uid. |
|
239 | """Return the name of the user with the given uid. | |
240 |
|
240 | |||
241 | If uid is None, return the name of the current user.""" |
|
241 | If uid is None, return the name of the current user.""" | |
242 | return None |
|
242 | return None | |
243 |
|
243 | |||
244 | def groupname(gid=None): |
|
244 | def groupname(gid=None): | |
245 | """Return the name of the group with the given gid. |
|
245 | """Return the name of the group with the given gid. | |
246 |
|
246 | |||
247 | If gid is None, return the name of the current group.""" |
|
247 | If gid is None, return the name of the current group.""" | |
248 | return None |
|
248 | return None | |
249 |
|
249 | |||
250 | def _removedirs(name): |
|
250 | def _removedirs(name): | |
251 | """special version of os.removedirs that does not remove symlinked |
|
251 | """special version of os.removedirs that does not remove symlinked | |
252 | directories or junction points if they actually contain files""" |
|
252 | directories or junction points if they actually contain files""" | |
253 | if osutil.listdir(name): |
|
253 | if osutil.listdir(name): | |
254 | return |
|
254 | return | |
255 | os.rmdir(name) |
|
255 | os.rmdir(name) | |
256 | head, tail = os.path.split(name) |
|
256 | head, tail = os.path.split(name) | |
257 | if not tail: |
|
257 | if not tail: | |
258 | head, tail = os.path.split(head) |
|
258 | head, tail = os.path.split(head) | |
259 | while head and tail: |
|
259 | while head and tail: | |
260 | try: |
|
260 | try: | |
261 |
if osutil.listdir( |
|
261 | if osutil.listdir(head): | |
262 | return |
|
262 | return | |
263 | os.rmdir(head) |
|
263 | os.rmdir(head) | |
264 | except: |
|
264 | except: | |
265 | break |
|
265 | break | |
266 | head, tail = os.path.split(head) |
|
266 | head, tail = os.path.split(head) | |
267 |
|
267 | |||
268 | def unlink(f): |
|
268 | def unlink(f): | |
269 | """unlink and remove the directory if it is empty""" |
|
269 | """unlink and remove the directory if it is empty""" | |
270 | os.unlink(f) |
|
270 | os.unlink(f) | |
271 | # try removing directories that might now be empty |
|
271 | # try removing directories that might now be empty | |
272 | try: |
|
272 | try: | |
273 | _removedirs(os.path.dirname(f)) |
|
273 | _removedirs(os.path.dirname(f)) | |
274 | except OSError: |
|
274 | except OSError: | |
275 | pass |
|
275 | pass | |
276 |
|
276 | |||
277 | try: |
|
277 | try: | |
278 | # override functions with win32 versions if possible |
|
278 | # override functions with win32 versions if possible | |
279 | from win32 import * |
|
279 | from win32 import * | |
280 | except ImportError: |
|
280 | except ImportError: | |
281 | pass |
|
281 | pass | |
282 |
|
282 | |||
283 | expandglobs = True |
|
283 | expandglobs = True |
@@ -1,110 +1,119 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | remove() { |
|
3 | remove() { | |
4 | hg rm $@ |
|
4 | hg rm $@ | |
5 | hg st |
|
5 | hg st | |
6 | # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5 |
|
6 | # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5 | |
7 | find . -name .hg -prune -o -type f -print | sort |
|
7 | find . -name .hg -prune -o -type f -print | sort | |
8 | hg up -C |
|
8 | hg up -C | |
9 | } |
|
9 | } | |
10 |
|
10 | |||
11 | hg init a |
|
11 | hg init a | |
12 | cd a |
|
12 | cd a | |
13 | echo a > foo |
|
13 | echo a > foo | |
14 |
|
14 | |||
15 | echo % file not managed |
|
15 | echo % file not managed | |
16 | remove foo |
|
16 | remove foo | |
17 |
|
17 | |||
18 | hg add foo |
|
18 | hg add foo | |
19 | hg commit -m1 |
|
19 | hg commit -m1 | |
20 |
|
20 | |||
21 | # the table cases |
|
21 | # the table cases | |
22 |
|
22 | |||
23 | echo % 00 state added, options none |
|
23 | echo % 00 state added, options none | |
24 | echo b > bar |
|
24 | echo b > bar | |
25 | hg add bar |
|
25 | hg add bar | |
26 | remove bar |
|
26 | remove bar | |
27 |
|
27 | |||
28 | echo % 01 state clean, options none |
|
28 | echo % 01 state clean, options none | |
29 | remove foo |
|
29 | remove foo | |
30 |
|
30 | |||
31 | echo % 02 state modified, options none |
|
31 | echo % 02 state modified, options none | |
32 | echo b >> foo |
|
32 | echo b >> foo | |
33 | remove foo |
|
33 | remove foo | |
34 |
|
34 | |||
35 | echo % 03 state missing, options none |
|
35 | echo % 03 state missing, options none | |
36 | rm foo |
|
36 | rm foo | |
37 | remove foo |
|
37 | remove foo | |
38 |
|
38 | |||
39 | echo % 10 state added, options -f |
|
39 | echo % 10 state added, options -f | |
40 | echo b > bar |
|
40 | echo b > bar | |
41 | hg add bar |
|
41 | hg add bar | |
42 | remove -f bar |
|
42 | remove -f bar | |
43 | rm bar |
|
43 | rm bar | |
44 |
|
44 | |||
45 | echo % 11 state clean, options -f |
|
45 | echo % 11 state clean, options -f | |
46 | remove -f foo |
|
46 | remove -f foo | |
47 |
|
47 | |||
48 | echo % 12 state modified, options -f |
|
48 | echo % 12 state modified, options -f | |
49 | echo b >> foo |
|
49 | echo b >> foo | |
50 | remove -f foo |
|
50 | remove -f foo | |
51 |
|
51 | |||
52 | echo % 13 state missing, options -f |
|
52 | echo % 13 state missing, options -f | |
53 | rm foo |
|
53 | rm foo | |
54 | remove -f foo |
|
54 | remove -f foo | |
55 |
|
55 | |||
56 | echo % 20 state added, options -A |
|
56 | echo % 20 state added, options -A | |
57 | echo b > bar |
|
57 | echo b > bar | |
58 | hg add bar |
|
58 | hg add bar | |
59 | remove -A bar |
|
59 | remove -A bar | |
60 |
|
60 | |||
61 | echo % 21 state clean, options -A |
|
61 | echo % 21 state clean, options -A | |
62 | remove -A foo |
|
62 | remove -A foo | |
63 |
|
63 | |||
64 | echo % 22 state modified, options -A |
|
64 | echo % 22 state modified, options -A | |
65 | echo b >> foo |
|
65 | echo b >> foo | |
66 | remove -A foo |
|
66 | remove -A foo | |
67 |
|
67 | |||
68 | echo % 23 state missing, options -A |
|
68 | echo % 23 state missing, options -A | |
69 | rm foo |
|
69 | rm foo | |
70 | remove -A foo |
|
70 | remove -A foo | |
71 |
|
71 | |||
72 | echo % 30 state added, options -Af |
|
72 | echo % 30 state added, options -Af | |
73 | echo b > bar |
|
73 | echo b > bar | |
74 | hg add bar |
|
74 | hg add bar | |
75 | remove -Af bar |
|
75 | remove -Af bar | |
76 | rm bar |
|
76 | rm bar | |
77 |
|
77 | |||
78 | echo % 31 state clean, options -Af |
|
78 | echo % 31 state clean, options -Af | |
79 | remove -Af foo |
|
79 | remove -Af foo | |
80 |
|
80 | |||
81 | echo % 32 state modified, options -Af |
|
81 | echo % 32 state modified, options -Af | |
82 | echo b >> foo |
|
82 | echo b >> foo | |
83 | remove -Af foo |
|
83 | remove -Af foo | |
84 |
|
84 | |||
85 | echo % 33 state missing, options -Af |
|
85 | echo % 33 state missing, options -Af | |
86 | rm foo |
|
86 | rm foo | |
87 | remove -Af foo |
|
87 | remove -Af foo | |
88 |
|
88 | |||
89 | # test some directory stuff |
|
89 | # test some directory stuff | |
90 |
|
90 | |||
91 | mkdir test |
|
91 | mkdir test | |
92 | echo a > test/foo |
|
92 | echo a > test/foo | |
93 | echo b > test/bar |
|
93 | echo b > test/bar | |
94 | hg ci -Am2 |
|
94 | hg ci -Am2 | |
95 |
|
95 | |||
96 | echo % dir, options none |
|
96 | echo % dir, options none | |
97 | rm test/bar |
|
97 | rm test/bar | |
98 | remove test |
|
98 | remove test | |
99 |
|
99 | |||
100 | echo % dir, options -f |
|
100 | echo % dir, options -f | |
101 | rm test/bar |
|
101 | rm test/bar | |
102 | remove -f test |
|
102 | remove -f test | |
103 |
|
103 | |||
104 | echo % dir, options -A |
|
104 | echo % dir, options -A | |
105 | rm test/bar |
|
105 | rm test/bar | |
106 | remove -A test |
|
106 | remove -A test | |
107 |
|
107 | |||
108 | echo % dir, options -Af |
|
108 | echo % dir, options -Af | |
109 | rm test/bar |
|
109 | rm test/bar | |
110 | remove -Af test |
|
110 | remove -Af test | |
|
111 | ||||
|
112 | echo 'test remove dropping empty trees (issue1861)' | |||
|
113 | mkdir -p issue1861/b/c | |||
|
114 | echo x > issue1861/x | |||
|
115 | echo y > issue1861/b/c/y | |||
|
116 | hg ci -Am add | |||
|
117 | hg rm issue1861/b | |||
|
118 | hg ci -m remove | |||
|
119 | ls issue1861 |
@@ -1,113 +1,118 | |||||
1 | % file not managed |
|
1 | % file not managed | |
2 | not removing foo: file is untracked |
|
2 | not removing foo: file is untracked | |
3 | ? foo |
|
3 | ? foo | |
4 | ./foo |
|
4 | ./foo | |
5 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
5 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
6 | % 00 state added, options none |
|
6 | % 00 state added, options none | |
7 | not removing bar: file has been marked for add (use -f to force removal) |
|
7 | not removing bar: file has been marked for add (use -f to force removal) | |
8 | A bar |
|
8 | A bar | |
9 | ./bar |
|
9 | ./bar | |
10 | ./foo |
|
10 | ./foo | |
11 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
11 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
12 | % 01 state clean, options none |
|
12 | % 01 state clean, options none | |
13 | R foo |
|
13 | R foo | |
14 | ? bar |
|
14 | ? bar | |
15 | ./bar |
|
15 | ./bar | |
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
17 | % 02 state modified, options none |
|
17 | % 02 state modified, options none | |
18 | not removing foo: file is modified (use -f to force removal) |
|
18 | not removing foo: file is modified (use -f to force removal) | |
19 | M foo |
|
19 | M foo | |
20 | ? bar |
|
20 | ? bar | |
21 | ./bar |
|
21 | ./bar | |
22 | ./foo |
|
22 | ./foo | |
23 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
23 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
24 | % 03 state missing, options none |
|
24 | % 03 state missing, options none | |
25 | R foo |
|
25 | R foo | |
26 | ? bar |
|
26 | ? bar | |
27 | ./bar |
|
27 | ./bar | |
28 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
28 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
29 | % 10 state added, options -f |
|
29 | % 10 state added, options -f | |
30 | ? bar |
|
30 | ? bar | |
31 | ./bar |
|
31 | ./bar | |
32 | ./foo |
|
32 | ./foo | |
33 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
33 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 | % 11 state clean, options -f |
|
34 | % 11 state clean, options -f | |
35 | R foo |
|
35 | R foo | |
36 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
36 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
37 | % 12 state modified, options -f |
|
37 | % 12 state modified, options -f | |
38 | R foo |
|
38 | R foo | |
39 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
39 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
40 | % 13 state missing, options -f |
|
40 | % 13 state missing, options -f | |
41 | R foo |
|
41 | R foo | |
42 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
42 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
43 | % 20 state added, options -A |
|
43 | % 20 state added, options -A | |
44 | not removing bar: file still exists (use -f to force removal) |
|
44 | not removing bar: file still exists (use -f to force removal) | |
45 | A bar |
|
45 | A bar | |
46 | ./bar |
|
46 | ./bar | |
47 | ./foo |
|
47 | ./foo | |
48 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
48 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 | % 21 state clean, options -A |
|
49 | % 21 state clean, options -A | |
50 | not removing foo: file still exists (use -f to force removal) |
|
50 | not removing foo: file still exists (use -f to force removal) | |
51 | ? bar |
|
51 | ? bar | |
52 | ./bar |
|
52 | ./bar | |
53 | ./foo |
|
53 | ./foo | |
54 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
54 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
55 | % 22 state modified, options -A |
|
55 | % 22 state modified, options -A | |
56 | not removing foo: file still exists (use -f to force removal) |
|
56 | not removing foo: file still exists (use -f to force removal) | |
57 | M foo |
|
57 | M foo | |
58 | ? bar |
|
58 | ? bar | |
59 | ./bar |
|
59 | ./bar | |
60 | ./foo |
|
60 | ./foo | |
61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
62 | % 23 state missing, options -A |
|
62 | % 23 state missing, options -A | |
63 | R foo |
|
63 | R foo | |
64 | ? bar |
|
64 | ? bar | |
65 | ./bar |
|
65 | ./bar | |
66 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
66 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
67 | % 30 state added, options -Af |
|
67 | % 30 state added, options -Af | |
68 | ? bar |
|
68 | ? bar | |
69 | ./bar |
|
69 | ./bar | |
70 | ./foo |
|
70 | ./foo | |
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
72 | % 31 state clean, options -Af |
|
72 | % 31 state clean, options -Af | |
73 | R foo |
|
73 | R foo | |
74 | ./foo |
|
74 | ./foo | |
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 | % 32 state modified, options -Af |
|
76 | % 32 state modified, options -Af | |
77 | R foo |
|
77 | R foo | |
78 | ./foo |
|
78 | ./foo | |
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
80 | % 33 state missing, options -Af |
|
80 | % 33 state missing, options -Af | |
81 | R foo |
|
81 | R foo | |
82 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
82 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
83 | adding test/bar |
|
83 | adding test/bar | |
84 | adding test/foo |
|
84 | adding test/foo | |
85 | % dir, options none |
|
85 | % dir, options none | |
86 | removing test/bar |
|
86 | removing test/bar | |
87 | removing test/foo |
|
87 | removing test/foo | |
88 | R test/bar |
|
88 | R test/bar | |
89 | R test/foo |
|
89 | R test/foo | |
90 | ./foo |
|
90 | ./foo | |
91 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
91 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
92 | % dir, options -f |
|
92 | % dir, options -f | |
93 | removing test/bar |
|
93 | removing test/bar | |
94 | removing test/foo |
|
94 | removing test/foo | |
95 | R test/bar |
|
95 | R test/bar | |
96 | R test/foo |
|
96 | R test/foo | |
97 | ./foo |
|
97 | ./foo | |
98 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 | % dir, options -A |
|
99 | % dir, options -A | |
100 | not removing test/foo: file still exists (use -f to force removal) |
|
100 | not removing test/foo: file still exists (use -f to force removal) | |
101 | removing test/bar |
|
101 | removing test/bar | |
102 | R test/bar |
|
102 | R test/bar | |
103 | ./foo |
|
103 | ./foo | |
104 | ./test/foo |
|
104 | ./test/foo | |
105 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
105 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
106 | % dir, options -Af |
|
106 | % dir, options -Af | |
107 | removing test/bar |
|
107 | removing test/bar | |
108 | removing test/foo |
|
108 | removing test/foo | |
109 | R test/bar |
|
109 | R test/bar | |
110 | R test/foo |
|
110 | R test/foo | |
111 | ./foo |
|
111 | ./foo | |
112 | ./test/foo |
|
112 | ./test/foo | |
113 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
113 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
114 | test remove dropping empty trees (issue1861) | |||
|
115 | adding issue1861/b/c/y | |||
|
116 | adding issue1861/x | |||
|
117 | removing issue1861/b/c/y | |||
|
118 | x |
General Comments 0
You need to be logged in to leave comments.
Login now