Show More
@@ -1,376 +1,380 b'' | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 |
|
2 | |||
3 | import contextlib |
|
3 | import contextlib | |
4 | import errno |
|
4 | import errno | |
5 | import os |
|
5 | import os | |
6 | import posixpath |
|
6 | import posixpath | |
7 | import stat |
|
7 | import stat | |
8 |
|
8 | |||
9 | from .i18n import _ |
|
9 | from .i18n import _ | |
10 | from . import ( |
|
10 | from . import ( | |
11 | encoding, |
|
11 | encoding, | |
12 | error, |
|
12 | error, | |
13 | policy, |
|
13 | policy, | |
14 | pycompat, |
|
14 | pycompat, | |
15 | util, |
|
15 | util, | |
16 | ) |
|
16 | ) | |
17 |
|
17 | |||
18 | if pycompat.TYPE_CHECKING: |
|
18 | if pycompat.TYPE_CHECKING: | |
19 | from typing import ( |
|
19 | from typing import ( | |
20 | Any, |
|
20 | Any, | |
21 | Callable, |
|
21 | Callable, | |
22 | Iterator, |
|
22 | Iterator, | |
23 | Optional, |
|
23 | Optional, | |
24 | ) |
|
24 | ) | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | rustdirs = policy.importrust('dirstate', 'Dirs') |
|
27 | rustdirs = policy.importrust('dirstate', 'Dirs') | |
28 | parsers = policy.importmod('parsers') |
|
28 | parsers = policy.importmod('parsers') | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | def _lowerclean(s): |
|
31 | def _lowerclean(s): | |
32 | # type: (bytes) -> bytes |
|
32 | # type: (bytes) -> bytes | |
33 | return encoding.hfsignoreclean(s.lower()) |
|
33 | return encoding.hfsignoreclean(s.lower()) | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | class pathauditor(object): |
|
36 | class pathauditor(object): | |
37 | """ensure that a filesystem path contains no banned components. |
|
37 | """ensure that a filesystem path contains no banned components. | |
38 | the following properties of a path are checked: |
|
38 | the following properties of a path are checked: | |
39 |
|
39 | |||
40 | - ends with a directory separator |
|
40 | - ends with a directory separator | |
41 | - under top-level .hg |
|
41 | - under top-level .hg | |
42 | - starts at the root of a windows drive |
|
42 | - starts at the root of a windows drive | |
43 | - contains ".." |
|
43 | - contains ".." | |
44 |
|
44 | |||
45 | More check are also done about the file system states: |
|
45 | More check are also done about the file system states: | |
46 | - traverses a symlink (e.g. a/symlink_here/b) |
|
46 | - traverses a symlink (e.g. a/symlink_here/b) | |
47 | - inside a nested repository (a callback can be used to approve |
|
47 | - inside a nested repository (a callback can be used to approve | |
48 | some nested repositories, e.g., subrepositories) |
|
48 | some nested repositories, e.g., subrepositories) | |
49 |
|
49 | |||
50 | The file system checks are only done when 'realfs' is set to True (the |
|
50 | The file system checks are only done when 'realfs' is set to True (the | |
51 | default). They should be disable then we are auditing path for operation on |
|
51 | default). They should be disable then we are auditing path for operation on | |
52 | stored history. |
|
52 | stored history. | |
53 |
|
53 | |||
54 | If 'cached' is set to True, audited paths and sub-directories are cached. |
|
54 | If 'cached' is set to True, audited paths and sub-directories are cached. | |
55 | Be careful to not keep the cache of unmanaged directories for long because |
|
55 | Be careful to not keep the cache of unmanaged directories for long because | |
56 | audited paths may be replaced with symlinks. |
|
56 | audited paths may be replaced with symlinks. | |
57 | """ |
|
57 | """ | |
58 |
|
58 | |||
59 | def __init__(self, root, callback=None, realfs=True, cached=False): |
|
59 | def __init__(self, root, callback=None, realfs=True, cached=False): | |
60 | self.audited = set() |
|
60 | self.audited = set() | |
61 | self.auditeddir = set() |
|
61 | self.auditeddir = set() | |
62 | self.root = root |
|
62 | self.root = root | |
63 | self._realfs = realfs |
|
63 | self._realfs = realfs | |
64 | self._cached = cached |
|
64 | self._cached = cached | |
65 | self.callback = callback |
|
65 | self.callback = callback | |
66 | if os.path.lexists(root) and not util.fscasesensitive(root): |
|
66 | if os.path.lexists(root) and not util.fscasesensitive(root): | |
67 | self.normcase = util.normcase |
|
67 | self.normcase = util.normcase | |
68 | else: |
|
68 | else: | |
69 | self.normcase = lambda x: x |
|
69 | self.normcase = lambda x: x | |
70 |
|
70 | |||
71 | def __call__(self, path, mode=None): |
|
71 | def __call__(self, path, mode=None): | |
72 | # type: (bytes, Optional[Any]) -> None |
|
72 | # type: (bytes, Optional[Any]) -> None | |
73 | """Check the relative path. |
|
73 | """Check the relative path. | |
74 | path may contain a pattern (e.g. foodir/**.txt)""" |
|
74 | path may contain a pattern (e.g. foodir/**.txt)""" | |
75 |
|
75 | |||
76 | path = util.localpath(path) |
|
76 | path = util.localpath(path) | |
77 | normpath = self.normcase(path) |
|
77 | normpath = self.normcase(path) | |
78 | if normpath in self.audited: |
|
78 | if normpath in self.audited: | |
79 | return |
|
79 | return | |
80 | # AIX ignores "/" at end of path, others raise EISDIR. |
|
80 | # AIX ignores "/" at end of path, others raise EISDIR. | |
81 | if util.endswithsep(path): |
|
81 | if util.endswithsep(path): | |
82 | raise error.Abort(_(b"path ends in directory separator: %s") % path) |
|
82 | raise error.InputError( | |
|
83 | _(b"path ends in directory separator: %s") % path | |||
|
84 | ) | |||
83 | parts = util.splitpath(path) |
|
85 | parts = util.splitpath(path) | |
84 | if ( |
|
86 | if ( | |
85 | os.path.splitdrive(path)[0] |
|
87 | os.path.splitdrive(path)[0] | |
86 | or _lowerclean(parts[0]) in (b'.hg', b'.hg.', b'') |
|
88 | or _lowerclean(parts[0]) in (b'.hg', b'.hg.', b'') | |
87 | or pycompat.ospardir in parts |
|
89 | or pycompat.ospardir in parts | |
88 | ): |
|
90 | ): | |
89 | raise error.Abort(_(b"path contains illegal component: %s") % path) |
|
91 | raise error.InputError( | |
|
92 | _(b"path contains illegal component: %s") % path | |||
|
93 | ) | |||
90 | # Windows shortname aliases |
|
94 | # Windows shortname aliases | |
91 | for p in parts: |
|
95 | for p in parts: | |
92 | if b"~" in p: |
|
96 | if b"~" in p: | |
93 | first, last = p.split(b"~", 1) |
|
97 | first, last = p.split(b"~", 1) | |
94 | if last.isdigit() and first.upper() in [b"HG", b"HG8B6C"]: |
|
98 | if last.isdigit() and first.upper() in [b"HG", b"HG8B6C"]: | |
95 |
raise error. |
|
99 | raise error.InputError( | |
96 | _(b"path contains illegal component: %s") % path |
|
100 | _(b"path contains illegal component: %s") % path | |
97 | ) |
|
101 | ) | |
98 | if b'.hg' in _lowerclean(path): |
|
102 | if b'.hg' in _lowerclean(path): | |
99 | lparts = [_lowerclean(p) for p in parts] |
|
103 | lparts = [_lowerclean(p) for p in parts] | |
100 | for p in b'.hg', b'.hg.': |
|
104 | for p in b'.hg', b'.hg.': | |
101 | if p in lparts[1:]: |
|
105 | if p in lparts[1:]: | |
102 | pos = lparts.index(p) |
|
106 | pos = lparts.index(p) | |
103 | base = os.path.join(*parts[:pos]) |
|
107 | base = os.path.join(*parts[:pos]) | |
104 |
raise error. |
|
108 | raise error.InputError( | |
105 | _(b"path '%s' is inside nested repo %r") |
|
109 | _(b"path '%s' is inside nested repo %r") | |
106 | % (path, pycompat.bytestr(base)) |
|
110 | % (path, pycompat.bytestr(base)) | |
107 | ) |
|
111 | ) | |
108 |
|
112 | |||
109 | normparts = util.splitpath(normpath) |
|
113 | normparts = util.splitpath(normpath) | |
110 | assert len(parts) == len(normparts) |
|
114 | assert len(parts) == len(normparts) | |
111 |
|
115 | |||
112 | parts.pop() |
|
116 | parts.pop() | |
113 | normparts.pop() |
|
117 | normparts.pop() | |
114 | # It's important that we check the path parts starting from the root. |
|
118 | # It's important that we check the path parts starting from the root. | |
115 | # We don't want to add "foo/bar/baz" to auditeddir before checking if |
|
119 | # We don't want to add "foo/bar/baz" to auditeddir before checking if | |
116 | # there's a "foo/.hg" directory. This also means we won't accidentally |
|
120 | # there's a "foo/.hg" directory. This also means we won't accidentally | |
117 | # traverse a symlink into some other filesystem (which is potentially |
|
121 | # traverse a symlink into some other filesystem (which is potentially | |
118 | # expensive to access). |
|
122 | # expensive to access). | |
119 | for i in range(len(parts)): |
|
123 | for i in range(len(parts)): | |
120 | prefix = pycompat.ossep.join(parts[: i + 1]) |
|
124 | prefix = pycompat.ossep.join(parts[: i + 1]) | |
121 | normprefix = pycompat.ossep.join(normparts[: i + 1]) |
|
125 | normprefix = pycompat.ossep.join(normparts[: i + 1]) | |
122 | if normprefix in self.auditeddir: |
|
126 | if normprefix in self.auditeddir: | |
123 | continue |
|
127 | continue | |
124 | if self._realfs: |
|
128 | if self._realfs: | |
125 | self._checkfs(prefix, path) |
|
129 | self._checkfs(prefix, path) | |
126 | if self._cached: |
|
130 | if self._cached: | |
127 | self.auditeddir.add(normprefix) |
|
131 | self.auditeddir.add(normprefix) | |
128 |
|
132 | |||
129 | if self._cached: |
|
133 | if self._cached: | |
130 | self.audited.add(normpath) |
|
134 | self.audited.add(normpath) | |
131 |
|
135 | |||
132 | def _checkfs(self, prefix, path): |
|
136 | def _checkfs(self, prefix, path): | |
133 | # type: (bytes, bytes) -> None |
|
137 | # type: (bytes, bytes) -> None | |
134 | """raise exception if a file system backed check fails""" |
|
138 | """raise exception if a file system backed check fails""" | |
135 | curpath = os.path.join(self.root, prefix) |
|
139 | curpath = os.path.join(self.root, prefix) | |
136 | try: |
|
140 | try: | |
137 | st = os.lstat(curpath) |
|
141 | st = os.lstat(curpath) | |
138 | except OSError as err: |
|
142 | except OSError as err: | |
139 | # EINVAL can be raised as invalid path syntax under win32. |
|
143 | # EINVAL can be raised as invalid path syntax under win32. | |
140 | # They must be ignored for patterns can be checked too. |
|
144 | # They must be ignored for patterns can be checked too. | |
141 | if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL): |
|
145 | if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL): | |
142 | raise |
|
146 | raise | |
143 | else: |
|
147 | else: | |
144 | if stat.S_ISLNK(st.st_mode): |
|
148 | if stat.S_ISLNK(st.st_mode): | |
145 | msg = _(b'path %r traverses symbolic link %r') % ( |
|
149 | msg = _(b'path %r traverses symbolic link %r') % ( | |
146 | pycompat.bytestr(path), |
|
150 | pycompat.bytestr(path), | |
147 | pycompat.bytestr(prefix), |
|
151 | pycompat.bytestr(prefix), | |
148 | ) |
|
152 | ) | |
149 | raise error.Abort(msg) |
|
153 | raise error.Abort(msg) | |
150 | elif stat.S_ISDIR(st.st_mode) and os.path.isdir( |
|
154 | elif stat.S_ISDIR(st.st_mode) and os.path.isdir( | |
151 | os.path.join(curpath, b'.hg') |
|
155 | os.path.join(curpath, b'.hg') | |
152 | ): |
|
156 | ): | |
153 | if not self.callback or not self.callback(curpath): |
|
157 | if not self.callback or not self.callback(curpath): | |
154 | msg = _(b"path '%s' is inside nested repo %r") |
|
158 | msg = _(b"path '%s' is inside nested repo %r") | |
155 | raise error.Abort(msg % (path, pycompat.bytestr(prefix))) |
|
159 | raise error.Abort(msg % (path, pycompat.bytestr(prefix))) | |
156 |
|
160 | |||
157 | def check(self, path): |
|
161 | def check(self, path): | |
158 | # type: (bytes) -> bool |
|
162 | # type: (bytes) -> bool | |
159 | try: |
|
163 | try: | |
160 | self(path) |
|
164 | self(path) | |
161 | return True |
|
165 | return True | |
162 | except (OSError, error.Abort): |
|
166 | except (OSError, error.Abort): | |
163 | return False |
|
167 | return False | |
164 |
|
168 | |||
165 | @contextlib.contextmanager |
|
169 | @contextlib.contextmanager | |
166 | def cached(self): |
|
170 | def cached(self): | |
167 | if self._cached: |
|
171 | if self._cached: | |
168 | yield |
|
172 | yield | |
169 | else: |
|
173 | else: | |
170 | try: |
|
174 | try: | |
171 | self._cached = True |
|
175 | self._cached = True | |
172 | yield |
|
176 | yield | |
173 | finally: |
|
177 | finally: | |
174 | self.audited.clear() |
|
178 | self.audited.clear() | |
175 | self.auditeddir.clear() |
|
179 | self.auditeddir.clear() | |
176 | self._cached = False |
|
180 | self._cached = False | |
177 |
|
181 | |||
178 |
|
182 | |||
179 | def canonpath(root, cwd, myname, auditor=None): |
|
183 | def canonpath(root, cwd, myname, auditor=None): | |
180 | # type: (bytes, bytes, bytes, Optional[pathauditor]) -> bytes |
|
184 | # type: (bytes, bytes, bytes, Optional[pathauditor]) -> bytes | |
181 | """return the canonical path of myname, given cwd and root |
|
185 | """return the canonical path of myname, given cwd and root | |
182 |
|
186 | |||
183 | >>> def check(root, cwd, myname): |
|
187 | >>> def check(root, cwd, myname): | |
184 | ... a = pathauditor(root, realfs=False) |
|
188 | ... a = pathauditor(root, realfs=False) | |
185 | ... try: |
|
189 | ... try: | |
186 | ... return canonpath(root, cwd, myname, a) |
|
190 | ... return canonpath(root, cwd, myname, a) | |
187 | ... except error.Abort: |
|
191 | ... except error.Abort: | |
188 | ... return 'aborted' |
|
192 | ... return 'aborted' | |
189 | >>> def unixonly(root, cwd, myname, expected='aborted'): |
|
193 | >>> def unixonly(root, cwd, myname, expected='aborted'): | |
190 | ... if pycompat.iswindows: |
|
194 | ... if pycompat.iswindows: | |
191 | ... return expected |
|
195 | ... return expected | |
192 | ... return check(root, cwd, myname) |
|
196 | ... return check(root, cwd, myname) | |
193 | >>> def winonly(root, cwd, myname, expected='aborted'): |
|
197 | >>> def winonly(root, cwd, myname, expected='aborted'): | |
194 | ... if not pycompat.iswindows: |
|
198 | ... if not pycompat.iswindows: | |
195 | ... return expected |
|
199 | ... return expected | |
196 | ... return check(root, cwd, myname) |
|
200 | ... return check(root, cwd, myname) | |
197 | >>> winonly(b'd:\\\\repo', b'c:\\\\dir', b'filename') |
|
201 | >>> winonly(b'd:\\\\repo', b'c:\\\\dir', b'filename') | |
198 | 'aborted' |
|
202 | 'aborted' | |
199 | >>> winonly(b'c:\\\\repo', b'c:\\\\dir', b'filename') |
|
203 | >>> winonly(b'c:\\\\repo', b'c:\\\\dir', b'filename') | |
200 | 'aborted' |
|
204 | 'aborted' | |
201 | >>> winonly(b'c:\\\\repo', b'c:\\\\', b'filename') |
|
205 | >>> winonly(b'c:\\\\repo', b'c:\\\\', b'filename') | |
202 | 'aborted' |
|
206 | 'aborted' | |
203 | >>> winonly(b'c:\\\\repo', b'c:\\\\', b'repo\\\\filename', |
|
207 | >>> winonly(b'c:\\\\repo', b'c:\\\\', b'repo\\\\filename', | |
204 | ... b'filename') |
|
208 | ... b'filename') | |
205 | 'filename' |
|
209 | 'filename' | |
206 | >>> winonly(b'c:\\\\repo', b'c:\\\\repo', b'filename', b'filename') |
|
210 | >>> winonly(b'c:\\\\repo', b'c:\\\\repo', b'filename', b'filename') | |
207 | 'filename' |
|
211 | 'filename' | |
208 | >>> winonly(b'c:\\\\repo', b'c:\\\\repo\\\\subdir', b'filename', |
|
212 | >>> winonly(b'c:\\\\repo', b'c:\\\\repo\\\\subdir', b'filename', | |
209 | ... b'subdir/filename') |
|
213 | ... b'subdir/filename') | |
210 | 'subdir/filename' |
|
214 | 'subdir/filename' | |
211 | >>> unixonly(b'/repo', b'/dir', b'filename') |
|
215 | >>> unixonly(b'/repo', b'/dir', b'filename') | |
212 | 'aborted' |
|
216 | 'aborted' | |
213 | >>> unixonly(b'/repo', b'/', b'filename') |
|
217 | >>> unixonly(b'/repo', b'/', b'filename') | |
214 | 'aborted' |
|
218 | 'aborted' | |
215 | >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename') |
|
219 | >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename') | |
216 | 'filename' |
|
220 | 'filename' | |
217 | >>> unixonly(b'/repo', b'/repo', b'filename', b'filename') |
|
221 | >>> unixonly(b'/repo', b'/repo', b'filename', b'filename') | |
218 | 'filename' |
|
222 | 'filename' | |
219 | >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename') |
|
223 | >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename') | |
220 | 'subdir/filename' |
|
224 | 'subdir/filename' | |
221 | """ |
|
225 | """ | |
222 | if util.endswithsep(root): |
|
226 | if util.endswithsep(root): | |
223 | rootsep = root |
|
227 | rootsep = root | |
224 | else: |
|
228 | else: | |
225 | rootsep = root + pycompat.ossep |
|
229 | rootsep = root + pycompat.ossep | |
226 | name = myname |
|
230 | name = myname | |
227 | if not os.path.isabs(name): |
|
231 | if not os.path.isabs(name): | |
228 | name = os.path.join(root, cwd, name) |
|
232 | name = os.path.join(root, cwd, name) | |
229 | name = os.path.normpath(name) |
|
233 | name = os.path.normpath(name) | |
230 | if auditor is None: |
|
234 | if auditor is None: | |
231 | auditor = pathauditor(root) |
|
235 | auditor = pathauditor(root) | |
232 | if name != rootsep and name.startswith(rootsep): |
|
236 | if name != rootsep and name.startswith(rootsep): | |
233 | name = name[len(rootsep) :] |
|
237 | name = name[len(rootsep) :] | |
234 | auditor(name) |
|
238 | auditor(name) | |
235 | return util.pconvert(name) |
|
239 | return util.pconvert(name) | |
236 | elif name == root: |
|
240 | elif name == root: | |
237 | return b'' |
|
241 | return b'' | |
238 | else: |
|
242 | else: | |
239 | # Determine whether `name' is in the hierarchy at or beneath `root', |
|
243 | # Determine whether `name' is in the hierarchy at or beneath `root', | |
240 | # by iterating name=dirname(name) until that causes no change (can't |
|
244 | # by iterating name=dirname(name) until that causes no change (can't | |
241 | # check name == '/', because that doesn't work on windows). The list |
|
245 | # check name == '/', because that doesn't work on windows). The list | |
242 | # `rel' holds the reversed list of components making up the relative |
|
246 | # `rel' holds the reversed list of components making up the relative | |
243 | # file name we want. |
|
247 | # file name we want. | |
244 | rel = [] |
|
248 | rel = [] | |
245 | while True: |
|
249 | while True: | |
246 | try: |
|
250 | try: | |
247 | s = util.samefile(name, root) |
|
251 | s = util.samefile(name, root) | |
248 | except OSError: |
|
252 | except OSError: | |
249 | s = False |
|
253 | s = False | |
250 | if s: |
|
254 | if s: | |
251 | if not rel: |
|
255 | if not rel: | |
252 | # name was actually the same as root (maybe a symlink) |
|
256 | # name was actually the same as root (maybe a symlink) | |
253 | return b'' |
|
257 | return b'' | |
254 | rel.reverse() |
|
258 | rel.reverse() | |
255 | name = os.path.join(*rel) |
|
259 | name = os.path.join(*rel) | |
256 | auditor(name) |
|
260 | auditor(name) | |
257 | return util.pconvert(name) |
|
261 | return util.pconvert(name) | |
258 | dirname, basename = util.split(name) |
|
262 | dirname, basename = util.split(name) | |
259 | rel.append(basename) |
|
263 | rel.append(basename) | |
260 | if dirname == name: |
|
264 | if dirname == name: | |
261 | break |
|
265 | break | |
262 | name = dirname |
|
266 | name = dirname | |
263 |
|
267 | |||
264 | # A common mistake is to use -R, but specify a file relative to the repo |
|
268 | # A common mistake is to use -R, but specify a file relative to the repo | |
265 | # instead of cwd. Detect that case, and provide a hint to the user. |
|
269 | # instead of cwd. Detect that case, and provide a hint to the user. | |
266 | hint = None |
|
270 | hint = None | |
267 | try: |
|
271 | try: | |
268 | if cwd != root: |
|
272 | if cwd != root: | |
269 | canonpath(root, root, myname, auditor) |
|
273 | canonpath(root, root, myname, auditor) | |
270 | relpath = util.pathto(root, cwd, b'') |
|
274 | relpath = util.pathto(root, cwd, b'') | |
271 | if relpath.endswith(pycompat.ossep): |
|
275 | if relpath.endswith(pycompat.ossep): | |
272 | relpath = relpath[:-1] |
|
276 | relpath = relpath[:-1] | |
273 | hint = _(b"consider using '--cwd %s'") % relpath |
|
277 | hint = _(b"consider using '--cwd %s'") % relpath | |
274 | except error.Abort: |
|
278 | except error.Abort: | |
275 | pass |
|
279 | pass | |
276 |
|
280 | |||
277 | raise error.Abort( |
|
281 | raise error.Abort( | |
278 | _(b"%s not under root '%s'") % (myname, root), hint=hint |
|
282 | _(b"%s not under root '%s'") % (myname, root), hint=hint | |
279 | ) |
|
283 | ) | |
280 |
|
284 | |||
281 |
|
285 | |||
282 | def normasprefix(path): |
|
286 | def normasprefix(path): | |
283 | # type: (bytes) -> bytes |
|
287 | # type: (bytes) -> bytes | |
284 | """normalize the specified path as path prefix |
|
288 | """normalize the specified path as path prefix | |
285 |
|
289 | |||
286 | Returned value can be used safely for "p.startswith(prefix)", |
|
290 | Returned value can be used safely for "p.startswith(prefix)", | |
287 | "p[len(prefix):]", and so on. |
|
291 | "p[len(prefix):]", and so on. | |
288 |
|
292 | |||
289 | For efficiency, this expects "path" argument to be already |
|
293 | For efficiency, this expects "path" argument to be already | |
290 | normalized by "os.path.normpath", "os.path.realpath", and so on. |
|
294 | normalized by "os.path.normpath", "os.path.realpath", and so on. | |
291 |
|
295 | |||
292 | See also issue3033 for detail about need of this function. |
|
296 | See also issue3033 for detail about need of this function. | |
293 |
|
297 | |||
294 | >>> normasprefix(b'/foo/bar').replace(pycompat.ossep, b'/') |
|
298 | >>> normasprefix(b'/foo/bar').replace(pycompat.ossep, b'/') | |
295 | '/foo/bar/' |
|
299 | '/foo/bar/' | |
296 | >>> normasprefix(b'/').replace(pycompat.ossep, b'/') |
|
300 | >>> normasprefix(b'/').replace(pycompat.ossep, b'/') | |
297 | '/' |
|
301 | '/' | |
298 | """ |
|
302 | """ | |
299 | d, p = os.path.splitdrive(path) |
|
303 | d, p = os.path.splitdrive(path) | |
300 | if len(p) != len(pycompat.ossep): |
|
304 | if len(p) != len(pycompat.ossep): | |
301 | return path + pycompat.ossep |
|
305 | return path + pycompat.ossep | |
302 | else: |
|
306 | else: | |
303 | return path |
|
307 | return path | |
304 |
|
308 | |||
305 |
|
309 | |||
306 | def finddirs(path): |
|
310 | def finddirs(path): | |
307 | # type: (bytes) -> Iterator[bytes] |
|
311 | # type: (bytes) -> Iterator[bytes] | |
308 | pos = path.rfind(b'/') |
|
312 | pos = path.rfind(b'/') | |
309 | while pos != -1: |
|
313 | while pos != -1: | |
310 | yield path[:pos] |
|
314 | yield path[:pos] | |
311 | pos = path.rfind(b'/', 0, pos) |
|
315 | pos = path.rfind(b'/', 0, pos) | |
312 | yield b'' |
|
316 | yield b'' | |
313 |
|
317 | |||
314 |
|
318 | |||
315 | class dirs(object): |
|
319 | class dirs(object): | |
316 | '''a multiset of directory names from a set of file paths''' |
|
320 | '''a multiset of directory names from a set of file paths''' | |
317 |
|
321 | |||
318 | def __init__(self, map, only_tracked=False): |
|
322 | def __init__(self, map, only_tracked=False): | |
319 | """ |
|
323 | """ | |
320 | a dict map indicates a dirstate while a list indicates a manifest |
|
324 | a dict map indicates a dirstate while a list indicates a manifest | |
321 | """ |
|
325 | """ | |
322 | self._dirs = {} |
|
326 | self._dirs = {} | |
323 | addpath = self.addpath |
|
327 | addpath = self.addpath | |
324 | if isinstance(map, dict) and only_tracked: |
|
328 | if isinstance(map, dict) and only_tracked: | |
325 | for f, s in pycompat.iteritems(map): |
|
329 | for f, s in pycompat.iteritems(map): | |
326 | if s.state != b'r': |
|
330 | if s.state != b'r': | |
327 | addpath(f) |
|
331 | addpath(f) | |
328 | elif only_tracked: |
|
332 | elif only_tracked: | |
329 | msg = b"`only_tracked` is only supported with a dict source" |
|
333 | msg = b"`only_tracked` is only supported with a dict source" | |
330 | raise error.ProgrammingError(msg) |
|
334 | raise error.ProgrammingError(msg) | |
331 | else: |
|
335 | else: | |
332 | for f in map: |
|
336 | for f in map: | |
333 | addpath(f) |
|
337 | addpath(f) | |
334 |
|
338 | |||
335 | def addpath(self, path): |
|
339 | def addpath(self, path): | |
336 | # type: (bytes) -> None |
|
340 | # type: (bytes) -> None | |
337 | dirs = self._dirs |
|
341 | dirs = self._dirs | |
338 | for base in finddirs(path): |
|
342 | for base in finddirs(path): | |
339 | if base.endswith(b'/'): |
|
343 | if base.endswith(b'/'): | |
340 | raise ValueError( |
|
344 | raise ValueError( | |
341 | "found invalid consecutive slashes in path: %r" % base |
|
345 | "found invalid consecutive slashes in path: %r" % base | |
342 | ) |
|
346 | ) | |
343 | if base in dirs: |
|
347 | if base in dirs: | |
344 | dirs[base] += 1 |
|
348 | dirs[base] += 1 | |
345 | return |
|
349 | return | |
346 | dirs[base] = 1 |
|
350 | dirs[base] = 1 | |
347 |
|
351 | |||
348 | def delpath(self, path): |
|
352 | def delpath(self, path): | |
349 | # type: (bytes) -> None |
|
353 | # type: (bytes) -> None | |
350 | dirs = self._dirs |
|
354 | dirs = self._dirs | |
351 | for base in finddirs(path): |
|
355 | for base in finddirs(path): | |
352 | if dirs[base] > 1: |
|
356 | if dirs[base] > 1: | |
353 | dirs[base] -= 1 |
|
357 | dirs[base] -= 1 | |
354 | return |
|
358 | return | |
355 | del dirs[base] |
|
359 | del dirs[base] | |
356 |
|
360 | |||
357 | def __iter__(self): |
|
361 | def __iter__(self): | |
358 | return iter(self._dirs) |
|
362 | return iter(self._dirs) | |
359 |
|
363 | |||
360 | def __contains__(self, d): |
|
364 | def __contains__(self, d): | |
361 | # type: (bytes) -> bool |
|
365 | # type: (bytes) -> bool | |
362 | return d in self._dirs |
|
366 | return d in self._dirs | |
363 |
|
367 | |||
364 |
|
368 | |||
365 | if util.safehasattr(parsers, 'dirs'): |
|
369 | if util.safehasattr(parsers, 'dirs'): | |
366 | dirs = parsers.dirs |
|
370 | dirs = parsers.dirs | |
367 |
|
371 | |||
368 | if rustdirs is not None: |
|
372 | if rustdirs is not None: | |
369 | dirs = rustdirs |
|
373 | dirs = rustdirs | |
370 |
|
374 | |||
371 |
|
375 | |||
372 | # forward two methods from posixpath that do what we need, but we'd |
|
376 | # forward two methods from posixpath that do what we need, but we'd | |
373 | # rather not let our internals know that we're thinking in posix terms |
|
377 | # rather not let our internals know that we're thinking in posix terms | |
374 | # - instead we'll let them be oblivious. |
|
378 | # - instead we'll let them be oblivious. | |
375 | join = posixpath.join |
|
379 | join = posixpath.join | |
376 | dirname = posixpath.dirname # type: Callable[[bytes], bytes] |
|
380 | dirname = posixpath.dirname # type: Callable[[bytes], bytes] |
@@ -1,240 +1,240 b'' | |||||
1 | The simple store doesn't escape paths robustly and can't store paths |
|
1 | The simple store doesn't escape paths robustly and can't store paths | |
2 | with periods, etc. So much of this test fails with it. |
|
2 | with periods, etc. So much of this test fails with it. | |
3 | #require no-reposimplestore |
|
3 | #require no-reposimplestore | |
4 |
|
4 | |||
5 | $ hg init |
|
5 | $ hg init | |
6 |
|
6 | |||
7 | audit of .hg |
|
7 | audit of .hg | |
8 |
|
8 | |||
9 | $ hg add .hg/00changelog.i |
|
9 | $ hg add .hg/00changelog.i | |
10 | abort: path contains illegal component: .hg/00changelog.i |
|
10 | abort: path contains illegal component: .hg/00changelog.i | |
11 |
[ |
|
11 | [10] | |
12 |
|
12 | |||
13 | #if symlink |
|
13 | #if symlink | |
14 |
|
14 | |||
15 | Symlinks |
|
15 | Symlinks | |
16 |
|
16 | |||
17 | $ mkdir a |
|
17 | $ mkdir a | |
18 | $ echo a > a/a |
|
18 | $ echo a > a/a | |
19 | $ hg ci -Ama |
|
19 | $ hg ci -Ama | |
20 | adding a/a |
|
20 | adding a/a | |
21 | $ ln -s a b |
|
21 | $ ln -s a b | |
22 | $ echo b > a/b |
|
22 | $ echo b > a/b | |
23 | $ hg add b/b |
|
23 | $ hg add b/b | |
24 | abort: path 'b/b' traverses symbolic link 'b' |
|
24 | abort: path 'b/b' traverses symbolic link 'b' | |
25 | [255] |
|
25 | [255] | |
26 | $ hg add b |
|
26 | $ hg add b | |
27 |
|
27 | |||
28 | should still fail - maybe |
|
28 | should still fail - maybe | |
29 |
|
29 | |||
30 | $ hg add b/b |
|
30 | $ hg add b/b | |
31 | abort: path 'b/b' traverses symbolic link 'b' |
|
31 | abort: path 'b/b' traverses symbolic link 'b' | |
32 | [255] |
|
32 | [255] | |
33 |
|
33 | |||
34 | $ hg commit -m 'add symlink b' |
|
34 | $ hg commit -m 'add symlink b' | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | Test symlink traversing when accessing history: |
|
37 | Test symlink traversing when accessing history: | |
38 | ----------------------------------------------- |
|
38 | ----------------------------------------------- | |
39 |
|
39 | |||
40 | (build a changeset where the path exists as a directory) |
|
40 | (build a changeset where the path exists as a directory) | |
41 |
|
41 | |||
42 | $ hg up 0 |
|
42 | $ hg up 0 | |
43 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
43 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
44 | $ mkdir b |
|
44 | $ mkdir b | |
45 | $ echo c > b/a |
|
45 | $ echo c > b/a | |
46 | $ hg add b/a |
|
46 | $ hg add b/a | |
47 | $ hg ci -m 'add directory b' |
|
47 | $ hg ci -m 'add directory b' | |
48 | created new head |
|
48 | created new head | |
49 |
|
49 | |||
50 | Test that hg cat does not do anything wrong the working copy has 'b' as directory |
|
50 | Test that hg cat does not do anything wrong the working copy has 'b' as directory | |
51 |
|
51 | |||
52 | $ hg cat b/a |
|
52 | $ hg cat b/a | |
53 | c |
|
53 | c | |
54 | $ hg cat -r "desc(directory)" b/a |
|
54 | $ hg cat -r "desc(directory)" b/a | |
55 | c |
|
55 | c | |
56 | $ hg cat -r "desc(symlink)" b/a |
|
56 | $ hg cat -r "desc(symlink)" b/a | |
57 | b/a: no such file in rev bc151a1f53bd |
|
57 | b/a: no such file in rev bc151a1f53bd | |
58 | [1] |
|
58 | [1] | |
59 |
|
59 | |||
60 | Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749) |
|
60 | Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749) | |
61 |
|
61 | |||
62 | $ hg up 'desc(symlink)' |
|
62 | $ hg up 'desc(symlink)' | |
63 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
63 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
64 | $ hg cat b/a |
|
64 | $ hg cat b/a | |
65 | b/a: no such file in rev bc151a1f53bd |
|
65 | b/a: no such file in rev bc151a1f53bd | |
66 | [1] |
|
66 | [1] | |
67 | $ hg cat -r "desc(directory)" b/a |
|
67 | $ hg cat -r "desc(directory)" b/a | |
68 | c |
|
68 | c | |
69 | $ hg cat -r "desc(symlink)" b/a |
|
69 | $ hg cat -r "desc(symlink)" b/a | |
70 | b/a: no such file in rev bc151a1f53bd |
|
70 | b/a: no such file in rev bc151a1f53bd | |
71 | [1] |
|
71 | [1] | |
72 |
|
72 | |||
73 | #endif |
|
73 | #endif | |
74 |
|
74 | |||
75 |
|
75 | |||
76 | unbundle tampered bundle |
|
76 | unbundle tampered bundle | |
77 |
|
77 | |||
78 | $ hg init target |
|
78 | $ hg init target | |
79 | $ cd target |
|
79 | $ cd target | |
80 | $ hg unbundle "$TESTDIR/bundles/tampered.hg" |
|
80 | $ hg unbundle "$TESTDIR/bundles/tampered.hg" | |
81 | adding changesets |
|
81 | adding changesets | |
82 | adding manifests |
|
82 | adding manifests | |
83 | adding file changes |
|
83 | adding file changes | |
84 | added 5 changesets with 6 changes to 6 files (+4 heads) |
|
84 | added 5 changesets with 6 changes to 6 files (+4 heads) | |
85 | new changesets b7da9bf6b037:fc1393d727bc (5 drafts) |
|
85 | new changesets b7da9bf6b037:fc1393d727bc (5 drafts) | |
86 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
86 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
87 |
|
87 | |||
88 | attack .hg/test |
|
88 | attack .hg/test | |
89 |
|
89 | |||
90 | $ hg manifest -r0 |
|
90 | $ hg manifest -r0 | |
91 | .hg/test |
|
91 | .hg/test | |
92 | $ hg update -Cr0 |
|
92 | $ hg update -Cr0 | |
93 | abort: path contains illegal component: .hg/test |
|
93 | abort: path contains illegal component: .hg/test | |
94 |
[ |
|
94 | [10] | |
95 |
|
95 | |||
96 | attack foo/.hg/test |
|
96 | attack foo/.hg/test | |
97 |
|
97 | |||
98 | $ hg manifest -r1 |
|
98 | $ hg manifest -r1 | |
99 | foo/.hg/test |
|
99 | foo/.hg/test | |
100 | $ hg update -Cr1 |
|
100 | $ hg update -Cr1 | |
101 | abort: path 'foo/.hg/test' is inside nested repo 'foo' |
|
101 | abort: path 'foo/.hg/test' is inside nested repo 'foo' | |
102 |
[ |
|
102 | [10] | |
103 |
|
103 | |||
104 | attack back/test where back symlinks to .. |
|
104 | attack back/test where back symlinks to .. | |
105 |
|
105 | |||
106 | $ hg manifest -r2 |
|
106 | $ hg manifest -r2 | |
107 | back |
|
107 | back | |
108 | back/test |
|
108 | back/test | |
109 | #if symlink |
|
109 | #if symlink | |
110 | $ hg update -Cr2 |
|
110 | $ hg update -Cr2 | |
111 | abort: path 'back/test' traverses symbolic link 'back' |
|
111 | abort: path 'back/test' traverses symbolic link 'back' | |
112 | [255] |
|
112 | [255] | |
113 | #else |
|
113 | #else | |
114 | ('back' will be a file and cause some other system specific error) |
|
114 | ('back' will be a file and cause some other system specific error) | |
115 | $ hg update -Cr2 |
|
115 | $ hg update -Cr2 | |
116 | abort: $TESTTMP/target/back/test: $ENOTDIR$ |
|
116 | abort: $TESTTMP/target/back/test: $ENOTDIR$ | |
117 | [255] |
|
117 | [255] | |
118 | #endif |
|
118 | #endif | |
119 |
|
119 | |||
120 | attack ../test |
|
120 | attack ../test | |
121 |
|
121 | |||
122 | $ hg manifest -r3 |
|
122 | $ hg manifest -r3 | |
123 | ../test |
|
123 | ../test | |
124 | $ mkdir ../test |
|
124 | $ mkdir ../test | |
125 | $ echo data > ../test/file |
|
125 | $ echo data > ../test/file | |
126 | $ hg update -Cr3 |
|
126 | $ hg update -Cr3 | |
127 | abort: path contains illegal component: ../test |
|
127 | abort: path contains illegal component: ../test | |
128 |
[ |
|
128 | [10] | |
129 | $ cat ../test/file |
|
129 | $ cat ../test/file | |
130 | data |
|
130 | data | |
131 |
|
131 | |||
132 | attack /tmp/test |
|
132 | attack /tmp/test | |
133 |
|
133 | |||
134 | $ hg manifest -r4 |
|
134 | $ hg manifest -r4 | |
135 | /tmp/test |
|
135 | /tmp/test | |
136 | $ hg update -Cr4 |
|
136 | $ hg update -Cr4 | |
137 | abort: path contains illegal component: /tmp/test |
|
137 | abort: path contains illegal component: /tmp/test | |
138 |
[ |
|
138 | [10] | |
139 |
|
139 | |||
140 | $ cd .. |
|
140 | $ cd .. | |
141 |
|
141 | |||
142 | Test symlink traversal on merge: |
|
142 | Test symlink traversal on merge: | |
143 | -------------------------------- |
|
143 | -------------------------------- | |
144 |
|
144 | |||
145 | #if symlink |
|
145 | #if symlink | |
146 |
|
146 | |||
147 | set up symlink hell |
|
147 | set up symlink hell | |
148 |
|
148 | |||
149 | $ mkdir merge-symlink-out |
|
149 | $ mkdir merge-symlink-out | |
150 | $ hg init merge-symlink |
|
150 | $ hg init merge-symlink | |
151 | $ cd merge-symlink |
|
151 | $ cd merge-symlink | |
152 | $ touch base |
|
152 | $ touch base | |
153 | $ hg commit -qAm base |
|
153 | $ hg commit -qAm base | |
154 | $ ln -s ../merge-symlink-out a |
|
154 | $ ln -s ../merge-symlink-out a | |
155 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' |
|
155 | $ hg commit -qAm 'symlink a -> ../merge-symlink-out' | |
156 | $ hg up -q 0 |
|
156 | $ hg up -q 0 | |
157 | $ mkdir a |
|
157 | $ mkdir a | |
158 | $ touch a/poisoned |
|
158 | $ touch a/poisoned | |
159 | $ hg commit -qAm 'file a/poisoned' |
|
159 | $ hg commit -qAm 'file a/poisoned' | |
160 | $ hg log -G -T '{rev}: {desc}\n' |
|
160 | $ hg log -G -T '{rev}: {desc}\n' | |
161 | @ 2: file a/poisoned |
|
161 | @ 2: file a/poisoned | |
162 | | |
|
162 | | | |
163 | | o 1: symlink a -> ../merge-symlink-out |
|
163 | | o 1: symlink a -> ../merge-symlink-out | |
164 | |/ |
|
164 | |/ | |
165 | o 0: base |
|
165 | o 0: base | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | try trivial merge |
|
168 | try trivial merge | |
169 |
|
169 | |||
170 | $ hg up -qC 1 |
|
170 | $ hg up -qC 1 | |
171 | $ hg merge 2 |
|
171 | $ hg merge 2 | |
172 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
172 | abort: path 'a/poisoned' traverses symbolic link 'a' | |
173 | [255] |
|
173 | [255] | |
174 |
|
174 | |||
175 | try rebase onto other revision: cache of audited paths should be discarded, |
|
175 | try rebase onto other revision: cache of audited paths should be discarded, | |
176 | and the rebase should fail (issue5628) |
|
176 | and the rebase should fail (issue5628) | |
177 |
|
177 | |||
178 | $ hg up -qC 2 |
|
178 | $ hg up -qC 2 | |
179 | $ hg rebase -s 2 -d 1 --config extensions.rebase= |
|
179 | $ hg rebase -s 2 -d 1 --config extensions.rebase= | |
180 | rebasing 2:e73c21d6b244 tip "file a/poisoned" |
|
180 | rebasing 2:e73c21d6b244 tip "file a/poisoned" | |
181 | abort: path 'a/poisoned' traverses symbolic link 'a' |
|
181 | abort: path 'a/poisoned' traverses symbolic link 'a' | |
182 | [255] |
|
182 | [255] | |
183 | $ ls ../merge-symlink-out |
|
183 | $ ls ../merge-symlink-out | |
184 |
|
184 | |||
185 | $ cd .. |
|
185 | $ cd .. | |
186 |
|
186 | |||
187 | Test symlink traversal on update: |
|
187 | Test symlink traversal on update: | |
188 | --------------------------------- |
|
188 | --------------------------------- | |
189 |
|
189 | |||
190 | $ mkdir update-symlink-out |
|
190 | $ mkdir update-symlink-out | |
191 | $ hg init update-symlink |
|
191 | $ hg init update-symlink | |
192 | $ cd update-symlink |
|
192 | $ cd update-symlink | |
193 | $ ln -s ../update-symlink-out a |
|
193 | $ ln -s ../update-symlink-out a | |
194 | $ hg commit -qAm 'symlink a -> ../update-symlink-out' |
|
194 | $ hg commit -qAm 'symlink a -> ../update-symlink-out' | |
195 | $ hg rm a |
|
195 | $ hg rm a | |
196 | $ mkdir a && touch a/b |
|
196 | $ mkdir a && touch a/b | |
197 | $ hg ci -qAm 'file a/b' a/b |
|
197 | $ hg ci -qAm 'file a/b' a/b | |
198 | $ hg up -qC 0 |
|
198 | $ hg up -qC 0 | |
199 | $ hg rm a |
|
199 | $ hg rm a | |
200 | $ mkdir a && touch a/c |
|
200 | $ mkdir a && touch a/c | |
201 | $ hg ci -qAm 'rm a, file a/c' |
|
201 | $ hg ci -qAm 'rm a, file a/c' | |
202 | $ hg log -G -T '{rev}: {desc}\n' |
|
202 | $ hg log -G -T '{rev}: {desc}\n' | |
203 | @ 2: rm a, file a/c |
|
203 | @ 2: rm a, file a/c | |
204 | | |
|
204 | | | |
205 | | o 1: file a/b |
|
205 | | o 1: file a/b | |
206 | |/ |
|
206 | |/ | |
207 | o 0: symlink a -> ../update-symlink-out |
|
207 | o 0: symlink a -> ../update-symlink-out | |
208 |
|
208 | |||
209 |
|
209 | |||
210 | try linear update where symlink already exists: |
|
210 | try linear update where symlink already exists: | |
211 |
|
211 | |||
212 | $ hg up -qC 0 |
|
212 | $ hg up -qC 0 | |
213 | $ hg up 1 |
|
213 | $ hg up 1 | |
214 | abort: path 'a/b' traverses symbolic link 'a' |
|
214 | abort: path 'a/b' traverses symbolic link 'a' | |
215 | [255] |
|
215 | [255] | |
216 |
|
216 | |||
217 | try linear update including symlinked directory and its content: paths are |
|
217 | try linear update including symlinked directory and its content: paths are | |
218 | audited first by calculateupdates(), where no symlink is created so both |
|
218 | audited first by calculateupdates(), where no symlink is created so both | |
219 | 'a' and 'a/b' are taken as good paths. still applyupdates() should fail. |
|
219 | 'a' and 'a/b' are taken as good paths. still applyupdates() should fail. | |
220 |
|
220 | |||
221 | $ hg up -qC null |
|
221 | $ hg up -qC null | |
222 | $ hg up 1 |
|
222 | $ hg up 1 | |
223 | abort: path 'a/b' traverses symbolic link 'a' |
|
223 | abort: path 'a/b' traverses symbolic link 'a' | |
224 | [255] |
|
224 | [255] | |
225 | $ ls ../update-symlink-out |
|
225 | $ ls ../update-symlink-out | |
226 |
|
226 | |||
227 | try branch update replacing directory with symlink, and its content: the |
|
227 | try branch update replacing directory with symlink, and its content: the | |
228 | path 'a' is audited as a directory first, which should be audited again as |
|
228 | path 'a' is audited as a directory first, which should be audited again as | |
229 | a symlink. |
|
229 | a symlink. | |
230 |
|
230 | |||
231 | $ rm -f a |
|
231 | $ rm -f a | |
232 | $ hg up -qC 2 |
|
232 | $ hg up -qC 2 | |
233 | $ hg up 1 |
|
233 | $ hg up 1 | |
234 | abort: path 'a/b' traverses symbolic link 'a' |
|
234 | abort: path 'a/b' traverses symbolic link 'a' | |
235 | [255] |
|
235 | [255] | |
236 | $ ls ../update-symlink-out |
|
236 | $ ls ../update-symlink-out | |
237 |
|
237 | |||
238 | $ cd .. |
|
238 | $ cd .. | |
239 |
|
239 | |||
240 | #endif |
|
240 | #endif |
@@ -1,732 +1,732 b'' | |||||
1 | Test illegal name |
|
1 | Test illegal name | |
2 | ----------------- |
|
2 | ----------------- | |
3 |
|
3 | |||
4 | on commit: |
|
4 | on commit: | |
5 |
|
5 | |||
6 | $ hg init hgname |
|
6 | $ hg init hgname | |
7 | $ cd hgname |
|
7 | $ cd hgname | |
8 | $ mkdir sub |
|
8 | $ mkdir sub | |
9 | $ hg init sub/.hg |
|
9 | $ hg init sub/.hg | |
10 | $ echo 'sub/.hg = sub/.hg' >> .hgsub |
|
10 | $ echo 'sub/.hg = sub/.hg' >> .hgsub | |
11 | $ hg ci -qAm 'add subrepo "sub/.hg"' |
|
11 | $ hg ci -qAm 'add subrepo "sub/.hg"' | |
12 | abort: path 'sub/.hg' is inside nested repo 'sub' |
|
12 | abort: path 'sub/.hg' is inside nested repo 'sub' | |
13 |
[ |
|
13 | [10] | |
14 |
|
14 | |||
15 | prepare tampered repo (including the commit above): |
|
15 | prepare tampered repo (including the commit above): | |
16 |
|
16 | |||
17 | $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF' |
|
17 | $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF' | |
18 | > diff --git a/.hgsub b/.hgsub |
|
18 | > diff --git a/.hgsub b/.hgsub | |
19 | > new file mode 100644 |
|
19 | > new file mode 100644 | |
20 | > --- /dev/null |
|
20 | > --- /dev/null | |
21 | > +++ b/.hgsub |
|
21 | > +++ b/.hgsub | |
22 | > @@ -0,0 +1,1 @@ |
|
22 | > @@ -0,0 +1,1 @@ | |
23 | > +sub/.hg = sub/.hg |
|
23 | > +sub/.hg = sub/.hg | |
24 | > diff --git a/.hgsubstate b/.hgsubstate |
|
24 | > diff --git a/.hgsubstate b/.hgsubstate | |
25 | > new file mode 100644 |
|
25 | > new file mode 100644 | |
26 | > --- /dev/null |
|
26 | > --- /dev/null | |
27 | > +++ b/.hgsubstate |
|
27 | > +++ b/.hgsubstate | |
28 | > @@ -0,0 +1,1 @@ |
|
28 | > @@ -0,0 +1,1 @@ | |
29 | > +0000000000000000000000000000000000000000 sub/.hg |
|
29 | > +0000000000000000000000000000000000000000 sub/.hg | |
30 | > EOF |
|
30 | > EOF | |
31 | $ cd .. |
|
31 | $ cd .. | |
32 |
|
32 | |||
33 | on clone (and update): |
|
33 | on clone (and update): | |
34 |
|
34 | |||
35 | $ hg clone -q hgname hgname2 |
|
35 | $ hg clone -q hgname hgname2 | |
36 | abort: path 'sub/.hg' is inside nested repo 'sub' |
|
36 | abort: path 'sub/.hg' is inside nested repo 'sub' | |
37 |
[ |
|
37 | [10] | |
38 |
|
38 | |||
39 | Test absolute path |
|
39 | Test absolute path | |
40 | ------------------ |
|
40 | ------------------ | |
41 |
|
41 | |||
42 | on commit: |
|
42 | on commit: | |
43 |
|
43 | |||
44 | $ hg init absolutepath |
|
44 | $ hg init absolutepath | |
45 | $ cd absolutepath |
|
45 | $ cd absolutepath | |
46 | $ hg init sub |
|
46 | $ hg init sub | |
47 | $ echo '/sub = sub' >> .hgsub |
|
47 | $ echo '/sub = sub' >> .hgsub | |
48 | $ hg ci -qAm 'add subrepo "/sub"' |
|
48 | $ hg ci -qAm 'add subrepo "/sub"' | |
49 | abort: path contains illegal component: /sub |
|
49 | abort: path contains illegal component: /sub | |
50 |
[ |
|
50 | [10] | |
51 |
|
51 | |||
52 | prepare tampered repo (including the commit above): |
|
52 | prepare tampered repo (including the commit above): | |
53 |
|
53 | |||
54 | $ hg import --bypass -qm 'add subrepo "/sub"' - <<'EOF' |
|
54 | $ hg import --bypass -qm 'add subrepo "/sub"' - <<'EOF' | |
55 | > diff --git a/.hgsub b/.hgsub |
|
55 | > diff --git a/.hgsub b/.hgsub | |
56 | > new file mode 100644 |
|
56 | > new file mode 100644 | |
57 | > --- /dev/null |
|
57 | > --- /dev/null | |
58 | > +++ b/.hgsub |
|
58 | > +++ b/.hgsub | |
59 | > @@ -0,0 +1,1 @@ |
|
59 | > @@ -0,0 +1,1 @@ | |
60 | > +/sub = sub |
|
60 | > +/sub = sub | |
61 | > diff --git a/.hgsubstate b/.hgsubstate |
|
61 | > diff --git a/.hgsubstate b/.hgsubstate | |
62 | > new file mode 100644 |
|
62 | > new file mode 100644 | |
63 | > --- /dev/null |
|
63 | > --- /dev/null | |
64 | > +++ b/.hgsubstate |
|
64 | > +++ b/.hgsubstate | |
65 | > @@ -0,0 +1,1 @@ |
|
65 | > @@ -0,0 +1,1 @@ | |
66 | > +0000000000000000000000000000000000000000 /sub |
|
66 | > +0000000000000000000000000000000000000000 /sub | |
67 | > EOF |
|
67 | > EOF | |
68 | $ cd .. |
|
68 | $ cd .. | |
69 |
|
69 | |||
70 | on clone (and update): |
|
70 | on clone (and update): | |
71 |
|
71 | |||
72 | $ hg clone -q absolutepath absolutepath2 |
|
72 | $ hg clone -q absolutepath absolutepath2 | |
73 | abort: path contains illegal component: /sub |
|
73 | abort: path contains illegal component: /sub | |
74 |
[ |
|
74 | [10] | |
75 |
|
75 | |||
76 | Test root path |
|
76 | Test root path | |
77 | -------------- |
|
77 | -------------- | |
78 |
|
78 | |||
79 | on commit: |
|
79 | on commit: | |
80 |
|
80 | |||
81 | $ hg init rootpath |
|
81 | $ hg init rootpath | |
82 | $ cd rootpath |
|
82 | $ cd rootpath | |
83 | $ hg init sub |
|
83 | $ hg init sub | |
84 | $ echo '/ = sub' >> .hgsub |
|
84 | $ echo '/ = sub' >> .hgsub | |
85 | $ hg ci -qAm 'add subrepo "/"' |
|
85 | $ hg ci -qAm 'add subrepo "/"' | |
86 | abort: path ends in directory separator: / |
|
86 | abort: path ends in directory separator: / | |
87 |
[ |
|
87 | [10] | |
88 |
|
88 | |||
89 | prepare tampered repo (including the commit above): |
|
89 | prepare tampered repo (including the commit above): | |
90 |
|
90 | |||
91 | $ hg import --bypass -qm 'add subrepo "/"' - <<'EOF' |
|
91 | $ hg import --bypass -qm 'add subrepo "/"' - <<'EOF' | |
92 | > diff --git a/.hgsub b/.hgsub |
|
92 | > diff --git a/.hgsub b/.hgsub | |
93 | > new file mode 100644 |
|
93 | > new file mode 100644 | |
94 | > --- /dev/null |
|
94 | > --- /dev/null | |
95 | > +++ b/.hgsub |
|
95 | > +++ b/.hgsub | |
96 | > @@ -0,0 +1,1 @@ |
|
96 | > @@ -0,0 +1,1 @@ | |
97 | > +/ = sub |
|
97 | > +/ = sub | |
98 | > diff --git a/.hgsubstate b/.hgsubstate |
|
98 | > diff --git a/.hgsubstate b/.hgsubstate | |
99 | > new file mode 100644 |
|
99 | > new file mode 100644 | |
100 | > --- /dev/null |
|
100 | > --- /dev/null | |
101 | > +++ b/.hgsubstate |
|
101 | > +++ b/.hgsubstate | |
102 | > @@ -0,0 +1,1 @@ |
|
102 | > @@ -0,0 +1,1 @@ | |
103 | > +0000000000000000000000000000000000000000 / |
|
103 | > +0000000000000000000000000000000000000000 / | |
104 | > EOF |
|
104 | > EOF | |
105 | $ cd .. |
|
105 | $ cd .. | |
106 |
|
106 | |||
107 | on clone (and update): |
|
107 | on clone (and update): | |
108 |
|
108 | |||
109 | $ hg clone -q rootpath rootpath2 |
|
109 | $ hg clone -q rootpath rootpath2 | |
110 | abort: path ends in directory separator: / |
|
110 | abort: path ends in directory separator: / | |
111 |
[ |
|
111 | [10] | |
112 |
|
112 | |||
113 | Test empty path |
|
113 | Test empty path | |
114 | --------------- |
|
114 | --------------- | |
115 |
|
115 | |||
116 | on commit: |
|
116 | on commit: | |
117 |
|
117 | |||
118 | $ hg init emptypath |
|
118 | $ hg init emptypath | |
119 | $ cd emptypath |
|
119 | $ cd emptypath | |
120 | $ hg init sub |
|
120 | $ hg init sub | |
121 | $ echo '= sub' >> .hgsub |
|
121 | $ echo '= sub' >> .hgsub | |
122 | $ hg ci -qAm 'add subrepo ""' |
|
122 | $ hg ci -qAm 'add subrepo ""' | |
123 | config error at .hgsub:1: = sub |
|
123 | config error at .hgsub:1: = sub | |
124 | [30] |
|
124 | [30] | |
125 |
|
125 | |||
126 | prepare tampered repo (including the commit above): |
|
126 | prepare tampered repo (including the commit above): | |
127 |
|
127 | |||
128 | $ hg import --bypass -qm 'add subrepo ""' - <<'EOF' |
|
128 | $ hg import --bypass -qm 'add subrepo ""' - <<'EOF' | |
129 | > diff --git a/.hgsub b/.hgsub |
|
129 | > diff --git a/.hgsub b/.hgsub | |
130 | > new file mode 100644 |
|
130 | > new file mode 100644 | |
131 | > --- /dev/null |
|
131 | > --- /dev/null | |
132 | > +++ b/.hgsub |
|
132 | > +++ b/.hgsub | |
133 | > @@ -0,0 +1,1 @@ |
|
133 | > @@ -0,0 +1,1 @@ | |
134 | > += sub |
|
134 | > += sub | |
135 | > diff --git a/.hgsubstate b/.hgsubstate |
|
135 | > diff --git a/.hgsubstate b/.hgsubstate | |
136 | > new file mode 100644 |
|
136 | > new file mode 100644 | |
137 | > --- /dev/null |
|
137 | > --- /dev/null | |
138 | > +++ b/.hgsubstate |
|
138 | > +++ b/.hgsubstate | |
139 | > @@ -0,0 +1,1 @@ |
|
139 | > @@ -0,0 +1,1 @@ | |
140 | > +0000000000000000000000000000000000000000 |
|
140 | > +0000000000000000000000000000000000000000 | |
141 | > EOF |
|
141 | > EOF | |
142 | $ cd .. |
|
142 | $ cd .. | |
143 |
|
143 | |||
144 | on clone (and update): |
|
144 | on clone (and update): | |
145 |
|
145 | |||
146 | $ hg clone -q emptypath emptypath2 |
|
146 | $ hg clone -q emptypath emptypath2 | |
147 | config error at .hgsub:1: = sub |
|
147 | config error at .hgsub:1: = sub | |
148 | [30] |
|
148 | [30] | |
149 |
|
149 | |||
150 | Test current path |
|
150 | Test current path | |
151 | ----------------- |
|
151 | ----------------- | |
152 |
|
152 | |||
153 | on commit: |
|
153 | on commit: | |
154 |
|
154 | |||
155 | $ hg init currentpath |
|
155 | $ hg init currentpath | |
156 | $ cd currentpath |
|
156 | $ cd currentpath | |
157 | $ hg init sub |
|
157 | $ hg init sub | |
158 | $ echo '. = sub' >> .hgsub |
|
158 | $ echo '. = sub' >> .hgsub | |
159 | $ hg ci -qAm 'add subrepo "."' |
|
159 | $ hg ci -qAm 'add subrepo "."' | |
160 | abort: subrepo path contains illegal component: . |
|
160 | abort: subrepo path contains illegal component: . | |
161 | [255] |
|
161 | [255] | |
162 |
|
162 | |||
163 | prepare tampered repo (including the commit above): |
|
163 | prepare tampered repo (including the commit above): | |
164 |
|
164 | |||
165 | $ hg import --bypass -qm 'add subrepo "."' - <<'EOF' |
|
165 | $ hg import --bypass -qm 'add subrepo "."' - <<'EOF' | |
166 | > diff --git a/.hgsub b/.hgsub |
|
166 | > diff --git a/.hgsub b/.hgsub | |
167 | > new file mode 100644 |
|
167 | > new file mode 100644 | |
168 | > --- /dev/null |
|
168 | > --- /dev/null | |
169 | > +++ b/.hgsub |
|
169 | > +++ b/.hgsub | |
170 | > @@ -0,0 +1,1 @@ |
|
170 | > @@ -0,0 +1,1 @@ | |
171 | > +.= sub |
|
171 | > +.= sub | |
172 | > diff --git a/.hgsubstate b/.hgsubstate |
|
172 | > diff --git a/.hgsubstate b/.hgsubstate | |
173 | > new file mode 100644 |
|
173 | > new file mode 100644 | |
174 | > --- /dev/null |
|
174 | > --- /dev/null | |
175 | > +++ b/.hgsubstate |
|
175 | > +++ b/.hgsubstate | |
176 | > @@ -0,0 +1,1 @@ |
|
176 | > @@ -0,0 +1,1 @@ | |
177 | > +0000000000000000000000000000000000000000 . |
|
177 | > +0000000000000000000000000000000000000000 . | |
178 | > EOF |
|
178 | > EOF | |
179 | $ cd .. |
|
179 | $ cd .. | |
180 |
|
180 | |||
181 | on clone (and update): |
|
181 | on clone (and update): | |
182 |
|
182 | |||
183 | $ hg clone -q currentpath currentpath2 |
|
183 | $ hg clone -q currentpath currentpath2 | |
184 | abort: subrepo path contains illegal component: . |
|
184 | abort: subrepo path contains illegal component: . | |
185 | [255] |
|
185 | [255] | |
186 |
|
186 | |||
187 | Test outer path |
|
187 | Test outer path | |
188 | --------------- |
|
188 | --------------- | |
189 |
|
189 | |||
190 | on commit: |
|
190 | on commit: | |
191 |
|
191 | |||
192 | $ mkdir outerpath |
|
192 | $ mkdir outerpath | |
193 | $ cd outerpath |
|
193 | $ cd outerpath | |
194 | $ hg init main |
|
194 | $ hg init main | |
195 | $ cd main |
|
195 | $ cd main | |
196 | $ hg init ../sub |
|
196 | $ hg init ../sub | |
197 | $ echo '../sub = ../sub' >> .hgsub |
|
197 | $ echo '../sub = ../sub' >> .hgsub | |
198 | $ hg ci -qAm 'add subrepo "../sub"' |
|
198 | $ hg ci -qAm 'add subrepo "../sub"' | |
199 | abort: path contains illegal component: ../sub |
|
199 | abort: path contains illegal component: ../sub | |
200 |
[ |
|
200 | [10] | |
201 |
|
201 | |||
202 | prepare tampered repo (including the commit above): |
|
202 | prepare tampered repo (including the commit above): | |
203 |
|
203 | |||
204 | $ hg import --bypass -qm 'add subrepo "../sub"' - <<'EOF' |
|
204 | $ hg import --bypass -qm 'add subrepo "../sub"' - <<'EOF' | |
205 | > diff --git a/.hgsub b/.hgsub |
|
205 | > diff --git a/.hgsub b/.hgsub | |
206 | > new file mode 100644 |
|
206 | > new file mode 100644 | |
207 | > --- /dev/null |
|
207 | > --- /dev/null | |
208 | > +++ b/.hgsub |
|
208 | > +++ b/.hgsub | |
209 | > @@ -0,0 +1,1 @@ |
|
209 | > @@ -0,0 +1,1 @@ | |
210 | > +../sub = ../sub |
|
210 | > +../sub = ../sub | |
211 | > diff --git a/.hgsubstate b/.hgsubstate |
|
211 | > diff --git a/.hgsubstate b/.hgsubstate | |
212 | > new file mode 100644 |
|
212 | > new file mode 100644 | |
213 | > --- /dev/null |
|
213 | > --- /dev/null | |
214 | > +++ b/.hgsubstate |
|
214 | > +++ b/.hgsubstate | |
215 | > @@ -0,0 +1,1 @@ |
|
215 | > @@ -0,0 +1,1 @@ | |
216 | > +0000000000000000000000000000000000000000 ../sub |
|
216 | > +0000000000000000000000000000000000000000 ../sub | |
217 | > EOF |
|
217 | > EOF | |
218 | $ cd .. |
|
218 | $ cd .. | |
219 |
|
219 | |||
220 | on clone (and update): |
|
220 | on clone (and update): | |
221 |
|
221 | |||
222 | $ hg clone -q main main2 |
|
222 | $ hg clone -q main main2 | |
223 | abort: path contains illegal component: ../sub |
|
223 | abort: path contains illegal component: ../sub | |
224 |
[ |
|
224 | [10] | |
225 | $ cd .. |
|
225 | $ cd .. | |
226 |
|
226 | |||
227 | Test variable expansion |
|
227 | Test variable expansion | |
228 | ----------------------- |
|
228 | ----------------------- | |
229 |
|
229 | |||
230 | Subrepository paths shouldn't be expanded, but we fail to handle them |
|
230 | Subrepository paths shouldn't be expanded, but we fail to handle them | |
231 | properly. Any local repository paths are expanded. |
|
231 | properly. Any local repository paths are expanded. | |
232 |
|
232 | |||
233 | on commit: |
|
233 | on commit: | |
234 |
|
234 | |||
235 | $ mkdir envvar |
|
235 | $ mkdir envvar | |
236 | $ cd envvar |
|
236 | $ cd envvar | |
237 | $ hg init main |
|
237 | $ hg init main | |
238 | $ cd main |
|
238 | $ cd main | |
239 | $ hg init sub1 |
|
239 | $ hg init sub1 | |
240 | $ cat <<'EOF' > sub1/hgrc |
|
240 | $ cat <<'EOF' > sub1/hgrc | |
241 | > [hooks] |
|
241 | > [hooks] | |
242 | > log = echo pwned |
|
242 | > log = echo pwned | |
243 | > EOF |
|
243 | > EOF | |
244 | $ hg -R sub1 ci -qAm 'add sub1 files' |
|
244 | $ hg -R sub1 ci -qAm 'add sub1 files' | |
245 | $ hg -R sub1 log -r. -T '{node}\n' |
|
245 | $ hg -R sub1 log -r. -T '{node}\n' | |
246 | 39eb4b4d3e096527668784893a9280578a8f38b8 |
|
246 | 39eb4b4d3e096527668784893a9280578a8f38b8 | |
247 | $ echo '$SUB = sub1' >> .hgsub |
|
247 | $ echo '$SUB = sub1' >> .hgsub | |
248 | $ SUB=sub1 hg ci -qAm 'add subrepo "$SUB"' |
|
248 | $ SUB=sub1 hg ci -qAm 'add subrepo "$SUB"' | |
249 | abort: subrepo path contains illegal component: $SUB |
|
249 | abort: subrepo path contains illegal component: $SUB | |
250 | [255] |
|
250 | [255] | |
251 |
|
251 | |||
252 | prepare tampered repo (including the changes above as two commits): |
|
252 | prepare tampered repo (including the changes above as two commits): | |
253 |
|
253 | |||
254 | $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF' |
|
254 | $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF' | |
255 | > diff --git a/.hgsub b/.hgsub |
|
255 | > diff --git a/.hgsub b/.hgsub | |
256 | > new file mode 100644 |
|
256 | > new file mode 100644 | |
257 | > --- /dev/null |
|
257 | > --- /dev/null | |
258 | > +++ b/.hgsub |
|
258 | > +++ b/.hgsub | |
259 | > @@ -0,0 +1,1 @@ |
|
259 | > @@ -0,0 +1,1 @@ | |
260 | > +$SUB = sub1 |
|
260 | > +$SUB = sub1 | |
261 | > diff --git a/.hgsubstate b/.hgsubstate |
|
261 | > diff --git a/.hgsubstate b/.hgsubstate | |
262 | > new file mode 100644 |
|
262 | > new file mode 100644 | |
263 | > --- /dev/null |
|
263 | > --- /dev/null | |
264 | > +++ b/.hgsubstate |
|
264 | > +++ b/.hgsubstate | |
265 | > @@ -0,0 +1,1 @@ |
|
265 | > @@ -0,0 +1,1 @@ | |
266 | > +0000000000000000000000000000000000000000 $SUB |
|
266 | > +0000000000000000000000000000000000000000 $SUB | |
267 | > EOF |
|
267 | > EOF | |
268 | $ hg debugsetparents 0 |
|
268 | $ hg debugsetparents 0 | |
269 | $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF' |
|
269 | $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF' | |
270 | > diff --git a/.hgsubstate b/.hgsubstate |
|
270 | > diff --git a/.hgsubstate b/.hgsubstate | |
271 | > --- a/.hgsubstate |
|
271 | > --- a/.hgsubstate | |
272 | > +++ b/.hgsubstate |
|
272 | > +++ b/.hgsubstate | |
273 | > @@ -1,1 +1,1 @@ |
|
273 | > @@ -1,1 +1,1 @@ | |
274 | > -0000000000000000000000000000000000000000 $SUB |
|
274 | > -0000000000000000000000000000000000000000 $SUB | |
275 | > +39eb4b4d3e096527668784893a9280578a8f38b8 $SUB |
|
275 | > +39eb4b4d3e096527668784893a9280578a8f38b8 $SUB | |
276 | > EOF |
|
276 | > EOF | |
277 | $ cd .. |
|
277 | $ cd .. | |
278 |
|
278 | |||
279 | on clone (and update) with various substitutions: |
|
279 | on clone (and update) with various substitutions: | |
280 |
|
280 | |||
281 | $ hg clone -q main main2 |
|
281 | $ hg clone -q main main2 | |
282 | abort: subrepo path contains illegal component: $SUB |
|
282 | abort: subrepo path contains illegal component: $SUB | |
283 | [255] |
|
283 | [255] | |
284 | $ ls -A main2 |
|
284 | $ ls -A main2 | |
285 | .hg |
|
285 | .hg | |
286 | .hgsub |
|
286 | .hgsub | |
287 | .hgsubstate |
|
287 | .hgsubstate | |
288 |
|
288 | |||
289 | $ SUB=sub1 hg clone -q main main3 |
|
289 | $ SUB=sub1 hg clone -q main main3 | |
290 | abort: subrepo path contains illegal component: $SUB |
|
290 | abort: subrepo path contains illegal component: $SUB | |
291 | [255] |
|
291 | [255] | |
292 | $ ls -A main3 |
|
292 | $ ls -A main3 | |
293 | .hg |
|
293 | .hg | |
294 | .hgsub |
|
294 | .hgsub | |
295 | .hgsubstate |
|
295 | .hgsubstate | |
296 |
|
296 | |||
297 | $ SUB=sub2 hg clone -q main main4 |
|
297 | $ SUB=sub2 hg clone -q main main4 | |
298 | abort: subrepo path contains illegal component: $SUB |
|
298 | abort: subrepo path contains illegal component: $SUB | |
299 | [255] |
|
299 | [255] | |
300 | $ ls -A main4 |
|
300 | $ ls -A main4 | |
301 | .hg |
|
301 | .hg | |
302 | .hgsub |
|
302 | .hgsub | |
303 | .hgsubstate |
|
303 | .hgsubstate | |
304 |
|
304 | |||
305 | on clone empty subrepo into .hg, then pull (and update), which at least fails: |
|
305 | on clone empty subrepo into .hg, then pull (and update), which at least fails: | |
306 |
|
306 | |||
307 | $ SUB=.hg hg clone -qr0 main main5 |
|
307 | $ SUB=.hg hg clone -qr0 main main5 | |
308 | abort: subrepo path contains illegal component: $SUB |
|
308 | abort: subrepo path contains illegal component: $SUB | |
309 | [255] |
|
309 | [255] | |
310 | $ ls -A main5 |
|
310 | $ ls -A main5 | |
311 | .hg |
|
311 | .hg | |
312 | .hgsub |
|
312 | .hgsub | |
313 | .hgsubstate |
|
313 | .hgsubstate | |
314 | $ test -d main5/.hg/.hg |
|
314 | $ test -d main5/.hg/.hg | |
315 | [1] |
|
315 | [1] | |
316 | $ SUB=.hg hg -R main5 pull -u |
|
316 | $ SUB=.hg hg -R main5 pull -u | |
317 | pulling from $TESTTMP/envvar/main |
|
317 | pulling from $TESTTMP/envvar/main | |
318 | searching for changes |
|
318 | searching for changes | |
319 | adding changesets |
|
319 | adding changesets | |
320 | adding manifests |
|
320 | adding manifests | |
321 | adding file changes |
|
321 | adding file changes | |
322 | added 1 changesets with 1 changes to 1 files |
|
322 | added 1 changesets with 1 changes to 1 files | |
323 | new changesets 7a2f0e59146f |
|
323 | new changesets 7a2f0e59146f | |
324 | .hgsubstate: untracked file differs |
|
324 | .hgsubstate: untracked file differs | |
325 | abort: untracked files in working directory differ from files in requested revision |
|
325 | abort: untracked files in working directory differ from files in requested revision | |
326 | [20] |
|
326 | [20] | |
327 | $ cat main5/.hg/hgrc | grep pwned |
|
327 | $ cat main5/.hg/hgrc | grep pwned | |
328 | [1] |
|
328 | [1] | |
329 |
|
329 | |||
330 | on clone (and update) into .hg, which at least fails: |
|
330 | on clone (and update) into .hg, which at least fails: | |
331 |
|
331 | |||
332 | $ SUB=.hg hg clone -q main main6 |
|
332 | $ SUB=.hg hg clone -q main main6 | |
333 | abort: subrepo path contains illegal component: $SUB |
|
333 | abort: subrepo path contains illegal component: $SUB | |
334 | [255] |
|
334 | [255] | |
335 | $ ls -A main6 |
|
335 | $ ls -A main6 | |
336 | .hg |
|
336 | .hg | |
337 | .hgsub |
|
337 | .hgsub | |
338 | .hgsubstate |
|
338 | .hgsubstate | |
339 | $ cat main6/.hg/hgrc | grep pwned |
|
339 | $ cat main6/.hg/hgrc | grep pwned | |
340 | [1] |
|
340 | [1] | |
341 |
|
341 | |||
342 | on clone (and update) into .hg/* subdir: |
|
342 | on clone (and update) into .hg/* subdir: | |
343 |
|
343 | |||
344 | $ SUB=.hg/foo hg clone -q main main7 |
|
344 | $ SUB=.hg/foo hg clone -q main main7 | |
345 | abort: subrepo path contains illegal component: $SUB |
|
345 | abort: subrepo path contains illegal component: $SUB | |
346 | [255] |
|
346 | [255] | |
347 | $ ls -A main7 |
|
347 | $ ls -A main7 | |
348 | .hg |
|
348 | .hg | |
349 | .hgsub |
|
349 | .hgsub | |
350 | .hgsubstate |
|
350 | .hgsubstate | |
351 | $ test -d main7/.hg/.hg |
|
351 | $ test -d main7/.hg/.hg | |
352 | [1] |
|
352 | [1] | |
353 |
|
353 | |||
354 | on clone (and update) into outer tree: |
|
354 | on clone (and update) into outer tree: | |
355 |
|
355 | |||
356 | $ SUB=../out-of-tree-write hg clone -q main main8 |
|
356 | $ SUB=../out-of-tree-write hg clone -q main main8 | |
357 | abort: subrepo path contains illegal component: $SUB |
|
357 | abort: subrepo path contains illegal component: $SUB | |
358 | [255] |
|
358 | [255] | |
359 | $ ls -A main8 |
|
359 | $ ls -A main8 | |
360 | .hg |
|
360 | .hg | |
361 | .hgsub |
|
361 | .hgsub | |
362 | .hgsubstate |
|
362 | .hgsubstate | |
363 |
|
363 | |||
364 | on clone (and update) into e.g. $HOME, which doesn't work since subrepo paths |
|
364 | on clone (and update) into e.g. $HOME, which doesn't work since subrepo paths | |
365 | are concatenated prior to variable expansion: |
|
365 | are concatenated prior to variable expansion: | |
366 |
|
366 | |||
367 | $ SUB="$TESTTMP/envvar/fakehome" hg clone -q main main9 |
|
367 | $ SUB="$TESTTMP/envvar/fakehome" hg clone -q main main9 | |
368 | abort: subrepo path contains illegal component: $SUB |
|
368 | abort: subrepo path contains illegal component: $SUB | |
369 | [255] |
|
369 | [255] | |
370 | $ ls -A main9 | wc -l |
|
370 | $ ls -A main9 | wc -l | |
371 | \s*3 (re) |
|
371 | \s*3 (re) | |
372 |
|
372 | |||
373 | $ ls |
|
373 | $ ls | |
374 | main |
|
374 | main | |
375 | main2 |
|
375 | main2 | |
376 | main3 |
|
376 | main3 | |
377 | main4 |
|
377 | main4 | |
378 | main5 |
|
378 | main5 | |
379 | main6 |
|
379 | main6 | |
380 | main7 |
|
380 | main7 | |
381 | main8 |
|
381 | main8 | |
382 | main9 |
|
382 | main9 | |
383 | $ cd .. |
|
383 | $ cd .. | |
384 |
|
384 | |||
385 | Test tilde |
|
385 | Test tilde | |
386 | ---------- |
|
386 | ---------- | |
387 |
|
387 | |||
388 | The leading tilde may be expanded to $HOME, but it can be a valid subrepo |
|
388 | The leading tilde may be expanded to $HOME, but it can be a valid subrepo | |
389 | path in theory. However, we want to prohibit it as there might be unsafe |
|
389 | path in theory. However, we want to prohibit it as there might be unsafe | |
390 | handling of such paths. |
|
390 | handling of such paths. | |
391 |
|
391 | |||
392 | on commit: |
|
392 | on commit: | |
393 |
|
393 | |||
394 | $ hg init tilde |
|
394 | $ hg init tilde | |
395 | $ cd tilde |
|
395 | $ cd tilde | |
396 | $ hg init './~' |
|
396 | $ hg init './~' | |
397 | $ echo '~ = ~' >> .hgsub |
|
397 | $ echo '~ = ~' >> .hgsub | |
398 | $ hg ci -qAm 'add subrepo "~"' |
|
398 | $ hg ci -qAm 'add subrepo "~"' | |
399 | abort: subrepo path contains illegal component: ~ |
|
399 | abort: subrepo path contains illegal component: ~ | |
400 | [255] |
|
400 | [255] | |
401 |
|
401 | |||
402 | prepare tampered repo (including the commit above): |
|
402 | prepare tampered repo (including the commit above): | |
403 |
|
403 | |||
404 | $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF' |
|
404 | $ hg import --bypass -qm 'add subrepo "~"' - <<'EOF' | |
405 | > diff --git a/.hgsub b/.hgsub |
|
405 | > diff --git a/.hgsub b/.hgsub | |
406 | > new file mode 100644 |
|
406 | > new file mode 100644 | |
407 | > --- /dev/null |
|
407 | > --- /dev/null | |
408 | > +++ b/.hgsub |
|
408 | > +++ b/.hgsub | |
409 | > @@ -0,0 +1,1 @@ |
|
409 | > @@ -0,0 +1,1 @@ | |
410 | > +~ = ~ |
|
410 | > +~ = ~ | |
411 | > diff --git a/.hgsubstate b/.hgsubstate |
|
411 | > diff --git a/.hgsubstate b/.hgsubstate | |
412 | > new file mode 100644 |
|
412 | > new file mode 100644 | |
413 | > --- /dev/null |
|
413 | > --- /dev/null | |
414 | > +++ b/.hgsubstate |
|
414 | > +++ b/.hgsubstate | |
415 | > @@ -0,0 +1,1 @@ |
|
415 | > @@ -0,0 +1,1 @@ | |
416 | > +0000000000000000000000000000000000000000 ~ |
|
416 | > +0000000000000000000000000000000000000000 ~ | |
417 | > EOF |
|
417 | > EOF | |
418 | $ cd .. |
|
418 | $ cd .. | |
419 |
|
419 | |||
420 | on clone (and update): |
|
420 | on clone (and update): | |
421 |
|
421 | |||
422 | $ hg clone -q tilde tilde2 |
|
422 | $ hg clone -q tilde tilde2 | |
423 | abort: subrepo path contains illegal component: ~ |
|
423 | abort: subrepo path contains illegal component: ~ | |
424 | [255] |
|
424 | [255] | |
425 |
|
425 | |||
426 | Test direct symlink traversal |
|
426 | Test direct symlink traversal | |
427 | ----------------------------- |
|
427 | ----------------------------- | |
428 |
|
428 | |||
429 | #if symlink |
|
429 | #if symlink | |
430 |
|
430 | |||
431 | on commit: |
|
431 | on commit: | |
432 |
|
432 | |||
433 | $ mkdir hgsymdir |
|
433 | $ mkdir hgsymdir | |
434 | $ hg init hgsymdir/root |
|
434 | $ hg init hgsymdir/root | |
435 | $ cd hgsymdir/root |
|
435 | $ cd hgsymdir/root | |
436 | $ ln -s ../out |
|
436 | $ ln -s ../out | |
437 | $ hg ci -qAm 'add symlink "out"' |
|
437 | $ hg ci -qAm 'add symlink "out"' | |
438 | $ hg init ../out |
|
438 | $ hg init ../out | |
439 | $ echo 'out = out' >> .hgsub |
|
439 | $ echo 'out = out' >> .hgsub | |
440 | $ hg ci -qAm 'add subrepo "out"' |
|
440 | $ hg ci -qAm 'add subrepo "out"' | |
441 | abort: subrepo 'out' traverses symbolic link |
|
441 | abort: subrepo 'out' traverses symbolic link | |
442 | [255] |
|
442 | [255] | |
443 |
|
443 | |||
444 | prepare tampered repo (including the commit above): |
|
444 | prepare tampered repo (including the commit above): | |
445 |
|
445 | |||
446 | $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF' |
|
446 | $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF' | |
447 | > diff --git a/.hgsub b/.hgsub |
|
447 | > diff --git a/.hgsub b/.hgsub | |
448 | > new file mode 100644 |
|
448 | > new file mode 100644 | |
449 | > --- /dev/null |
|
449 | > --- /dev/null | |
450 | > +++ b/.hgsub |
|
450 | > +++ b/.hgsub | |
451 | > @@ -0,0 +1,1 @@ |
|
451 | > @@ -0,0 +1,1 @@ | |
452 | > +out = out |
|
452 | > +out = out | |
453 | > diff --git a/.hgsubstate b/.hgsubstate |
|
453 | > diff --git a/.hgsubstate b/.hgsubstate | |
454 | > new file mode 100644 |
|
454 | > new file mode 100644 | |
455 | > --- /dev/null |
|
455 | > --- /dev/null | |
456 | > +++ b/.hgsubstate |
|
456 | > +++ b/.hgsubstate | |
457 | > @@ -0,0 +1,1 @@ |
|
457 | > @@ -0,0 +1,1 @@ | |
458 | > +0000000000000000000000000000000000000000 out |
|
458 | > +0000000000000000000000000000000000000000 out | |
459 | > EOF |
|
459 | > EOF | |
460 | $ cd ../.. |
|
460 | $ cd ../.. | |
461 |
|
461 | |||
462 | on clone (and update): |
|
462 | on clone (and update): | |
463 |
|
463 | |||
464 | $ mkdir hgsymdir2 |
|
464 | $ mkdir hgsymdir2 | |
465 | $ hg clone -q hgsymdir/root hgsymdir2/root |
|
465 | $ hg clone -q hgsymdir/root hgsymdir2/root | |
466 | abort: subrepo 'out' traverses symbolic link |
|
466 | abort: subrepo 'out' traverses symbolic link | |
467 | [255] |
|
467 | [255] | |
468 | $ ls hgsymdir2 |
|
468 | $ ls hgsymdir2 | |
469 | root |
|
469 | root | |
470 |
|
470 | |||
471 | #endif |
|
471 | #endif | |
472 |
|
472 | |||
473 | Test indirect symlink traversal |
|
473 | Test indirect symlink traversal | |
474 | ------------------------------- |
|
474 | ------------------------------- | |
475 |
|
475 | |||
476 | #if symlink |
|
476 | #if symlink | |
477 |
|
477 | |||
478 | on commit: |
|
478 | on commit: | |
479 |
|
479 | |||
480 | $ mkdir hgsymin |
|
480 | $ mkdir hgsymin | |
481 | $ hg init hgsymin/root |
|
481 | $ hg init hgsymin/root | |
482 | $ cd hgsymin/root |
|
482 | $ cd hgsymin/root | |
483 | $ ln -s ../out |
|
483 | $ ln -s ../out | |
484 | $ hg ci -qAm 'add symlink "out"' |
|
484 | $ hg ci -qAm 'add symlink "out"' | |
485 | $ mkdir ../out |
|
485 | $ mkdir ../out | |
486 | $ hg init ../out/sub |
|
486 | $ hg init ../out/sub | |
487 | $ echo 'out/sub = out/sub' >> .hgsub |
|
487 | $ echo 'out/sub = out/sub' >> .hgsub | |
488 | $ hg ci -qAm 'add subrepo "out/sub"' |
|
488 | $ hg ci -qAm 'add subrepo "out/sub"' | |
489 | abort: path 'out/sub' traverses symbolic link 'out' |
|
489 | abort: path 'out/sub' traverses symbolic link 'out' | |
490 | [255] |
|
490 | [255] | |
491 |
|
491 | |||
492 | prepare tampered repo (including the commit above): |
|
492 | prepare tampered repo (including the commit above): | |
493 |
|
493 | |||
494 | $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF' |
|
494 | $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF' | |
495 | > diff --git a/.hgsub b/.hgsub |
|
495 | > diff --git a/.hgsub b/.hgsub | |
496 | > new file mode 100644 |
|
496 | > new file mode 100644 | |
497 | > --- /dev/null |
|
497 | > --- /dev/null | |
498 | > +++ b/.hgsub |
|
498 | > +++ b/.hgsub | |
499 | > @@ -0,0 +1,1 @@ |
|
499 | > @@ -0,0 +1,1 @@ | |
500 | > +out/sub = out/sub |
|
500 | > +out/sub = out/sub | |
501 | > diff --git a/.hgsubstate b/.hgsubstate |
|
501 | > diff --git a/.hgsubstate b/.hgsubstate | |
502 | > new file mode 100644 |
|
502 | > new file mode 100644 | |
503 | > --- /dev/null |
|
503 | > --- /dev/null | |
504 | > +++ b/.hgsubstate |
|
504 | > +++ b/.hgsubstate | |
505 | > @@ -0,0 +1,1 @@ |
|
505 | > @@ -0,0 +1,1 @@ | |
506 | > +0000000000000000000000000000000000000000 out/sub |
|
506 | > +0000000000000000000000000000000000000000 out/sub | |
507 | > EOF |
|
507 | > EOF | |
508 | $ cd ../.. |
|
508 | $ cd ../.. | |
509 |
|
509 | |||
510 | on clone (and update): |
|
510 | on clone (and update): | |
511 |
|
511 | |||
512 | $ mkdir hgsymin2 |
|
512 | $ mkdir hgsymin2 | |
513 | $ hg clone -q hgsymin/root hgsymin2/root |
|
513 | $ hg clone -q hgsymin/root hgsymin2/root | |
514 | abort: path 'out/sub' traverses symbolic link 'out' |
|
514 | abort: path 'out/sub' traverses symbolic link 'out' | |
515 | [255] |
|
515 | [255] | |
516 | $ ls hgsymin2 |
|
516 | $ ls hgsymin2 | |
517 | root |
|
517 | root | |
518 |
|
518 | |||
519 | #endif |
|
519 | #endif | |
520 |
|
520 | |||
521 | Test symlink traversal by variable expansion |
|
521 | Test symlink traversal by variable expansion | |
522 | -------------------------------------------- |
|
522 | -------------------------------------------- | |
523 |
|
523 | |||
524 | #if symlink |
|
524 | #if symlink | |
525 |
|
525 | |||
526 | $ FAKEHOME="$TESTTMP/envvarsym/fakehome" |
|
526 | $ FAKEHOME="$TESTTMP/envvarsym/fakehome" | |
527 |
|
527 | |||
528 | on commit: |
|
528 | on commit: | |
529 |
|
529 | |||
530 | $ mkdir envvarsym |
|
530 | $ mkdir envvarsym | |
531 | $ cd envvarsym |
|
531 | $ cd envvarsym | |
532 | $ hg init main |
|
532 | $ hg init main | |
533 | $ cd main |
|
533 | $ cd main | |
534 | $ ln -s "`echo "$FAKEHOME" | sed 's|\(.\)/.*|\1|'`" |
|
534 | $ ln -s "`echo "$FAKEHOME" | sed 's|\(.\)/.*|\1|'`" | |
535 | $ hg ci -qAm 'add symlink to top-level system directory' |
|
535 | $ hg ci -qAm 'add symlink to top-level system directory' | |
536 |
|
536 | |||
537 | $ hg init sub1 |
|
537 | $ hg init sub1 | |
538 | $ echo pwned > sub1/pwned |
|
538 | $ echo pwned > sub1/pwned | |
539 | $ hg -R sub1 ci -qAm 'add sub1 files' |
|
539 | $ hg -R sub1 ci -qAm 'add sub1 files' | |
540 | $ hg -R sub1 log -r. -T '{node}\n' |
|
540 | $ hg -R sub1 log -r. -T '{node}\n' | |
541 | f40c9134ba1b6961e12f250868823f0092fb68a8 |
|
541 | f40c9134ba1b6961e12f250868823f0092fb68a8 | |
542 | $ echo '$SUB = sub1' >> .hgsub |
|
542 | $ echo '$SUB = sub1' >> .hgsub | |
543 | $ SUB="$FAKEHOME" hg ci -qAm 'add subrepo "$SUB"' |
|
543 | $ SUB="$FAKEHOME" hg ci -qAm 'add subrepo "$SUB"' | |
544 | abort: subrepo path contains illegal component: $SUB |
|
544 | abort: subrepo path contains illegal component: $SUB | |
545 | [255] |
|
545 | [255] | |
546 |
|
546 | |||
547 | prepare tampered repo (including the changes above as two commits): |
|
547 | prepare tampered repo (including the changes above as two commits): | |
548 |
|
548 | |||
549 | $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF' |
|
549 | $ hg import --bypass -qm 'add subrepo "$SUB"' - <<'EOF' | |
550 | > diff --git a/.hgsub b/.hgsub |
|
550 | > diff --git a/.hgsub b/.hgsub | |
551 | > new file mode 100644 |
|
551 | > new file mode 100644 | |
552 | > --- /dev/null |
|
552 | > --- /dev/null | |
553 | > +++ b/.hgsub |
|
553 | > +++ b/.hgsub | |
554 | > @@ -0,0 +1,1 @@ |
|
554 | > @@ -0,0 +1,1 @@ | |
555 | > +$SUB = sub1 |
|
555 | > +$SUB = sub1 | |
556 | > diff --git a/.hgsubstate b/.hgsubstate |
|
556 | > diff --git a/.hgsubstate b/.hgsubstate | |
557 | > new file mode 100644 |
|
557 | > new file mode 100644 | |
558 | > --- /dev/null |
|
558 | > --- /dev/null | |
559 | > +++ b/.hgsubstate |
|
559 | > +++ b/.hgsubstate | |
560 | > @@ -0,0 +1,1 @@ |
|
560 | > @@ -0,0 +1,1 @@ | |
561 | > +0000000000000000000000000000000000000000 $SUB |
|
561 | > +0000000000000000000000000000000000000000 $SUB | |
562 | > EOF |
|
562 | > EOF | |
563 | $ hg debugsetparents 1 |
|
563 | $ hg debugsetparents 1 | |
564 | $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF' |
|
564 | $ hg import --bypass -qm 'update subrepo "$SUB"' - <<'EOF' | |
565 | > diff --git a/.hgsubstate b/.hgsubstate |
|
565 | > diff --git a/.hgsubstate b/.hgsubstate | |
566 | > --- a/.hgsubstate |
|
566 | > --- a/.hgsubstate | |
567 | > +++ b/.hgsubstate |
|
567 | > +++ b/.hgsubstate | |
568 | > @@ -1,1 +1,1 @@ |
|
568 | > @@ -1,1 +1,1 @@ | |
569 | > -0000000000000000000000000000000000000000 $SUB |
|
569 | > -0000000000000000000000000000000000000000 $SUB | |
570 | > +f40c9134ba1b6961e12f250868823f0092fb68a8 $SUB |
|
570 | > +f40c9134ba1b6961e12f250868823f0092fb68a8 $SUB | |
571 | > EOF |
|
571 | > EOF | |
572 | $ cd .. |
|
572 | $ cd .. | |
573 |
|
573 | |||
574 | on clone (and update) without fakehome directory: |
|
574 | on clone (and update) without fakehome directory: | |
575 |
|
575 | |||
576 | $ rm -fR "$FAKEHOME" |
|
576 | $ rm -fR "$FAKEHOME" | |
577 | $ SUB="$FAKEHOME" hg clone -q main main2 |
|
577 | $ SUB="$FAKEHOME" hg clone -q main main2 | |
578 | abort: subrepo path contains illegal component: $SUB |
|
578 | abort: subrepo path contains illegal component: $SUB | |
579 | [255] |
|
579 | [255] | |
580 | $ test -d "$FAKEHOME" |
|
580 | $ test -d "$FAKEHOME" | |
581 | [1] |
|
581 | [1] | |
582 |
|
582 | |||
583 | on clone (and update) with empty fakehome directory: |
|
583 | on clone (and update) with empty fakehome directory: | |
584 |
|
584 | |||
585 | $ rm -fR "$FAKEHOME" |
|
585 | $ rm -fR "$FAKEHOME" | |
586 | $ mkdir "$FAKEHOME" |
|
586 | $ mkdir "$FAKEHOME" | |
587 | $ SUB="$FAKEHOME" hg clone -q main main3 |
|
587 | $ SUB="$FAKEHOME" hg clone -q main main3 | |
588 | abort: subrepo path contains illegal component: $SUB |
|
588 | abort: subrepo path contains illegal component: $SUB | |
589 | [255] |
|
589 | [255] | |
590 | $ ls "$FAKEHOME" |
|
590 | $ ls "$FAKEHOME" | |
591 |
|
591 | |||
592 | on clone (and update) with non-empty fakehome directory: |
|
592 | on clone (and update) with non-empty fakehome directory: | |
593 |
|
593 | |||
594 | $ rm -fR "$FAKEHOME" |
|
594 | $ rm -fR "$FAKEHOME" | |
595 | $ mkdir "$FAKEHOME" |
|
595 | $ mkdir "$FAKEHOME" | |
596 | $ touch "$FAKEHOME/a" |
|
596 | $ touch "$FAKEHOME/a" | |
597 | $ SUB="$FAKEHOME" hg clone -q main main4 |
|
597 | $ SUB="$FAKEHOME" hg clone -q main main4 | |
598 | abort: subrepo path contains illegal component: $SUB |
|
598 | abort: subrepo path contains illegal component: $SUB | |
599 | [255] |
|
599 | [255] | |
600 | $ ls "$FAKEHOME" |
|
600 | $ ls "$FAKEHOME" | |
601 | a |
|
601 | a | |
602 |
|
602 | |||
603 | on clone empty subrepo with non-empty fakehome directory, |
|
603 | on clone empty subrepo with non-empty fakehome directory, | |
604 | then pull (and update): |
|
604 | then pull (and update): | |
605 |
|
605 | |||
606 | $ rm -fR "$FAKEHOME" |
|
606 | $ rm -fR "$FAKEHOME" | |
607 | $ mkdir "$FAKEHOME" |
|
607 | $ mkdir "$FAKEHOME" | |
608 | $ touch "$FAKEHOME/a" |
|
608 | $ touch "$FAKEHOME/a" | |
609 | $ SUB="$FAKEHOME" hg clone -qr1 main main5 |
|
609 | $ SUB="$FAKEHOME" hg clone -qr1 main main5 | |
610 | abort: subrepo path contains illegal component: $SUB |
|
610 | abort: subrepo path contains illegal component: $SUB | |
611 | [255] |
|
611 | [255] | |
612 | $ ls "$FAKEHOME" |
|
612 | $ ls "$FAKEHOME" | |
613 | a |
|
613 | a | |
614 | $ test -d "$FAKEHOME/.hg" |
|
614 | $ test -d "$FAKEHOME/.hg" | |
615 | [1] |
|
615 | [1] | |
616 | $ SUB="$FAKEHOME" hg -R main5 pull -u |
|
616 | $ SUB="$FAKEHOME" hg -R main5 pull -u | |
617 | pulling from $TESTTMP/envvarsym/main |
|
617 | pulling from $TESTTMP/envvarsym/main | |
618 | searching for changes |
|
618 | searching for changes | |
619 | adding changesets |
|
619 | adding changesets | |
620 | adding manifests |
|
620 | adding manifests | |
621 | adding file changes |
|
621 | adding file changes | |
622 | added 1 changesets with 1 changes to 1 files |
|
622 | added 1 changesets with 1 changes to 1 files | |
623 | new changesets * (glob) |
|
623 | new changesets * (glob) | |
624 | .hgsubstate: untracked file differs |
|
624 | .hgsubstate: untracked file differs | |
625 | abort: untracked files in working directory differ from files in requested revision |
|
625 | abort: untracked files in working directory differ from files in requested revision | |
626 | [20] |
|
626 | [20] | |
627 | $ ls "$FAKEHOME" |
|
627 | $ ls "$FAKEHOME" | |
628 | a |
|
628 | a | |
629 | $ test -d "$FAKEHOME/.hg" |
|
629 | $ test -d "$FAKEHOME/.hg" | |
630 | [1] |
|
630 | [1] | |
631 |
|
631 | |||
632 | on clone empty subrepo with hg-managed fakehome directory, |
|
632 | on clone empty subrepo with hg-managed fakehome directory, | |
633 | then pull (and update): |
|
633 | then pull (and update): | |
634 |
|
634 | |||
635 | $ rm -fR "$FAKEHOME" |
|
635 | $ rm -fR "$FAKEHOME" | |
636 | $ hg init "$FAKEHOME" |
|
636 | $ hg init "$FAKEHOME" | |
637 | $ touch "$FAKEHOME/a" |
|
637 | $ touch "$FAKEHOME/a" | |
638 | $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file' |
|
638 | $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file' | |
639 | $ SUB="$FAKEHOME" hg clone -qr1 main main6 |
|
639 | $ SUB="$FAKEHOME" hg clone -qr1 main main6 | |
640 | abort: subrepo path contains illegal component: $SUB |
|
640 | abort: subrepo path contains illegal component: $SUB | |
641 | [255] |
|
641 | [255] | |
642 | $ ls -A "$FAKEHOME" |
|
642 | $ ls -A "$FAKEHOME" | |
643 | .hg |
|
643 | .hg | |
644 | a |
|
644 | a | |
645 | $ SUB="$FAKEHOME" hg -R main6 pull -u |
|
645 | $ SUB="$FAKEHOME" hg -R main6 pull -u | |
646 | pulling from $TESTTMP/envvarsym/main |
|
646 | pulling from $TESTTMP/envvarsym/main | |
647 | searching for changes |
|
647 | searching for changes | |
648 | adding changesets |
|
648 | adding changesets | |
649 | adding manifests |
|
649 | adding manifests | |
650 | adding file changes |
|
650 | adding file changes | |
651 | added 1 changesets with 1 changes to 1 files |
|
651 | added 1 changesets with 1 changes to 1 files | |
652 | new changesets * (glob) |
|
652 | new changesets * (glob) | |
653 | .hgsubstate: untracked file differs |
|
653 | .hgsubstate: untracked file differs | |
654 | abort: untracked files in working directory differ from files in requested revision |
|
654 | abort: untracked files in working directory differ from files in requested revision | |
655 | [20] |
|
655 | [20] | |
656 | $ ls -A "$FAKEHOME" |
|
656 | $ ls -A "$FAKEHOME" | |
657 | .hg |
|
657 | .hg | |
658 | a |
|
658 | a | |
659 |
|
659 | |||
660 | on clone only symlink with hg-managed fakehome directory, |
|
660 | on clone only symlink with hg-managed fakehome directory, | |
661 | then pull (and update): |
|
661 | then pull (and update): | |
662 |
|
662 | |||
663 | $ rm -fR "$FAKEHOME" |
|
663 | $ rm -fR "$FAKEHOME" | |
664 | $ hg init "$FAKEHOME" |
|
664 | $ hg init "$FAKEHOME" | |
665 | $ touch "$FAKEHOME/a" |
|
665 | $ touch "$FAKEHOME/a" | |
666 | $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file' |
|
666 | $ hg -R "$FAKEHOME" ci -qAm 'add fakehome file' | |
667 | $ SUB="$FAKEHOME" hg clone -qr0 main main7 |
|
667 | $ SUB="$FAKEHOME" hg clone -qr0 main main7 | |
668 | $ ls -A "$FAKEHOME" |
|
668 | $ ls -A "$FAKEHOME" | |
669 | .hg |
|
669 | .hg | |
670 | a |
|
670 | a | |
671 | $ SUB="$FAKEHOME" hg -R main7 pull -uf |
|
671 | $ SUB="$FAKEHOME" hg -R main7 pull -uf | |
672 | pulling from $TESTTMP/envvarsym/main |
|
672 | pulling from $TESTTMP/envvarsym/main | |
673 | searching for changes |
|
673 | searching for changes | |
674 | adding changesets |
|
674 | adding changesets | |
675 | adding manifests |
|
675 | adding manifests | |
676 | adding file changes |
|
676 | adding file changes | |
677 | added 2 changesets with 3 changes to 2 files |
|
677 | added 2 changesets with 3 changes to 2 files | |
678 | new changesets * (glob) |
|
678 | new changesets * (glob) | |
679 | abort: subrepo path contains illegal component: $SUB |
|
679 | abort: subrepo path contains illegal component: $SUB | |
680 | [255] |
|
680 | [255] | |
681 | $ ls -A "$FAKEHOME" |
|
681 | $ ls -A "$FAKEHOME" | |
682 | .hg |
|
682 | .hg | |
683 | a |
|
683 | a | |
684 |
|
684 | |||
685 | $ cd .. |
|
685 | $ cd .. | |
686 |
|
686 | |||
687 | #endif |
|
687 | #endif | |
688 |
|
688 | |||
689 | Test drive letter |
|
689 | Test drive letter | |
690 | ----------------- |
|
690 | ----------------- | |
691 |
|
691 | |||
692 | Windows has a weird relative path that can change the drive letter, which |
|
692 | Windows has a weird relative path that can change the drive letter, which | |
693 | should also be prohibited on Windows. |
|
693 | should also be prohibited on Windows. | |
694 |
|
694 | |||
695 | prepare tampered repo: |
|
695 | prepare tampered repo: | |
696 |
|
696 | |||
697 | $ hg init driveletter |
|
697 | $ hg init driveletter | |
698 | $ cd driveletter |
|
698 | $ cd driveletter | |
699 | $ hg import --bypass -qm 'add subrepo "X:"' - <<'EOF' |
|
699 | $ hg import --bypass -qm 'add subrepo "X:"' - <<'EOF' | |
700 | > diff --git a/.hgsub b/.hgsub |
|
700 | > diff --git a/.hgsub b/.hgsub | |
701 | > new file mode 100644 |
|
701 | > new file mode 100644 | |
702 | > --- /dev/null |
|
702 | > --- /dev/null | |
703 | > +++ b/.hgsub |
|
703 | > +++ b/.hgsub | |
704 | > @@ -0,0 +1,1 @@ |
|
704 | > @@ -0,0 +1,1 @@ | |
705 | > +X: = foo |
|
705 | > +X: = foo | |
706 | > diff --git a/.hgsubstate b/.hgsubstate |
|
706 | > diff --git a/.hgsubstate b/.hgsubstate | |
707 | > new file mode 100644 |
|
707 | > new file mode 100644 | |
708 | > --- /dev/null |
|
708 | > --- /dev/null | |
709 | > +++ b/.hgsubstate |
|
709 | > +++ b/.hgsubstate | |
710 | > @@ -0,0 +1,1 @@ |
|
710 | > @@ -0,0 +1,1 @@ | |
711 | > +0000000000000000000000000000000000000000 X: |
|
711 | > +0000000000000000000000000000000000000000 X: | |
712 | > EOF |
|
712 | > EOF | |
713 | $ cd .. |
|
713 | $ cd .. | |
714 |
|
714 | |||
715 | on clone (and update): |
|
715 | on clone (and update): | |
716 |
|
716 | |||
717 | #if windows |
|
717 | #if windows | |
718 |
|
718 | |||
719 | $ hg clone -q driveletter driveletter2 |
|
719 | $ hg clone -q driveletter driveletter2 | |
720 | abort: path contains illegal component: X: |
|
720 | abort: path contains illegal component: X: | |
721 |
[ |
|
721 | [10] | |
722 |
|
722 | |||
723 | #else |
|
723 | #else | |
724 |
|
724 | |||
725 | $ hg clone -q driveletter driveletter2 |
|
725 | $ hg clone -q driveletter driveletter2 | |
726 | $ ls -A driveletter2 |
|
726 | $ ls -A driveletter2 | |
727 | .hg |
|
727 | .hg | |
728 | .hgsub |
|
728 | .hgsub | |
729 | .hgsubstate |
|
729 | .hgsubstate | |
730 | X: |
|
730 | X: | |
731 |
|
731 | |||
732 | #endif |
|
732 | #endif |
@@ -1,879 +1,879 b'' | |||||
1 | commit date test |
|
1 | commit date test | |
2 |
|
2 | |||
3 | $ hg init test |
|
3 | $ hg init test | |
4 | $ cd test |
|
4 | $ cd test | |
5 | $ echo foo > foo |
|
5 | $ echo foo > foo | |
6 | $ hg add foo |
|
6 | $ hg add foo | |
7 | $ cat > $TESTTMP/checkeditform.sh <<EOF |
|
7 | $ cat > $TESTTMP/checkeditform.sh <<EOF | |
8 | > env | grep HGEDITFORM |
|
8 | > env | grep HGEDITFORM | |
9 | > true |
|
9 | > true | |
10 | > EOF |
|
10 | > EOF | |
11 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m "" |
|
11 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m "" | |
12 | HGEDITFORM=commit.normal.normal |
|
12 | HGEDITFORM=commit.normal.normal | |
13 | abort: empty commit message |
|
13 | abort: empty commit message | |
14 | [10] |
|
14 | [10] | |
15 | $ hg commit -d '0 0' -m commit-1 |
|
15 | $ hg commit -d '0 0' -m commit-1 | |
16 | $ echo foo >> foo |
|
16 | $ echo foo >> foo | |
17 | $ hg commit -d '1 4444444' -m commit-3 |
|
17 | $ hg commit -d '1 4444444' -m commit-3 | |
18 | hg: parse error: impossible time zone offset: 4444444 |
|
18 | hg: parse error: impossible time zone offset: 4444444 | |
19 | [10] |
|
19 | [10] | |
20 | $ hg commit -d '1 15.1' -m commit-4 |
|
20 | $ hg commit -d '1 15.1' -m commit-4 | |
21 | hg: parse error: invalid date: '1\t15.1' |
|
21 | hg: parse error: invalid date: '1\t15.1' | |
22 | [10] |
|
22 | [10] | |
23 | $ hg commit -d 'foo bar' -m commit-5 |
|
23 | $ hg commit -d 'foo bar' -m commit-5 | |
24 | hg: parse error: invalid date: 'foo bar' |
|
24 | hg: parse error: invalid date: 'foo bar' | |
25 | [10] |
|
25 | [10] | |
26 | $ hg commit -d ' 1 4444' -m commit-6 |
|
26 | $ hg commit -d ' 1 4444' -m commit-6 | |
27 | $ hg commit -d '111111111111 0' -m commit-7 |
|
27 | $ hg commit -d '111111111111 0' -m commit-7 | |
28 | hg: parse error: date exceeds 32 bits: 111111111111 |
|
28 | hg: parse error: date exceeds 32 bits: 111111111111 | |
29 | [10] |
|
29 | [10] | |
30 | $ hg commit -d '-111111111111 0' -m commit-7 |
|
30 | $ hg commit -d '-111111111111 0' -m commit-7 | |
31 | hg: parse error: date exceeds 32 bits: -111111111111 |
|
31 | hg: parse error: date exceeds 32 bits: -111111111111 | |
32 | [10] |
|
32 | [10] | |
33 | $ echo foo >> foo |
|
33 | $ echo foo >> foo | |
34 | $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2 |
|
34 | $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2 | |
35 | $ echo foo >> foo |
|
35 | $ echo foo >> foo | |
36 | $ hg commit -d '-2147483648 0' -m commit-7-3 |
|
36 | $ hg commit -d '-2147483648 0' -m commit-7-3 | |
37 | $ hg log -T '{rev} {date|isodatesec}\n' -l2 |
|
37 | $ hg log -T '{rev} {date|isodatesec}\n' -l2 | |
38 | 3 1901-12-13 20:45:52 +0000 |
|
38 | 3 1901-12-13 20:45:52 +0000 | |
39 | 2 1901-12-13 20:45:52 +0000 |
|
39 | 2 1901-12-13 20:45:52 +0000 | |
40 | $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7 |
|
40 | $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7 | |
41 | hg: parse error: date exceeds 32 bits: -2147483649 |
|
41 | hg: parse error: date exceeds 32 bits: -2147483649 | |
42 | [10] |
|
42 | [10] | |
43 | $ hg commit -d '-2147483649 0' -m commit-7 |
|
43 | $ hg commit -d '-2147483649 0' -m commit-7 | |
44 | hg: parse error: date exceeds 32 bits: -2147483649 |
|
44 | hg: parse error: date exceeds 32 bits: -2147483649 | |
45 | [10] |
|
45 | [10] | |
46 |
|
46 | |||
47 | commit added file that has been deleted |
|
47 | commit added file that has been deleted | |
48 |
|
48 | |||
49 | $ echo bar > bar |
|
49 | $ echo bar > bar | |
50 | $ hg add bar |
|
50 | $ hg add bar | |
51 | $ rm bar |
|
51 | $ rm bar | |
52 | $ hg commit -m commit-8 |
|
52 | $ hg commit -m commit-8 | |
53 | nothing changed (1 missing files, see 'hg status') |
|
53 | nothing changed (1 missing files, see 'hg status') | |
54 | [1] |
|
54 | [1] | |
55 | $ hg commit -m commit-8-2 bar |
|
55 | $ hg commit -m commit-8-2 bar | |
56 | abort: bar: file not found! |
|
56 | abort: bar: file not found! | |
57 | [10] |
|
57 | [10] | |
58 |
|
58 | |||
59 | $ hg -q revert -a --no-backup |
|
59 | $ hg -q revert -a --no-backup | |
60 |
|
60 | |||
61 | $ mkdir dir |
|
61 | $ mkdir dir | |
62 | $ echo boo > dir/file |
|
62 | $ echo boo > dir/file | |
63 | $ hg add |
|
63 | $ hg add | |
64 | adding dir/file |
|
64 | adding dir/file | |
65 | $ hg -v commit -m commit-9 dir |
|
65 | $ hg -v commit -m commit-9 dir | |
66 | committing files: |
|
66 | committing files: | |
67 | dir/file |
|
67 | dir/file | |
68 | committing manifest |
|
68 | committing manifest | |
69 | committing changelog |
|
69 | committing changelog | |
70 | committed changeset 4:1957363f1ced |
|
70 | committed changeset 4:1957363f1ced | |
71 |
|
71 | |||
72 | $ echo > dir.file |
|
72 | $ echo > dir.file | |
73 | $ hg add |
|
73 | $ hg add | |
74 | adding dir.file |
|
74 | adding dir.file | |
75 | $ hg commit -m commit-10 dir dir.file |
|
75 | $ hg commit -m commit-10 dir dir.file | |
76 | abort: dir: no match under directory! |
|
76 | abort: dir: no match under directory! | |
77 | [10] |
|
77 | [10] | |
78 |
|
78 | |||
79 | $ echo >> dir/file |
|
79 | $ echo >> dir/file | |
80 | $ mkdir bleh |
|
80 | $ mkdir bleh | |
81 | $ mkdir dir2 |
|
81 | $ mkdir dir2 | |
82 | $ cd bleh |
|
82 | $ cd bleh | |
83 | $ hg commit -m commit-11 . |
|
83 | $ hg commit -m commit-11 . | |
84 | abort: bleh: no match under directory! |
|
84 | abort: bleh: no match under directory! | |
85 | [10] |
|
85 | [10] | |
86 | $ hg commit -m commit-12 ../dir ../dir2 |
|
86 | $ hg commit -m commit-12 ../dir ../dir2 | |
87 | abort: dir2: no match under directory! |
|
87 | abort: dir2: no match under directory! | |
88 | [10] |
|
88 | [10] | |
89 | $ hg -v commit -m commit-13 ../dir |
|
89 | $ hg -v commit -m commit-13 ../dir | |
90 | committing files: |
|
90 | committing files: | |
91 | dir/file |
|
91 | dir/file | |
92 | committing manifest |
|
92 | committing manifest | |
93 | committing changelog |
|
93 | committing changelog | |
94 | committed changeset 5:a31d8f87544a |
|
94 | committed changeset 5:a31d8f87544a | |
95 | $ cd .. |
|
95 | $ cd .. | |
96 |
|
96 | |||
97 | $ hg commit -m commit-14 does-not-exist |
|
97 | $ hg commit -m commit-14 does-not-exist | |
98 | abort: does-not-exist: * (glob) |
|
98 | abort: does-not-exist: * (glob) | |
99 | [10] |
|
99 | [10] | |
100 |
|
100 | |||
101 | #if symlink |
|
101 | #if symlink | |
102 | $ ln -s foo baz |
|
102 | $ ln -s foo baz | |
103 | $ hg commit -m commit-15 baz |
|
103 | $ hg commit -m commit-15 baz | |
104 | abort: baz: file not tracked! |
|
104 | abort: baz: file not tracked! | |
105 | [10] |
|
105 | [10] | |
106 | $ rm baz |
|
106 | $ rm baz | |
107 | #endif |
|
107 | #endif | |
108 |
|
108 | |||
109 | $ touch quux |
|
109 | $ touch quux | |
110 | $ hg commit -m commit-16 quux |
|
110 | $ hg commit -m commit-16 quux | |
111 | abort: quux: file not tracked! |
|
111 | abort: quux: file not tracked! | |
112 | [10] |
|
112 | [10] | |
113 | $ echo >> dir/file |
|
113 | $ echo >> dir/file | |
114 | $ hg -v commit -m commit-17 dir/file |
|
114 | $ hg -v commit -m commit-17 dir/file | |
115 | committing files: |
|
115 | committing files: | |
116 | dir/file |
|
116 | dir/file | |
117 | committing manifest |
|
117 | committing manifest | |
118 | committing changelog |
|
118 | committing changelog | |
119 | committed changeset 6:32d054c9d085 |
|
119 | committed changeset 6:32d054c9d085 | |
120 |
|
120 | |||
121 | An empty date was interpreted as epoch origin |
|
121 | An empty date was interpreted as epoch origin | |
122 |
|
122 | |||
123 | $ echo foo >> foo |
|
123 | $ echo foo >> foo | |
124 | $ hg commit -d '' -m commit-no-date --config devel.default-date= |
|
124 | $ hg commit -d '' -m commit-no-date --config devel.default-date= | |
125 | $ hg tip --template '{date|isodate}\n' | grep '1970' |
|
125 | $ hg tip --template '{date|isodate}\n' | grep '1970' | |
126 | [1] |
|
126 | [1] | |
127 |
|
127 | |||
128 | Using the advanced --extra flag |
|
128 | Using the advanced --extra flag | |
129 |
|
129 | |||
130 | $ echo "[extensions]" >> $HGRCPATH |
|
130 | $ echo "[extensions]" >> $HGRCPATH | |
131 | $ echo "commitextras=" >> $HGRCPATH |
|
131 | $ echo "commitextras=" >> $HGRCPATH | |
132 | $ hg status |
|
132 | $ hg status | |
133 | ? quux |
|
133 | ? quux | |
134 | $ hg add quux |
|
134 | $ hg add quux | |
135 | $ hg commit -m "adding internal used extras" --extra amend_source=hash |
|
135 | $ hg commit -m "adding internal used extras" --extra amend_source=hash | |
136 | abort: key 'amend_source' is used internally, can't be set manually |
|
136 | abort: key 'amend_source' is used internally, can't be set manually | |
137 | [255] |
|
137 | [255] | |
138 | $ hg commit -m "special chars in extra" --extra id@phab=214 |
|
138 | $ hg commit -m "special chars in extra" --extra id@phab=214 | |
139 | abort: keys can only contain ascii letters, digits, '_' and '-' |
|
139 | abort: keys can only contain ascii letters, digits, '_' and '-' | |
140 | [255] |
|
140 | [255] | |
141 | $ hg commit -m "empty key" --extra =value |
|
141 | $ hg commit -m "empty key" --extra =value | |
142 | abort: unable to parse '=value', keys can't be empty |
|
142 | abort: unable to parse '=value', keys can't be empty | |
143 | [255] |
|
143 | [255] | |
144 | $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar |
|
144 | $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar | |
145 | $ hg log -r . -T '{extras % "{extra}\n"}' |
|
145 | $ hg log -r . -T '{extras % "{extra}\n"}' | |
146 | branch=default |
|
146 | branch=default | |
147 | oldhash=bar |
|
147 | oldhash=bar | |
148 | sourcehash=foo |
|
148 | sourcehash=foo | |
149 |
|
149 | |||
150 | Failed commit with --addremove should not update dirstate |
|
150 | Failed commit with --addremove should not update dirstate | |
151 |
|
151 | |||
152 | $ echo foo > newfile |
|
152 | $ echo foo > newfile | |
153 | $ hg status |
|
153 | $ hg status | |
154 | ? newfile |
|
154 | ? newfile | |
155 | $ HGEDITOR=false hg ci --addremove |
|
155 | $ HGEDITOR=false hg ci --addremove | |
156 | adding newfile |
|
156 | adding newfile | |
157 | abort: edit failed: false exited with status 1 |
|
157 | abort: edit failed: false exited with status 1 | |
158 | [250] |
|
158 | [250] | |
159 | $ hg status |
|
159 | $ hg status | |
160 | ? newfile |
|
160 | ? newfile | |
161 |
|
161 | |||
162 | Make sure we do not obscure unknown requires file entries (issue2649) |
|
162 | Make sure we do not obscure unknown requires file entries (issue2649) | |
163 |
|
163 | |||
164 | $ echo foo >> foo |
|
164 | $ echo foo >> foo | |
165 | $ echo fake >> .hg/requires |
|
165 | $ echo fake >> .hg/requires | |
166 | $ hg commit -m bla |
|
166 | $ hg commit -m bla | |
167 | abort: repository requires features unknown to this Mercurial: fake |
|
167 | abort: repository requires features unknown to this Mercurial: fake | |
168 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
|
168 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) | |
169 | [255] |
|
169 | [255] | |
170 |
|
170 | |||
171 | $ cd .. |
|
171 | $ cd .. | |
172 |
|
172 | |||
173 |
|
173 | |||
174 | partial subdir commit test |
|
174 | partial subdir commit test | |
175 |
|
175 | |||
176 | $ hg init test2 |
|
176 | $ hg init test2 | |
177 | $ cd test2 |
|
177 | $ cd test2 | |
178 | $ mkdir foo |
|
178 | $ mkdir foo | |
179 | $ echo foo > foo/foo |
|
179 | $ echo foo > foo/foo | |
180 | $ mkdir bar |
|
180 | $ mkdir bar | |
181 | $ echo bar > bar/bar |
|
181 | $ echo bar > bar/bar | |
182 | $ hg add |
|
182 | $ hg add | |
183 | adding bar/bar |
|
183 | adding bar/bar | |
184 | adding foo/foo |
|
184 | adding foo/foo | |
185 | $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo |
|
185 | $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo | |
186 | commit-subdir-1 |
|
186 | commit-subdir-1 | |
187 |
|
187 | |||
188 |
|
188 | |||
189 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
189 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
190 | HG: Leave message empty to abort commit. |
|
190 | HG: Leave message empty to abort commit. | |
191 | HG: -- |
|
191 | HG: -- | |
192 | HG: user: test |
|
192 | HG: user: test | |
193 | HG: branch 'default' |
|
193 | HG: branch 'default' | |
194 | HG: added foo/foo |
|
194 | HG: added foo/foo | |
195 |
|
195 | |||
196 |
|
196 | |||
197 | $ hg ci -m commit-subdir-2 bar |
|
197 | $ hg ci -m commit-subdir-2 bar | |
198 |
|
198 | |||
199 | subdir log 1 |
|
199 | subdir log 1 | |
200 |
|
200 | |||
201 | $ hg log -v foo |
|
201 | $ hg log -v foo | |
202 | changeset: 0:f97e73a25882 |
|
202 | changeset: 0:f97e73a25882 | |
203 | user: test |
|
203 | user: test | |
204 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
204 | date: Thu Jan 01 00:00:00 1970 +0000 | |
205 | files: foo/foo |
|
205 | files: foo/foo | |
206 | description: |
|
206 | description: | |
207 | commit-subdir-1 |
|
207 | commit-subdir-1 | |
208 |
|
208 | |||
209 |
|
209 | |||
210 |
|
210 | |||
211 | subdir log 2 |
|
211 | subdir log 2 | |
212 |
|
212 | |||
213 | $ hg log -v bar |
|
213 | $ hg log -v bar | |
214 | changeset: 1:aa809156d50d |
|
214 | changeset: 1:aa809156d50d | |
215 | tag: tip |
|
215 | tag: tip | |
216 | user: test |
|
216 | user: test | |
217 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
217 | date: Thu Jan 01 00:00:00 1970 +0000 | |
218 | files: bar/bar |
|
218 | files: bar/bar | |
219 | description: |
|
219 | description: | |
220 | commit-subdir-2 |
|
220 | commit-subdir-2 | |
221 |
|
221 | |||
222 |
|
222 | |||
223 |
|
223 | |||
224 | full log |
|
224 | full log | |
225 |
|
225 | |||
226 | $ hg log -v |
|
226 | $ hg log -v | |
227 | changeset: 1:aa809156d50d |
|
227 | changeset: 1:aa809156d50d | |
228 | tag: tip |
|
228 | tag: tip | |
229 | user: test |
|
229 | user: test | |
230 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
230 | date: Thu Jan 01 00:00:00 1970 +0000 | |
231 | files: bar/bar |
|
231 | files: bar/bar | |
232 | description: |
|
232 | description: | |
233 | commit-subdir-2 |
|
233 | commit-subdir-2 | |
234 |
|
234 | |||
235 |
|
235 | |||
236 | changeset: 0:f97e73a25882 |
|
236 | changeset: 0:f97e73a25882 | |
237 | user: test |
|
237 | user: test | |
238 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
238 | date: Thu Jan 01 00:00:00 1970 +0000 | |
239 | files: foo/foo |
|
239 | files: foo/foo | |
240 | description: |
|
240 | description: | |
241 | commit-subdir-1 |
|
241 | commit-subdir-1 | |
242 |
|
242 | |||
243 |
|
243 | |||
244 | $ cd .. |
|
244 | $ cd .. | |
245 |
|
245 | |||
246 |
|
246 | |||
247 | dot and subdir commit test |
|
247 | dot and subdir commit test | |
248 |
|
248 | |||
249 | $ hg init test3 |
|
249 | $ hg init test3 | |
250 | $ echo commit-foo-subdir > commit-log-test |
|
250 | $ echo commit-foo-subdir > commit-log-test | |
251 | $ cd test3 |
|
251 | $ cd test3 | |
252 | $ mkdir foo |
|
252 | $ mkdir foo | |
253 | $ echo foo content > foo/plain-file |
|
253 | $ echo foo content > foo/plain-file | |
254 | $ hg add foo/plain-file |
|
254 | $ hg add foo/plain-file | |
255 | $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo |
|
255 | $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo | |
256 | commit-foo-subdir |
|
256 | commit-foo-subdir | |
257 |
|
257 | |||
258 |
|
258 | |||
259 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
259 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
260 | HG: Leave message empty to abort commit. |
|
260 | HG: Leave message empty to abort commit. | |
261 | HG: -- |
|
261 | HG: -- | |
262 | HG: user: test |
|
262 | HG: user: test | |
263 | HG: branch 'default' |
|
263 | HG: branch 'default' | |
264 | HG: added foo/plain-file |
|
264 | HG: added foo/plain-file | |
265 |
|
265 | |||
266 |
|
266 | |||
267 | $ echo modified foo content > foo/plain-file |
|
267 | $ echo modified foo content > foo/plain-file | |
268 | $ hg ci -m commit-foo-dot . |
|
268 | $ hg ci -m commit-foo-dot . | |
269 |
|
269 | |||
270 | full log |
|
270 | full log | |
271 |
|
271 | |||
272 | $ hg log -v |
|
272 | $ hg log -v | |
273 | changeset: 1:95b38e3a5b2e |
|
273 | changeset: 1:95b38e3a5b2e | |
274 | tag: tip |
|
274 | tag: tip | |
275 | user: test |
|
275 | user: test | |
276 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
276 | date: Thu Jan 01 00:00:00 1970 +0000 | |
277 | files: foo/plain-file |
|
277 | files: foo/plain-file | |
278 | description: |
|
278 | description: | |
279 | commit-foo-dot |
|
279 | commit-foo-dot | |
280 |
|
280 | |||
281 |
|
281 | |||
282 | changeset: 0:65d4e9386227 |
|
282 | changeset: 0:65d4e9386227 | |
283 | user: test |
|
283 | user: test | |
284 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
284 | date: Thu Jan 01 00:00:00 1970 +0000 | |
285 | files: foo/plain-file |
|
285 | files: foo/plain-file | |
286 | description: |
|
286 | description: | |
287 | commit-foo-subdir |
|
287 | commit-foo-subdir | |
288 |
|
288 | |||
289 |
|
289 | |||
290 |
|
290 | |||
291 | subdir log |
|
291 | subdir log | |
292 |
|
292 | |||
293 | $ cd foo |
|
293 | $ cd foo | |
294 | $ hg log . |
|
294 | $ hg log . | |
295 | changeset: 1:95b38e3a5b2e |
|
295 | changeset: 1:95b38e3a5b2e | |
296 | tag: tip |
|
296 | tag: tip | |
297 | user: test |
|
297 | user: test | |
298 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
298 | date: Thu Jan 01 00:00:00 1970 +0000 | |
299 | summary: commit-foo-dot |
|
299 | summary: commit-foo-dot | |
300 |
|
300 | |||
301 | changeset: 0:65d4e9386227 |
|
301 | changeset: 0:65d4e9386227 | |
302 | user: test |
|
302 | user: test | |
303 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
303 | date: Thu Jan 01 00:00:00 1970 +0000 | |
304 | summary: commit-foo-subdir |
|
304 | summary: commit-foo-subdir | |
305 |
|
305 | |||
306 | $ cd .. |
|
306 | $ cd .. | |
307 | $ cd .. |
|
307 | $ cd .. | |
308 |
|
308 | |||
309 | Issue1049: Hg permits partial commit of merge without warning |
|
309 | Issue1049: Hg permits partial commit of merge without warning | |
310 |
|
310 | |||
311 | $ hg init issue1049 |
|
311 | $ hg init issue1049 | |
312 | $ cd issue1049 |
|
312 | $ cd issue1049 | |
313 | $ echo a > a |
|
313 | $ echo a > a | |
314 | $ hg ci -Ama |
|
314 | $ hg ci -Ama | |
315 | adding a |
|
315 | adding a | |
316 | $ echo a >> a |
|
316 | $ echo a >> a | |
317 | $ hg ci -mb |
|
317 | $ hg ci -mb | |
318 | $ hg up 0 |
|
318 | $ hg up 0 | |
319 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
319 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
320 | $ echo b >> a |
|
320 | $ echo b >> a | |
321 | $ hg ci -mc |
|
321 | $ hg ci -mc | |
322 | created new head |
|
322 | created new head | |
323 | $ HGMERGE=true hg merge |
|
323 | $ HGMERGE=true hg merge | |
324 | merging a |
|
324 | merging a | |
325 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
325 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
326 | (branch merge, don't forget to commit) |
|
326 | (branch merge, don't forget to commit) | |
327 |
|
327 | |||
328 | should fail because we are specifying a file name |
|
328 | should fail because we are specifying a file name | |
329 |
|
329 | |||
330 | $ hg ci -mmerge a |
|
330 | $ hg ci -mmerge a | |
331 | abort: cannot partially commit a merge (do not specify files or patterns) |
|
331 | abort: cannot partially commit a merge (do not specify files or patterns) | |
332 | [255] |
|
332 | [255] | |
333 |
|
333 | |||
334 | should fail because we are specifying a pattern |
|
334 | should fail because we are specifying a pattern | |
335 |
|
335 | |||
336 | $ hg ci -mmerge -I a |
|
336 | $ hg ci -mmerge -I a | |
337 | abort: cannot partially commit a merge (do not specify files or patterns) |
|
337 | abort: cannot partially commit a merge (do not specify files or patterns) | |
338 | [255] |
|
338 | [255] | |
339 |
|
339 | |||
340 | should succeed |
|
340 | should succeed | |
341 |
|
341 | |||
342 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit |
|
342 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit | |
343 | HGEDITFORM=commit.normal.merge |
|
343 | HGEDITFORM=commit.normal.merge | |
344 | $ cd .. |
|
344 | $ cd .. | |
345 |
|
345 | |||
346 |
|
346 | |||
347 | test commit message content |
|
347 | test commit message content | |
348 |
|
348 | |||
349 | $ hg init commitmsg |
|
349 | $ hg init commitmsg | |
350 | $ cd commitmsg |
|
350 | $ cd commitmsg | |
351 | $ echo changed > changed |
|
351 | $ echo changed > changed | |
352 | $ echo removed > removed |
|
352 | $ echo removed > removed | |
353 | $ hg book activebookmark |
|
353 | $ hg book activebookmark | |
354 | $ hg ci -qAm init |
|
354 | $ hg ci -qAm init | |
355 |
|
355 | |||
356 | $ hg rm removed |
|
356 | $ hg rm removed | |
357 | $ echo changed >> changed |
|
357 | $ echo changed >> changed | |
358 | $ echo added > added |
|
358 | $ echo added > added | |
359 | $ hg add added |
|
359 | $ hg add added | |
360 | $ HGEDITOR=cat hg ci -A |
|
360 | $ HGEDITOR=cat hg ci -A | |
361 |
|
361 | |||
362 |
|
362 | |||
363 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
363 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
364 | HG: Leave message empty to abort commit. |
|
364 | HG: Leave message empty to abort commit. | |
365 | HG: -- |
|
365 | HG: -- | |
366 | HG: user: test |
|
366 | HG: user: test | |
367 | HG: branch 'default' |
|
367 | HG: branch 'default' | |
368 | HG: bookmark 'activebookmark' |
|
368 | HG: bookmark 'activebookmark' | |
369 | HG: added added |
|
369 | HG: added added | |
370 | HG: changed changed |
|
370 | HG: changed changed | |
371 | HG: removed removed |
|
371 | HG: removed removed | |
372 | abort: empty commit message |
|
372 | abort: empty commit message | |
373 | [10] |
|
373 | [10] | |
374 |
|
374 | |||
375 | test saving last-message.txt |
|
375 | test saving last-message.txt | |
376 |
|
376 | |||
377 | $ hg init sub |
|
377 | $ hg init sub | |
378 | $ echo a > sub/a |
|
378 | $ echo a > sub/a | |
379 | $ hg -R sub add sub/a |
|
379 | $ hg -R sub add sub/a | |
380 | $ cat > sub/.hg/hgrc <<EOF |
|
380 | $ cat > sub/.hg/hgrc <<EOF | |
381 | > [hooks] |
|
381 | > [hooks] | |
382 | > precommit.test-saving-last-message = false |
|
382 | > precommit.test-saving-last-message = false | |
383 | > EOF |
|
383 | > EOF | |
384 |
|
384 | |||
385 | $ echo 'sub = sub' > .hgsub |
|
385 | $ echo 'sub = sub' > .hgsub | |
386 | $ hg add .hgsub |
|
386 | $ hg add .hgsub | |
387 |
|
387 | |||
388 | $ cat > $TESTTMP/editor.sh <<EOF |
|
388 | $ cat > $TESTTMP/editor.sh <<EOF | |
389 | > echo "==== before editing:" |
|
389 | > echo "==== before editing:" | |
390 | > cat \$1 |
|
390 | > cat \$1 | |
391 | > echo "====" |
|
391 | > echo "====" | |
392 | > echo "test saving last-message.txt" >> \$1 |
|
392 | > echo "test saving last-message.txt" >> \$1 | |
393 | > EOF |
|
393 | > EOF | |
394 |
|
394 | |||
395 | $ rm -f .hg/last-message.txt |
|
395 | $ rm -f .hg/last-message.txt | |
396 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q |
|
396 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q | |
397 | ==== before editing: |
|
397 | ==== before editing: | |
398 |
|
398 | |||
399 |
|
399 | |||
400 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
400 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
401 | HG: Leave message empty to abort commit. |
|
401 | HG: Leave message empty to abort commit. | |
402 | HG: -- |
|
402 | HG: -- | |
403 | HG: user: test |
|
403 | HG: user: test | |
404 | HG: branch 'default' |
|
404 | HG: branch 'default' | |
405 | HG: bookmark 'activebookmark' |
|
405 | HG: bookmark 'activebookmark' | |
406 | HG: subrepo sub |
|
406 | HG: subrepo sub | |
407 | HG: added .hgsub |
|
407 | HG: added .hgsub | |
408 | HG: added added |
|
408 | HG: added added | |
409 | HG: changed .hgsubstate |
|
409 | HG: changed .hgsubstate | |
410 | HG: changed changed |
|
410 | HG: changed changed | |
411 | HG: removed removed |
|
411 | HG: removed removed | |
412 | ==== |
|
412 | ==== | |
413 | abort: precommit.test-saving-last-message hook exited with status 1 (in subrepository "sub") |
|
413 | abort: precommit.test-saving-last-message hook exited with status 1 (in subrepository "sub") | |
414 | [255] |
|
414 | [255] | |
415 | $ cat .hg/last-message.txt |
|
415 | $ cat .hg/last-message.txt | |
416 |
|
416 | |||
417 |
|
417 | |||
418 | test saving last-message.txt |
|
418 | test saving last-message.txt | |
419 |
|
419 | |||
420 | test that '[committemplate] changeset' definition and commit log |
|
420 | test that '[committemplate] changeset' definition and commit log | |
421 | specific template keywords work well |
|
421 | specific template keywords work well | |
422 |
|
422 | |||
423 | $ cat >> .hg/hgrc <<EOF |
|
423 | $ cat >> .hg/hgrc <<EOF | |
424 | > [committemplate] |
|
424 | > [committemplate] | |
425 | > changeset.commit.normal = 'HG: this is "commit.normal" template |
|
425 | > changeset.commit.normal = 'HG: this is "commit.normal" template | |
426 | > HG: {extramsg} |
|
426 | > HG: {extramsg} | |
427 | > {if(activebookmark, |
|
427 | > {if(activebookmark, | |
428 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
428 | > "HG: bookmark '{activebookmark}' is activated\n", | |
429 | > "HG: no bookmark is activated\n")}{subrepos % |
|
429 | > "HG: no bookmark is activated\n")}{subrepos % | |
430 | > "HG: subrepo '{subrepo}' is changed\n"}' |
|
430 | > "HG: subrepo '{subrepo}' is changed\n"}' | |
431 | > |
|
431 | > | |
432 | > changeset.commit = HG: this is "commit" template |
|
432 | > changeset.commit = HG: this is "commit" template | |
433 | > HG: {extramsg} |
|
433 | > HG: {extramsg} | |
434 | > {if(activebookmark, |
|
434 | > {if(activebookmark, | |
435 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
435 | > "HG: bookmark '{activebookmark}' is activated\n", | |
436 | > "HG: no bookmark is activated\n")}{subrepos % |
|
436 | > "HG: no bookmark is activated\n")}{subrepos % | |
437 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
437 | > "HG: subrepo '{subrepo}' is changed\n"} | |
438 | > |
|
438 | > | |
439 | > changeset = HG: this is customized commit template |
|
439 | > changeset = HG: this is customized commit template | |
440 | > HG: {extramsg} |
|
440 | > HG: {extramsg} | |
441 | > {if(activebookmark, |
|
441 | > {if(activebookmark, | |
442 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
442 | > "HG: bookmark '{activebookmark}' is activated\n", | |
443 | > "HG: no bookmark is activated\n")}{subrepos % |
|
443 | > "HG: no bookmark is activated\n")}{subrepos % | |
444 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
444 | > "HG: subrepo '{subrepo}' is changed\n"} | |
445 | > EOF |
|
445 | > EOF | |
446 |
|
446 | |||
447 | $ hg init sub2 |
|
447 | $ hg init sub2 | |
448 | $ echo a > sub2/a |
|
448 | $ echo a > sub2/a | |
449 | $ hg -R sub2 add sub2/a |
|
449 | $ hg -R sub2 add sub2/a | |
450 | $ echo 'sub2 = sub2' >> .hgsub |
|
450 | $ echo 'sub2 = sub2' >> .hgsub | |
451 |
|
451 | |||
452 | $ HGEDITOR=cat hg commit -S -q |
|
452 | $ HGEDITOR=cat hg commit -S -q | |
453 | HG: this is "commit.normal" template |
|
453 | HG: this is "commit.normal" template | |
454 | HG: Leave message empty to abort commit. |
|
454 | HG: Leave message empty to abort commit. | |
455 | HG: bookmark 'activebookmark' is activated |
|
455 | HG: bookmark 'activebookmark' is activated | |
456 | HG: subrepo 'sub' is changed |
|
456 | HG: subrepo 'sub' is changed | |
457 | HG: subrepo 'sub2' is changed |
|
457 | HG: subrepo 'sub2' is changed | |
458 | abort: empty commit message |
|
458 | abort: empty commit message | |
459 | [10] |
|
459 | [10] | |
460 |
|
460 | |||
461 | $ cat >> .hg/hgrc <<EOF |
|
461 | $ cat >> .hg/hgrc <<EOF | |
462 | > [committemplate] |
|
462 | > [committemplate] | |
463 | > changeset.commit.normal = |
|
463 | > changeset.commit.normal = | |
464 | > # now, "changeset.commit" should be chosen for "hg commit" |
|
464 | > # now, "changeset.commit" should be chosen for "hg commit" | |
465 | > EOF |
|
465 | > EOF | |
466 |
|
466 | |||
467 | $ hg bookmark --inactive activebookmark |
|
467 | $ hg bookmark --inactive activebookmark | |
468 | $ hg forget .hgsub |
|
468 | $ hg forget .hgsub | |
469 | $ HGEDITOR=cat hg commit -q |
|
469 | $ HGEDITOR=cat hg commit -q | |
470 | HG: this is "commit" template |
|
470 | HG: this is "commit" template | |
471 | HG: Leave message empty to abort commit. |
|
471 | HG: Leave message empty to abort commit. | |
472 | HG: no bookmark is activated |
|
472 | HG: no bookmark is activated | |
473 | abort: empty commit message |
|
473 | abort: empty commit message | |
474 | [10] |
|
474 | [10] | |
475 |
|
475 | |||
476 | $ cat >> .hg/hgrc <<EOF |
|
476 | $ cat >> .hg/hgrc <<EOF | |
477 | > [committemplate] |
|
477 | > [committemplate] | |
478 | > changeset.commit = |
|
478 | > changeset.commit = | |
479 | > # now, "changeset" should be chosen for "hg commit" |
|
479 | > # now, "changeset" should be chosen for "hg commit" | |
480 | > EOF |
|
480 | > EOF | |
481 |
|
481 | |||
482 | $ HGEDITOR=cat hg commit -q |
|
482 | $ HGEDITOR=cat hg commit -q | |
483 | HG: this is customized commit template |
|
483 | HG: this is customized commit template | |
484 | HG: Leave message empty to abort commit. |
|
484 | HG: Leave message empty to abort commit. | |
485 | HG: no bookmark is activated |
|
485 | HG: no bookmark is activated | |
486 | abort: empty commit message |
|
486 | abort: empty commit message | |
487 | [10] |
|
487 | [10] | |
488 |
|
488 | |||
489 | $ cat >> .hg/hgrc <<EOF |
|
489 | $ cat >> .hg/hgrc <<EOF | |
490 | > [committemplate] |
|
490 | > [committemplate] | |
491 | > changeset = {desc} |
|
491 | > changeset = {desc} | |
492 | > HG: mods={file_mods} |
|
492 | > HG: mods={file_mods} | |
493 | > HG: adds={file_adds} |
|
493 | > HG: adds={file_adds} | |
494 | > HG: dels={file_dels} |
|
494 | > HG: dels={file_dels} | |
495 | > HG: files={files} |
|
495 | > HG: files={files} | |
496 | > HG: |
|
496 | > HG: | |
497 | > {splitlines(diff()) % 'HG: {line}\n' |
|
497 | > {splitlines(diff()) % 'HG: {line}\n' | |
498 | > }HG: |
|
498 | > }HG: | |
499 | > HG: mods={file_mods} |
|
499 | > HG: mods={file_mods} | |
500 | > HG: adds={file_adds} |
|
500 | > HG: adds={file_adds} | |
501 | > HG: dels={file_dels} |
|
501 | > HG: dels={file_dels} | |
502 | > HG: files={files}\n |
|
502 | > HG: files={files}\n | |
503 | > EOF |
|
503 | > EOF | |
504 | $ hg status -amr |
|
504 | $ hg status -amr | |
505 | M changed |
|
505 | M changed | |
506 | A added |
|
506 | A added | |
507 | R removed |
|
507 | R removed | |
508 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed |
|
508 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed | |
509 | foo bar |
|
509 | foo bar | |
510 | HG: mods=changed |
|
510 | HG: mods=changed | |
511 | HG: adds= |
|
511 | HG: adds= | |
512 | HG: dels= |
|
512 | HG: dels= | |
513 | HG: files=changed |
|
513 | HG: files=changed | |
514 | HG: |
|
514 | HG: | |
515 | HG: diff -r d2313f97106f changed |
|
515 | HG: diff -r d2313f97106f changed | |
516 | HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 |
|
516 | HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 | |
517 | HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 |
|
517 | HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 | |
518 | HG: @@ -1,1 +1,2 @@ |
|
518 | HG: @@ -1,1 +1,2 @@ | |
519 | HG: changed |
|
519 | HG: changed | |
520 | HG: +changed |
|
520 | HG: +changed | |
521 | HG: |
|
521 | HG: | |
522 | HG: mods=changed |
|
522 | HG: mods=changed | |
523 | HG: adds= |
|
523 | HG: adds= | |
524 | HG: dels= |
|
524 | HG: dels= | |
525 | HG: files=changed |
|
525 | HG: files=changed | |
526 | $ hg status -amr |
|
526 | $ hg status -amr | |
527 | A added |
|
527 | A added | |
528 | R removed |
|
528 | R removed | |
529 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" |
|
529 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" | |
530 | M changed |
|
530 | M changed | |
531 | A |
|
531 | A | |
532 | R |
|
532 | R | |
533 | $ hg rollback -q |
|
533 | $ hg rollback -q | |
534 |
|
534 | |||
535 | $ cat >> .hg/hgrc <<EOF |
|
535 | $ cat >> .hg/hgrc <<EOF | |
536 | > [committemplate] |
|
536 | > [committemplate] | |
537 | > changeset = {desc} |
|
537 | > changeset = {desc} | |
538 | > HG: mods={file_mods} |
|
538 | > HG: mods={file_mods} | |
539 | > HG: adds={file_adds} |
|
539 | > HG: adds={file_adds} | |
540 | > HG: dels={file_dels} |
|
540 | > HG: dels={file_dels} | |
541 | > HG: files={files} |
|
541 | > HG: files={files} | |
542 | > HG: |
|
542 | > HG: | |
543 | > {splitlines(diff("changed")) % 'HG: {line}\n' |
|
543 | > {splitlines(diff("changed")) % 'HG: {line}\n' | |
544 | > }HG: |
|
544 | > }HG: | |
545 | > HG: mods={file_mods} |
|
545 | > HG: mods={file_mods} | |
546 | > HG: adds={file_adds} |
|
546 | > HG: adds={file_adds} | |
547 | > HG: dels={file_dels} |
|
547 | > HG: dels={file_dels} | |
548 | > HG: files={files} |
|
548 | > HG: files={files} | |
549 | > HG: |
|
549 | > HG: | |
550 | > {splitlines(diff("added")) % 'HG: {line}\n' |
|
550 | > {splitlines(diff("added")) % 'HG: {line}\n' | |
551 | > }HG: |
|
551 | > }HG: | |
552 | > HG: mods={file_mods} |
|
552 | > HG: mods={file_mods} | |
553 | > HG: adds={file_adds} |
|
553 | > HG: adds={file_adds} | |
554 | > HG: dels={file_dels} |
|
554 | > HG: dels={file_dels} | |
555 | > HG: files={files} |
|
555 | > HG: files={files} | |
556 | > HG: |
|
556 | > HG: | |
557 | > {splitlines(diff("removed")) % 'HG: {line}\n' |
|
557 | > {splitlines(diff("removed")) % 'HG: {line}\n' | |
558 | > }HG: |
|
558 | > }HG: | |
559 | > HG: mods={file_mods} |
|
559 | > HG: mods={file_mods} | |
560 | > HG: adds={file_adds} |
|
560 | > HG: adds={file_adds} | |
561 | > HG: dels={file_dels} |
|
561 | > HG: dels={file_dels} | |
562 | > HG: files={files}\n |
|
562 | > HG: files={files}\n | |
563 | > EOF |
|
563 | > EOF | |
564 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed |
|
564 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed | |
565 | foo bar |
|
565 | foo bar | |
566 | HG: mods= |
|
566 | HG: mods= | |
567 | HG: adds=added |
|
567 | HG: adds=added | |
568 | HG: dels=removed |
|
568 | HG: dels=removed | |
569 | HG: files=added removed |
|
569 | HG: files=added removed | |
570 | HG: |
|
570 | HG: | |
571 | HG: |
|
571 | HG: | |
572 | HG: mods= |
|
572 | HG: mods= | |
573 | HG: adds=added |
|
573 | HG: adds=added | |
574 | HG: dels=removed |
|
574 | HG: dels=removed | |
575 | HG: files=added removed |
|
575 | HG: files=added removed | |
576 | HG: |
|
576 | HG: | |
577 | HG: diff -r d2313f97106f added |
|
577 | HG: diff -r d2313f97106f added | |
578 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
578 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
579 | HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 |
|
579 | HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 | |
580 | HG: @@ -0,0 +1,1 @@ |
|
580 | HG: @@ -0,0 +1,1 @@ | |
581 | HG: +added |
|
581 | HG: +added | |
582 | HG: |
|
582 | HG: | |
583 | HG: mods= |
|
583 | HG: mods= | |
584 | HG: adds=added |
|
584 | HG: adds=added | |
585 | HG: dels=removed |
|
585 | HG: dels=removed | |
586 | HG: files=added removed |
|
586 | HG: files=added removed | |
587 | HG: |
|
587 | HG: | |
588 | HG: diff -r d2313f97106f removed |
|
588 | HG: diff -r d2313f97106f removed | |
589 | HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 |
|
589 | HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 | |
590 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
590 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
591 | HG: @@ -1,1 +0,0 @@ |
|
591 | HG: @@ -1,1 +0,0 @@ | |
592 | HG: -removed |
|
592 | HG: -removed | |
593 | HG: |
|
593 | HG: | |
594 | HG: mods= |
|
594 | HG: mods= | |
595 | HG: adds=added |
|
595 | HG: adds=added | |
596 | HG: dels=removed |
|
596 | HG: dels=removed | |
597 | HG: files=added removed |
|
597 | HG: files=added removed | |
598 | $ hg status -amr |
|
598 | $ hg status -amr | |
599 | M changed |
|
599 | M changed | |
600 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" |
|
600 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" | |
601 | M |
|
601 | M | |
602 | A added |
|
602 | A added | |
603 | R removed |
|
603 | R removed | |
604 | $ hg rollback -q |
|
604 | $ hg rollback -q | |
605 |
|
605 | |||
606 | $ cat >> .hg/hgrc <<EOF |
|
606 | $ cat >> .hg/hgrc <<EOF | |
607 | > # disable customizing for subsequent tests |
|
607 | > # disable customizing for subsequent tests | |
608 | > [committemplate] |
|
608 | > [committemplate] | |
609 | > changeset = |
|
609 | > changeset = | |
610 | > EOF |
|
610 | > EOF | |
611 |
|
611 | |||
612 | $ cd .. |
|
612 | $ cd .. | |
613 |
|
613 | |||
614 |
|
614 | |||
615 | commit copy |
|
615 | commit copy | |
616 |
|
616 | |||
617 | $ hg init dir2 |
|
617 | $ hg init dir2 | |
618 | $ cd dir2 |
|
618 | $ cd dir2 | |
619 | $ echo bleh > bar |
|
619 | $ echo bleh > bar | |
620 | $ hg add bar |
|
620 | $ hg add bar | |
621 | $ hg ci -m 'add bar' |
|
621 | $ hg ci -m 'add bar' | |
622 |
|
622 | |||
623 | $ hg cp bar foo |
|
623 | $ hg cp bar foo | |
624 | $ echo >> bar |
|
624 | $ echo >> bar | |
625 | $ hg ci -m 'cp bar foo; change bar' |
|
625 | $ hg ci -m 'cp bar foo; change bar' | |
626 |
|
626 | |||
627 | $ hg debugrename foo |
|
627 | $ hg debugrename foo | |
628 | foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 |
|
628 | foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 | |
629 | $ hg debugindex bar |
|
629 | $ hg debugindex bar | |
630 | rev linkrev nodeid p1 p2 |
|
630 | rev linkrev nodeid p1 p2 | |
631 | 0 0 26d3ca0dfd18 000000000000 000000000000 |
|
631 | 0 0 26d3ca0dfd18 000000000000 000000000000 | |
632 | 1 1 d267bddd54f7 26d3ca0dfd18 000000000000 |
|
632 | 1 1 d267bddd54f7 26d3ca0dfd18 000000000000 | |
633 |
|
633 | |||
634 | Test making empty commits |
|
634 | Test making empty commits | |
635 | $ hg commit --config ui.allowemptycommit=True -m "empty commit" |
|
635 | $ hg commit --config ui.allowemptycommit=True -m "empty commit" | |
636 | $ hg log -r . -v --stat |
|
636 | $ hg log -r . -v --stat | |
637 | changeset: 2:d809f3644287 |
|
637 | changeset: 2:d809f3644287 | |
638 | tag: tip |
|
638 | tag: tip | |
639 | user: test |
|
639 | user: test | |
640 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
640 | date: Thu Jan 01 00:00:00 1970 +0000 | |
641 | description: |
|
641 | description: | |
642 | empty commit |
|
642 | empty commit | |
643 |
|
643 | |||
644 |
|
644 | |||
645 |
|
645 | |||
646 | verify pathauditor blocks evil filepaths |
|
646 | verify pathauditor blocks evil filepaths | |
647 | $ cat > evil-commit.py <<EOF |
|
647 | $ cat > evil-commit.py <<EOF | |
648 | > from __future__ import absolute_import |
|
648 | > from __future__ import absolute_import | |
649 | > from mercurial import context, hg, ui as uimod |
|
649 | > from mercurial import context, hg, ui as uimod | |
650 | > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc' |
|
650 | > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc' | |
651 | > u = uimod.ui.load() |
|
651 | > u = uimod.ui.load() | |
652 | > r = hg.repository(u, b'.') |
|
652 | > r = hg.repository(u, b'.') | |
653 | > def filectxfn(repo, memctx, path): |
|
653 | > def filectxfn(repo, memctx, path): | |
654 | > return context.memfilectx(repo, memctx, path, |
|
654 | > return context.memfilectx(repo, memctx, path, | |
655 | > b'[hooks]\nupdate = echo owned') |
|
655 | > b'[hooks]\nupdate = echo owned') | |
656 | > c = context.memctx(r, [r.changelog.tip(), r.nullid], |
|
656 | > c = context.memctx(r, [r.changelog.tip(), r.nullid], | |
657 | > b'evil', [notrc], filectxfn, 0) |
|
657 | > b'evil', [notrc], filectxfn, 0) | |
658 | > r.commitctx(c) |
|
658 | > r.commitctx(c) | |
659 | > EOF |
|
659 | > EOF | |
660 | $ "$PYTHON" evil-commit.py |
|
660 | $ "$PYTHON" evil-commit.py | |
661 | #if windows |
|
661 | #if windows | |
662 | $ hg co --clean tip |
|
662 | $ hg co --clean tip | |
663 | abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) |
|
663 | abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) | |
664 |
[ |
|
664 | [10] | |
665 | #else |
|
665 | #else | |
666 | $ hg co --clean tip |
|
666 | $ hg co --clean tip | |
667 | abort: path contains illegal component: .h\xe2\x80\x8cg/hgrc (esc) |
|
667 | abort: path contains illegal component: .h\xe2\x80\x8cg/hgrc (esc) | |
668 |
[ |
|
668 | [10] | |
669 | #endif |
|
669 | #endif | |
670 |
|
670 | |||
671 | $ hg rollback -f |
|
671 | $ hg rollback -f | |
672 | repository tip rolled back to revision 2 (undo commit) |
|
672 | repository tip rolled back to revision 2 (undo commit) | |
673 | $ cat > evil-commit.py <<EOF |
|
673 | $ cat > evil-commit.py <<EOF | |
674 | > from __future__ import absolute_import |
|
674 | > from __future__ import absolute_import | |
675 | > from mercurial import context, hg, ui as uimod |
|
675 | > from mercurial import context, hg, ui as uimod | |
676 | > notrc = b"HG~1/hgrc" |
|
676 | > notrc = b"HG~1/hgrc" | |
677 | > u = uimod.ui.load() |
|
677 | > u = uimod.ui.load() | |
678 | > r = hg.repository(u, b'.') |
|
678 | > r = hg.repository(u, b'.') | |
679 | > def filectxfn(repo, memctx, path): |
|
679 | > def filectxfn(repo, memctx, path): | |
680 | > return context.memfilectx(repo, memctx, path, |
|
680 | > return context.memfilectx(repo, memctx, path, | |
681 | > b'[hooks]\nupdate = echo owned') |
|
681 | > b'[hooks]\nupdate = echo owned') | |
682 | > c = context.memctx(r, [r[b'tip'].node(), r.nullid], |
|
682 | > c = context.memctx(r, [r[b'tip'].node(), r.nullid], | |
683 | > b'evil', [notrc], filectxfn, 0) |
|
683 | > b'evil', [notrc], filectxfn, 0) | |
684 | > r.commitctx(c) |
|
684 | > r.commitctx(c) | |
685 | > EOF |
|
685 | > EOF | |
686 | $ "$PYTHON" evil-commit.py |
|
686 | $ "$PYTHON" evil-commit.py | |
687 | $ hg co --clean tip |
|
687 | $ hg co --clean tip | |
688 | abort: path contains illegal component: HG~1/hgrc |
|
688 | abort: path contains illegal component: HG~1/hgrc | |
689 |
[ |
|
689 | [10] | |
690 |
|
690 | |||
691 | $ hg rollback -f |
|
691 | $ hg rollback -f | |
692 | repository tip rolled back to revision 2 (undo commit) |
|
692 | repository tip rolled back to revision 2 (undo commit) | |
693 | $ cat > evil-commit.py <<EOF |
|
693 | $ cat > evil-commit.py <<EOF | |
694 | > from __future__ import absolute_import |
|
694 | > from __future__ import absolute_import | |
695 | > from mercurial import context, hg, ui as uimod |
|
695 | > from mercurial import context, hg, ui as uimod | |
696 | > notrc = b"HG8B6C~2/hgrc" |
|
696 | > notrc = b"HG8B6C~2/hgrc" | |
697 | > u = uimod.ui.load() |
|
697 | > u = uimod.ui.load() | |
698 | > r = hg.repository(u, b'.') |
|
698 | > r = hg.repository(u, b'.') | |
699 | > def filectxfn(repo, memctx, path): |
|
699 | > def filectxfn(repo, memctx, path): | |
700 | > return context.memfilectx(repo, memctx, path, |
|
700 | > return context.memfilectx(repo, memctx, path, | |
701 | > b'[hooks]\nupdate = echo owned') |
|
701 | > b'[hooks]\nupdate = echo owned') | |
702 | > c = context.memctx(r, [r[b'tip'].node(), r.nullid], |
|
702 | > c = context.memctx(r, [r[b'tip'].node(), r.nullid], | |
703 | > b'evil', [notrc], filectxfn, 0) |
|
703 | > b'evil', [notrc], filectxfn, 0) | |
704 | > r.commitctx(c) |
|
704 | > r.commitctx(c) | |
705 | > EOF |
|
705 | > EOF | |
706 | $ "$PYTHON" evil-commit.py |
|
706 | $ "$PYTHON" evil-commit.py | |
707 | $ hg co --clean tip |
|
707 | $ hg co --clean tip | |
708 | abort: path contains illegal component: HG8B6C~2/hgrc |
|
708 | abort: path contains illegal component: HG8B6C~2/hgrc | |
709 |
[ |
|
709 | [10] | |
710 |
|
710 | |||
711 | $ cd .. |
|
711 | $ cd .. | |
712 |
|
712 | |||
713 | # test that an unmodified commit template message aborts |
|
713 | # test that an unmodified commit template message aborts | |
714 |
|
714 | |||
715 | $ hg init unmodified_commit_template |
|
715 | $ hg init unmodified_commit_template | |
716 | $ cd unmodified_commit_template |
|
716 | $ cd unmodified_commit_template | |
717 | $ echo foo > foo |
|
717 | $ echo foo > foo | |
718 | $ hg add foo |
|
718 | $ hg add foo | |
719 | $ hg commit -m "foo" |
|
719 | $ hg commit -m "foo" | |
720 | $ cat >> .hg/hgrc <<EOF |
|
720 | $ cat >> .hg/hgrc <<EOF | |
721 | > [committemplate] |
|
721 | > [committemplate] | |
722 | > changeset.commit = HI THIS IS NOT STRIPPED |
|
722 | > changeset.commit = HI THIS IS NOT STRIPPED | |
723 | > HG: this is customized commit template |
|
723 | > HG: this is customized commit template | |
724 | > HG: {extramsg} |
|
724 | > HG: {extramsg} | |
725 | > {if(activebookmark, |
|
725 | > {if(activebookmark, | |
726 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
726 | > "HG: bookmark '{activebookmark}' is activated\n", | |
727 | > "HG: no bookmark is activated\n")}{subrepos % |
|
727 | > "HG: no bookmark is activated\n")}{subrepos % | |
728 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
728 | > "HG: subrepo '{subrepo}' is changed\n"} | |
729 | > EOF |
|
729 | > EOF | |
730 | $ cat > $TESTTMP/notouching.sh <<EOF |
|
730 | $ cat > $TESTTMP/notouching.sh <<EOF | |
731 | > true |
|
731 | > true | |
732 | > EOF |
|
732 | > EOF | |
733 | $ echo foo2 > foo2 |
|
733 | $ echo foo2 > foo2 | |
734 | $ hg add foo2 |
|
734 | $ hg add foo2 | |
735 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit |
|
735 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit | |
736 | abort: commit message unchanged |
|
736 | abort: commit message unchanged | |
737 | [10] |
|
737 | [10] | |
738 |
|
738 | |||
739 | $ cd .. |
|
739 | $ cd .. | |
740 |
|
740 | |||
741 | test that text below the --- >8 --- special string is ignored |
|
741 | test that text below the --- >8 --- special string is ignored | |
742 |
|
742 | |||
743 | $ cat <<'EOF' > $TESTTMP/lowercaseline.sh |
|
743 | $ cat <<'EOF' > $TESTTMP/lowercaseline.sh | |
744 | > cat $1 | sed s/LINE/line/ | tee $1.new |
|
744 | > cat $1 | sed s/LINE/line/ | tee $1.new | |
745 | > mv $1.new $1 |
|
745 | > mv $1.new $1 | |
746 | > EOF |
|
746 | > EOF | |
747 |
|
747 | |||
748 | $ hg init ignore_below_special_string |
|
748 | $ hg init ignore_below_special_string | |
749 | $ cd ignore_below_special_string |
|
749 | $ cd ignore_below_special_string | |
750 | $ echo foo > foo |
|
750 | $ echo foo > foo | |
751 | $ hg add foo |
|
751 | $ hg add foo | |
752 | $ hg commit -m "foo" |
|
752 | $ hg commit -m "foo" | |
753 | $ cat >> .hg/hgrc <<EOF |
|
753 | $ cat >> .hg/hgrc <<EOF | |
754 | > [committemplate] |
|
754 | > [committemplate] | |
755 | > changeset.commit = first LINE |
|
755 | > changeset.commit = first LINE | |
756 | > HG: this is customized commit template |
|
756 | > HG: this is customized commit template | |
757 | > HG: {extramsg} |
|
757 | > HG: {extramsg} | |
758 | > HG: ------------------------ >8 ------------------------ |
|
758 | > HG: ------------------------ >8 ------------------------ | |
759 | > {diff()} |
|
759 | > {diff()} | |
760 | > EOF |
|
760 | > EOF | |
761 | $ echo foo2 > foo2 |
|
761 | $ echo foo2 > foo2 | |
762 | $ hg add foo2 |
|
762 | $ hg add foo2 | |
763 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg ci |
|
763 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg ci | |
764 | abort: commit message unchanged |
|
764 | abort: commit message unchanged | |
765 | [10] |
|
765 | [10] | |
766 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci |
|
766 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
767 | first line |
|
767 | first line | |
768 | HG: this is customized commit template |
|
768 | HG: this is customized commit template | |
769 | HG: Leave message empty to abort commit. |
|
769 | HG: Leave message empty to abort commit. | |
770 | HG: ------------------------ >8 ------------------------ |
|
770 | HG: ------------------------ >8 ------------------------ | |
771 | diff -r e63c23eaa88a foo2 |
|
771 | diff -r e63c23eaa88a foo2 | |
772 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
772 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
773 | +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 |
|
773 | +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 | |
774 | @@ -0,0 +1,1 @@ |
|
774 | @@ -0,0 +1,1 @@ | |
775 | +foo2 |
|
775 | +foo2 | |
776 | $ hg log -T '{desc}\n' -r . |
|
776 | $ hg log -T '{desc}\n' -r . | |
777 | first line |
|
777 | first line | |
778 |
|
778 | |||
779 | test that the special string --- >8 --- isn't used when not at the beginning of |
|
779 | test that the special string --- >8 --- isn't used when not at the beginning of | |
780 | a line |
|
780 | a line | |
781 |
|
781 | |||
782 | $ cat >> .hg/hgrc <<EOF |
|
782 | $ cat >> .hg/hgrc <<EOF | |
783 | > [committemplate] |
|
783 | > [committemplate] | |
784 | > changeset.commit = first LINE2 |
|
784 | > changeset.commit = first LINE2 | |
785 | > another line HG: ------------------------ >8 ------------------------ |
|
785 | > another line HG: ------------------------ >8 ------------------------ | |
786 | > HG: this is customized commit template |
|
786 | > HG: this is customized commit template | |
787 | > HG: {extramsg} |
|
787 | > HG: {extramsg} | |
788 | > HG: ------------------------ >8 ------------------------ |
|
788 | > HG: ------------------------ >8 ------------------------ | |
789 | > {diff()} |
|
789 | > {diff()} | |
790 | > EOF |
|
790 | > EOF | |
791 | $ echo foo >> foo |
|
791 | $ echo foo >> foo | |
792 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci |
|
792 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
793 | first line2 |
|
793 | first line2 | |
794 | another line HG: ------------------------ >8 ------------------------ |
|
794 | another line HG: ------------------------ >8 ------------------------ | |
795 | HG: this is customized commit template |
|
795 | HG: this is customized commit template | |
796 | HG: Leave message empty to abort commit. |
|
796 | HG: Leave message empty to abort commit. | |
797 | HG: ------------------------ >8 ------------------------ |
|
797 | HG: ------------------------ >8 ------------------------ | |
798 | diff -r 3661b22b0702 foo |
|
798 | diff -r 3661b22b0702 foo | |
799 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 |
|
799 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 | |
800 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
800 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
801 | @@ -1,1 +1,2 @@ |
|
801 | @@ -1,1 +1,2 @@ | |
802 | foo |
|
802 | foo | |
803 | +foo |
|
803 | +foo | |
804 | $ hg log -T '{desc}\n' -r . |
|
804 | $ hg log -T '{desc}\n' -r . | |
805 | first line2 |
|
805 | first line2 | |
806 | another line HG: ------------------------ >8 ------------------------ |
|
806 | another line HG: ------------------------ >8 ------------------------ | |
807 |
|
807 | |||
808 | also test that this special string isn't accepted when there is some extra text |
|
808 | also test that this special string isn't accepted when there is some extra text | |
809 | at the end |
|
809 | at the end | |
810 |
|
810 | |||
811 | $ cat >> .hg/hgrc <<EOF |
|
811 | $ cat >> .hg/hgrc <<EOF | |
812 | > [committemplate] |
|
812 | > [committemplate] | |
813 | > changeset.commit = first LINE3 |
|
813 | > changeset.commit = first LINE3 | |
814 | > HG: ------------------------ >8 ------------------------foobar |
|
814 | > HG: ------------------------ >8 ------------------------foobar | |
815 | > second line |
|
815 | > second line | |
816 | > HG: this is customized commit template |
|
816 | > HG: this is customized commit template | |
817 | > HG: {extramsg} |
|
817 | > HG: {extramsg} | |
818 | > HG: ------------------------ >8 ------------------------ |
|
818 | > HG: ------------------------ >8 ------------------------ | |
819 | > {diff()} |
|
819 | > {diff()} | |
820 | > EOF |
|
820 | > EOF | |
821 | $ echo foo >> foo |
|
821 | $ echo foo >> foo | |
822 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci |
|
822 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
823 | first line3 |
|
823 | first line3 | |
824 | HG: ------------------------ >8 ------------------------foobar |
|
824 | HG: ------------------------ >8 ------------------------foobar | |
825 | second line |
|
825 | second line | |
826 | HG: this is customized commit template |
|
826 | HG: this is customized commit template | |
827 | HG: Leave message empty to abort commit. |
|
827 | HG: Leave message empty to abort commit. | |
828 | HG: ------------------------ >8 ------------------------ |
|
828 | HG: ------------------------ >8 ------------------------ | |
829 | diff -r ce648f5f066f foo |
|
829 | diff -r ce648f5f066f foo | |
830 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 |
|
830 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 | |
831 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
831 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
832 | @@ -1,2 +1,3 @@ |
|
832 | @@ -1,2 +1,3 @@ | |
833 | foo |
|
833 | foo | |
834 | foo |
|
834 | foo | |
835 | +foo |
|
835 | +foo | |
836 | $ hg log -T '{desc}\n' -r . |
|
836 | $ hg log -T '{desc}\n' -r . | |
837 | first line3 |
|
837 | first line3 | |
838 | second line |
|
838 | second line | |
839 |
|
839 | |||
840 | $ cd .. |
|
840 | $ cd .. | |
841 |
|
841 | |||
842 | testing commands.commit.post-status config option |
|
842 | testing commands.commit.post-status config option | |
843 |
|
843 | |||
844 | $ hg init ci-post-st |
|
844 | $ hg init ci-post-st | |
845 | $ cd ci-post-st |
|
845 | $ cd ci-post-st | |
846 | $ echo '[commands]' > .hg/hgrc |
|
846 | $ echo '[commands]' > .hg/hgrc | |
847 | $ echo 'commit.post-status = 1' >> .hg/hgrc |
|
847 | $ echo 'commit.post-status = 1' >> .hg/hgrc | |
848 |
|
848 | |||
849 | $ echo 'ignored-file' > .hgignore |
|
849 | $ echo 'ignored-file' > .hgignore | |
850 | $ hg ci -qAm 0 |
|
850 | $ hg ci -qAm 0 | |
851 |
|
851 | |||
852 | $ echo 'c' > clean-file |
|
852 | $ echo 'c' > clean-file | |
853 | $ echo 'a' > added-file |
|
853 | $ echo 'a' > added-file | |
854 | $ echo '?' > unknown-file |
|
854 | $ echo '?' > unknown-file | |
855 | $ echo 'i' > ignored-file |
|
855 | $ echo 'i' > ignored-file | |
856 | $ hg add clean-file added-file |
|
856 | $ hg add clean-file added-file | |
857 | $ hg ci -m 1 clean-file |
|
857 | $ hg ci -m 1 clean-file | |
858 | A added-file |
|
858 | A added-file | |
859 | ? unknown-file |
|
859 | ? unknown-file | |
860 | $ hg st -mardu |
|
860 | $ hg st -mardu | |
861 | A added-file |
|
861 | A added-file | |
862 | ? unknown-file |
|
862 | ? unknown-file | |
863 |
|
863 | |||
864 | $ touch modified-file |
|
864 | $ touch modified-file | |
865 | $ hg add modified-file |
|
865 | $ hg add modified-file | |
866 | $ hg ci -m 2 modified-file -q |
|
866 | $ hg ci -m 2 modified-file -q | |
867 |
|
867 | |||
868 | $ echo 'm' > modified-file |
|
868 | $ echo 'm' > modified-file | |
869 | $ hg ci --amend -m 'reworded' -X 're:' |
|
869 | $ hg ci --amend -m 'reworded' -X 're:' | |
870 | saved backup bundle to $TESTTMP/ci-post-st/.hg/strip-backup/*-amend.hg (glob) |
|
870 | saved backup bundle to $TESTTMP/ci-post-st/.hg/strip-backup/*-amend.hg (glob) | |
871 | M modified-file |
|
871 | M modified-file | |
872 | A added-file |
|
872 | A added-file | |
873 | ? unknown-file |
|
873 | ? unknown-file | |
874 | $ hg st -mardu |
|
874 | $ hg st -mardu | |
875 | M modified-file |
|
875 | M modified-file | |
876 | A added-file |
|
876 | A added-file | |
877 | ? unknown-file |
|
877 | ? unknown-file | |
878 |
|
878 | |||
879 | $ cd .. |
|
879 | $ cd .. |
@@ -1,2093 +1,2093 b'' | |||||
1 | $ hg init a |
|
1 | $ hg init a | |
2 | $ mkdir a/d1 |
|
2 | $ mkdir a/d1 | |
3 | $ mkdir a/d1/d2 |
|
3 | $ mkdir a/d1/d2 | |
4 | $ echo line 1 > a/a |
|
4 | $ echo line 1 > a/a | |
5 | $ echo line 1 > a/d1/d2/a |
|
5 | $ echo line 1 > a/d1/d2/a | |
6 | $ hg --cwd a ci -Ama |
|
6 | $ hg --cwd a ci -Ama | |
7 | adding a |
|
7 | adding a | |
8 | adding d1/d2/a |
|
8 | adding d1/d2/a | |
9 |
|
9 | |||
10 | $ echo line 2 >> a/a |
|
10 | $ echo line 2 >> a/a | |
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' | |
12 |
|
12 | |||
13 | import with no args: |
|
13 | import with no args: | |
14 |
|
14 | |||
15 | $ hg --cwd a import |
|
15 | $ hg --cwd a import | |
16 | abort: need at least one patch to import |
|
16 | abort: need at least one patch to import | |
17 | [10] |
|
17 | [10] | |
18 |
|
18 | |||
19 | generate patches for the test |
|
19 | generate patches for the test | |
20 |
|
20 | |||
21 | $ hg --cwd a export tip > exported-tip.patch |
|
21 | $ hg --cwd a export tip > exported-tip.patch | |
22 | $ hg --cwd a diff -r0:1 > diffed-tip.patch |
|
22 | $ hg --cwd a diff -r0:1 > diffed-tip.patch | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | import exported patch |
|
25 | import exported patch | |
26 | (this also tests that editor is not invoked, if the patch contains the |
|
26 | (this also tests that editor is not invoked, if the patch contains the | |
27 | commit message and '--edit' is not specified) |
|
27 | commit message and '--edit' is not specified) | |
28 |
|
28 | |||
29 | $ hg clone -r0 a b |
|
29 | $ hg clone -r0 a b | |
30 | adding changesets |
|
30 | adding changesets | |
31 | adding manifests |
|
31 | adding manifests | |
32 | adding file changes |
|
32 | adding file changes | |
33 | added 1 changesets with 2 changes to 2 files |
|
33 | added 1 changesets with 2 changes to 2 files | |
34 | new changesets 80971e65b431 |
|
34 | new changesets 80971e65b431 | |
35 | updating to branch default |
|
35 | updating to branch default | |
36 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
36 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
37 | $ HGEDITOR=cat hg --cwd b import --debug ../exported-tip.patch |
|
37 | $ HGEDITOR=cat hg --cwd b import --debug ../exported-tip.patch | |
38 | applying ../exported-tip.patch |
|
38 | applying ../exported-tip.patch | |
39 | Subject: |
|
39 | Subject: | |
40 |
|
40 | |||
41 | Content-Type: text/plain |
|
41 | Content-Type: text/plain | |
42 | found patch at byte 202 |
|
42 | found patch at byte 202 | |
43 | patch generated by hg export |
|
43 | patch generated by hg export | |
44 | From: someone |
|
44 | From: someone | |
45 | Date: 1 0 |
|
45 | Date: 1 0 | |
46 | Node ID: 1d4bd90af0e43687763d158dfa83ff2a4b6c0c32 |
|
46 | Node ID: 1d4bd90af0e43687763d158dfa83ff2a4b6c0c32 | |
47 | message: |
|
47 | message: | |
48 | second change |
|
48 | second change | |
49 | patching file a |
|
49 | patching file a | |
50 | committing files: |
|
50 | committing files: | |
51 | a |
|
51 | a | |
52 | committing manifest |
|
52 | committing manifest | |
53 | committing changelog |
|
53 | committing changelog | |
54 | created 1d4bd90af0e4 |
|
54 | created 1d4bd90af0e4 | |
55 | updating the branch cache |
|
55 | updating the branch cache | |
56 |
|
56 | |||
57 | message and committer and date should be same |
|
57 | message and committer and date should be same | |
58 |
|
58 | |||
59 | $ hg --cwd b tip |
|
59 | $ hg --cwd b tip | |
60 | changeset: 1:1d4bd90af0e4 |
|
60 | changeset: 1:1d4bd90af0e4 | |
61 | tag: tip |
|
61 | tag: tip | |
62 | user: someone |
|
62 | user: someone | |
63 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
63 | date: Thu Jan 01 00:00:01 1970 +0000 | |
64 | summary: second change |
|
64 | summary: second change | |
65 |
|
65 | |||
66 | $ rm -r b |
|
66 | $ rm -r b | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | import exported patch with external patcher |
|
69 | import exported patch with external patcher | |
70 | (this also tests that editor is invoked, if the '--edit' is specified, |
|
70 | (this also tests that editor is invoked, if the '--edit' is specified, | |
71 | regardless of the commit message in the patch) |
|
71 | regardless of the commit message in the patch) | |
72 |
|
72 | |||
73 | $ cat > dummypatch.py <<EOF |
|
73 | $ cat > dummypatch.py <<EOF | |
74 | > from __future__ import print_function |
|
74 | > from __future__ import print_function | |
75 | > print('patching file a') |
|
75 | > print('patching file a') | |
76 | > open('a', 'wb').write(b'line2\n') |
|
76 | > open('a', 'wb').write(b'line2\n') | |
77 | > EOF |
|
77 | > EOF | |
78 | $ hg clone -r0 a b |
|
78 | $ hg clone -r0 a b | |
79 | adding changesets |
|
79 | adding changesets | |
80 | adding manifests |
|
80 | adding manifests | |
81 | adding file changes |
|
81 | adding file changes | |
82 | added 1 changesets with 2 changes to 2 files |
|
82 | added 1 changesets with 2 changes to 2 files | |
83 | new changesets 80971e65b431 |
|
83 | new changesets 80971e65b431 | |
84 | updating to branch default |
|
84 | updating to branch default | |
85 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
85 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
86 | $ HGEDITOR=cat hg --config ui.patch="\"$PYTHON\" ../dummypatch.py" --cwd b import --edit ../exported-tip.patch |
|
86 | $ HGEDITOR=cat hg --config ui.patch="\"$PYTHON\" ../dummypatch.py" --cwd b import --edit ../exported-tip.patch | |
87 | applying ../exported-tip.patch |
|
87 | applying ../exported-tip.patch | |
88 | second change |
|
88 | second change | |
89 |
|
89 | |||
90 |
|
90 | |||
91 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
91 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
92 | HG: Leave message empty to abort commit. |
|
92 | HG: Leave message empty to abort commit. | |
93 | HG: -- |
|
93 | HG: -- | |
94 | HG: user: someone |
|
94 | HG: user: someone | |
95 | HG: branch 'default' |
|
95 | HG: branch 'default' | |
96 | HG: changed a |
|
96 | HG: changed a | |
97 | $ cat b/a |
|
97 | $ cat b/a | |
98 | line2 |
|
98 | line2 | |
99 | $ rm -r b |
|
99 | $ rm -r b | |
100 |
|
100 | |||
101 |
|
101 | |||
102 | import of plain diff should fail without message |
|
102 | import of plain diff should fail without message | |
103 | (this also tests that editor is invoked, if the patch doesn't contain |
|
103 | (this also tests that editor is invoked, if the patch doesn't contain | |
104 | the commit message, regardless of '--edit') |
|
104 | the commit message, regardless of '--edit') | |
105 |
|
105 | |||
106 | $ hg clone -r0 a b |
|
106 | $ hg clone -r0 a b | |
107 | adding changesets |
|
107 | adding changesets | |
108 | adding manifests |
|
108 | adding manifests | |
109 | adding file changes |
|
109 | adding file changes | |
110 | added 1 changesets with 2 changes to 2 files |
|
110 | added 1 changesets with 2 changes to 2 files | |
111 | new changesets 80971e65b431 |
|
111 | new changesets 80971e65b431 | |
112 | updating to branch default |
|
112 | updating to branch default | |
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 | $ cat > $TESTTMP/editor.sh <<EOF |
|
114 | $ cat > $TESTTMP/editor.sh <<EOF | |
115 | > env | grep HGEDITFORM |
|
115 | > env | grep HGEDITFORM | |
116 | > cat \$1 |
|
116 | > cat \$1 | |
117 | > EOF |
|
117 | > EOF | |
118 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch |
|
118 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch | |
119 | applying ../diffed-tip.patch |
|
119 | applying ../diffed-tip.patch | |
120 | HGEDITFORM=import.normal.normal |
|
120 | HGEDITFORM=import.normal.normal | |
121 |
|
121 | |||
122 |
|
122 | |||
123 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
123 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
124 | HG: Leave message empty to abort commit. |
|
124 | HG: Leave message empty to abort commit. | |
125 | HG: -- |
|
125 | HG: -- | |
126 | HG: user: test |
|
126 | HG: user: test | |
127 | HG: branch 'default' |
|
127 | HG: branch 'default' | |
128 | HG: changed a |
|
128 | HG: changed a | |
129 | abort: empty commit message |
|
129 | abort: empty commit message | |
130 | [10] |
|
130 | [10] | |
131 |
|
131 | |||
132 | Test avoiding editor invocation at applying the patch with --exact, |
|
132 | Test avoiding editor invocation at applying the patch with --exact, | |
133 | even if commit message is empty |
|
133 | even if commit message is empty | |
134 |
|
134 | |||
135 | $ echo a >> b/a |
|
135 | $ echo a >> b/a | |
136 | $ hg --cwd b commit -m ' ' |
|
136 | $ hg --cwd b commit -m ' ' | |
137 | $ hg --cwd b tip -T "{node}\n" |
|
137 | $ hg --cwd b tip -T "{node}\n" | |
138 | d8804f3f5396d800812f579c8452796a5993bdb2 |
|
138 | d8804f3f5396d800812f579c8452796a5993bdb2 | |
139 | $ hg --cwd b export -o ../empty-log.diff . |
|
139 | $ hg --cwd b export -o ../empty-log.diff . | |
140 | $ hg --cwd b update -q -C ".^1" |
|
140 | $ hg --cwd b update -q -C ".^1" | |
141 | $ hg --cwd b --config extensions.strip= strip -q tip |
|
141 | $ hg --cwd b --config extensions.strip= strip -q tip | |
142 | $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff |
|
142 | $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff | |
143 | applying ../empty-log.diff |
|
143 | applying ../empty-log.diff | |
144 | $ hg --cwd b tip -T "{node}\n" |
|
144 | $ hg --cwd b tip -T "{node}\n" | |
145 | d8804f3f5396d800812f579c8452796a5993bdb2 |
|
145 | d8804f3f5396d800812f579c8452796a5993bdb2 | |
146 |
|
146 | |||
147 | $ rm -r b |
|
147 | $ rm -r b | |
148 |
|
148 | |||
149 |
|
149 | |||
150 | import of plain diff should be ok with message |
|
150 | import of plain diff should be ok with message | |
151 |
|
151 | |||
152 | $ hg clone -r0 a b |
|
152 | $ hg clone -r0 a b | |
153 | adding changesets |
|
153 | adding changesets | |
154 | adding manifests |
|
154 | adding manifests | |
155 | adding file changes |
|
155 | adding file changes | |
156 | added 1 changesets with 2 changes to 2 files |
|
156 | added 1 changesets with 2 changes to 2 files | |
157 | new changesets 80971e65b431 |
|
157 | new changesets 80971e65b431 | |
158 | updating to branch default |
|
158 | updating to branch default | |
159 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
159 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
160 | $ hg --cwd b import -mpatch ../diffed-tip.patch |
|
160 | $ hg --cwd b import -mpatch ../diffed-tip.patch | |
161 | applying ../diffed-tip.patch |
|
161 | applying ../diffed-tip.patch | |
162 | $ rm -r b |
|
162 | $ rm -r b | |
163 |
|
163 | |||
164 |
|
164 | |||
165 | import of plain diff with specific date and user |
|
165 | import of plain diff with specific date and user | |
166 | (this also tests that editor is not invoked, if |
|
166 | (this also tests that editor is not invoked, if | |
167 | '--message'/'--logfile' is specified and '--edit' is not) |
|
167 | '--message'/'--logfile' is specified and '--edit' is not) | |
168 |
|
168 | |||
169 | $ hg clone -r0 a b |
|
169 | $ hg clone -r0 a b | |
170 | adding changesets |
|
170 | adding changesets | |
171 | adding manifests |
|
171 | adding manifests | |
172 | adding file changes |
|
172 | adding file changes | |
173 | added 1 changesets with 2 changes to 2 files |
|
173 | added 1 changesets with 2 changes to 2 files | |
174 | new changesets 80971e65b431 |
|
174 | new changesets 80971e65b431 | |
175 | updating to branch default |
|
175 | updating to branch default | |
176 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
176 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
177 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch |
|
177 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch | |
178 | applying ../diffed-tip.patch |
|
178 | applying ../diffed-tip.patch | |
179 | $ hg -R b tip -pv |
|
179 | $ hg -R b tip -pv | |
180 | changeset: 1:ca68f19f3a40 |
|
180 | changeset: 1:ca68f19f3a40 | |
181 | tag: tip |
|
181 | tag: tip | |
182 | user: user@nowhere.net |
|
182 | user: user@nowhere.net | |
183 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
183 | date: Thu Jan 01 00:00:01 1970 +0000 | |
184 | files: a |
|
184 | files: a | |
185 | description: |
|
185 | description: | |
186 | patch |
|
186 | patch | |
187 |
|
187 | |||
188 |
|
188 | |||
189 | diff -r 80971e65b431 -r ca68f19f3a40 a |
|
189 | diff -r 80971e65b431 -r ca68f19f3a40 a | |
190 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
190 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
191 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
191 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
192 | @@ -1,1 +1,2 @@ |
|
192 | @@ -1,1 +1,2 @@ | |
193 | line 1 |
|
193 | line 1 | |
194 | +line 2 |
|
194 | +line 2 | |
195 |
|
195 | |||
196 | $ rm -r b |
|
196 | $ rm -r b | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | import of plain diff should be ok with --no-commit |
|
199 | import of plain diff should be ok with --no-commit | |
200 | (this also tests that editor is not invoked, if '--no-commit' is |
|
200 | (this also tests that editor is not invoked, if '--no-commit' is | |
201 | specified, regardless of '--edit') |
|
201 | specified, regardless of '--edit') | |
202 |
|
202 | |||
203 | $ hg clone -r0 a b |
|
203 | $ hg clone -r0 a b | |
204 | adding changesets |
|
204 | adding changesets | |
205 | adding manifests |
|
205 | adding manifests | |
206 | adding file changes |
|
206 | adding file changes | |
207 | added 1 changesets with 2 changes to 2 files |
|
207 | added 1 changesets with 2 changes to 2 files | |
208 | new changesets 80971e65b431 |
|
208 | new changesets 80971e65b431 | |
209 | updating to branch default |
|
209 | updating to branch default | |
210 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
210 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
211 | $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch |
|
211 | $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch | |
212 | applying ../diffed-tip.patch |
|
212 | applying ../diffed-tip.patch | |
213 | $ hg --cwd b diff --nodates |
|
213 | $ hg --cwd b diff --nodates | |
214 | diff -r 80971e65b431 a |
|
214 | diff -r 80971e65b431 a | |
215 | --- a/a |
|
215 | --- a/a | |
216 | +++ b/a |
|
216 | +++ b/a | |
217 | @@ -1,1 +1,2 @@ |
|
217 | @@ -1,1 +1,2 @@ | |
218 | line 1 |
|
218 | line 1 | |
219 | +line 2 |
|
219 | +line 2 | |
220 | $ rm -r b |
|
220 | $ rm -r b | |
221 |
|
221 | |||
222 |
|
222 | |||
223 | import of malformed plain diff should fail |
|
223 | import of malformed plain diff should fail | |
224 |
|
224 | |||
225 | $ hg clone -r0 a b |
|
225 | $ hg clone -r0 a b | |
226 | adding changesets |
|
226 | adding changesets | |
227 | adding manifests |
|
227 | adding manifests | |
228 | adding file changes |
|
228 | adding file changes | |
229 | added 1 changesets with 2 changes to 2 files |
|
229 | added 1 changesets with 2 changes to 2 files | |
230 | new changesets 80971e65b431 |
|
230 | new changesets 80971e65b431 | |
231 | updating to branch default |
|
231 | updating to branch default | |
232 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
233 | $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch |
|
233 | $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch | |
234 | $ hg --cwd b import -mpatch ../broken.patch |
|
234 | $ hg --cwd b import -mpatch ../broken.patch | |
235 | applying ../broken.patch |
|
235 | applying ../broken.patch | |
236 | abort: bad hunk #1 |
|
236 | abort: bad hunk #1 | |
237 | (check that whitespace in the patch has not been mangled) |
|
237 | (check that whitespace in the patch has not been mangled) | |
238 | [10] |
|
238 | [10] | |
239 | $ rm -r b |
|
239 | $ rm -r b | |
240 |
|
240 | |||
241 | hg -R repo import |
|
241 | hg -R repo import | |
242 | put the clone in a subdir - having a directory named "a" |
|
242 | put the clone in a subdir - having a directory named "a" | |
243 | used to hide a bug. |
|
243 | used to hide a bug. | |
244 |
|
244 | |||
245 | $ mkdir dir |
|
245 | $ mkdir dir | |
246 | $ hg clone -r0 a dir/b |
|
246 | $ hg clone -r0 a dir/b | |
247 | adding changesets |
|
247 | adding changesets | |
248 | adding manifests |
|
248 | adding manifests | |
249 | adding file changes |
|
249 | adding file changes | |
250 | added 1 changesets with 2 changes to 2 files |
|
250 | added 1 changesets with 2 changes to 2 files | |
251 | new changesets 80971e65b431 |
|
251 | new changesets 80971e65b431 | |
252 | updating to branch default |
|
252 | updating to branch default | |
253 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
253 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
254 | $ cd dir |
|
254 | $ cd dir | |
255 | $ hg -R b import ../exported-tip.patch |
|
255 | $ hg -R b import ../exported-tip.patch | |
256 | applying ../exported-tip.patch |
|
256 | applying ../exported-tip.patch | |
257 | $ cd .. |
|
257 | $ cd .. | |
258 | $ rm -r dir |
|
258 | $ rm -r dir | |
259 |
|
259 | |||
260 |
|
260 | |||
261 | import from stdin |
|
261 | import from stdin | |
262 |
|
262 | |||
263 | $ hg clone -r0 a b |
|
263 | $ hg clone -r0 a b | |
264 | adding changesets |
|
264 | adding changesets | |
265 | adding manifests |
|
265 | adding manifests | |
266 | adding file changes |
|
266 | adding file changes | |
267 | added 1 changesets with 2 changes to 2 files |
|
267 | added 1 changesets with 2 changes to 2 files | |
268 | new changesets 80971e65b431 |
|
268 | new changesets 80971e65b431 | |
269 | updating to branch default |
|
269 | updating to branch default | |
270 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
270 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
271 | $ hg --cwd b import - < exported-tip.patch |
|
271 | $ hg --cwd b import - < exported-tip.patch | |
272 | applying patch from stdin |
|
272 | applying patch from stdin | |
273 | $ rm -r b |
|
273 | $ rm -r b | |
274 |
|
274 | |||
275 |
|
275 | |||
276 | import two patches in one stream |
|
276 | import two patches in one stream | |
277 |
|
277 | |||
278 | $ hg init b |
|
278 | $ hg init b | |
279 | $ hg --cwd a export 0:tip | hg --cwd b import - |
|
279 | $ hg --cwd a export 0:tip | hg --cwd b import - | |
280 | applying patch from stdin |
|
280 | applying patch from stdin | |
281 | $ hg --cwd a id |
|
281 | $ hg --cwd a id | |
282 | 1d4bd90af0e4 tip |
|
282 | 1d4bd90af0e4 tip | |
283 | $ hg --cwd b id |
|
283 | $ hg --cwd b id | |
284 | 1d4bd90af0e4 tip |
|
284 | 1d4bd90af0e4 tip | |
285 | $ rm -r b |
|
285 | $ rm -r b | |
286 |
|
286 | |||
287 |
|
287 | |||
288 | override commit message |
|
288 | override commit message | |
289 |
|
289 | |||
290 | $ hg clone -r0 a b |
|
290 | $ hg clone -r0 a b | |
291 | adding changesets |
|
291 | adding changesets | |
292 | adding manifests |
|
292 | adding manifests | |
293 | adding file changes |
|
293 | adding file changes | |
294 | added 1 changesets with 2 changes to 2 files |
|
294 | added 1 changesets with 2 changes to 2 files | |
295 | new changesets 80971e65b431 |
|
295 | new changesets 80971e65b431 | |
296 | updating to branch default |
|
296 | updating to branch default | |
297 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
297 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
298 | $ hg --cwd b import -m 'override' - < exported-tip.patch |
|
298 | $ hg --cwd b import -m 'override' - < exported-tip.patch | |
299 | applying patch from stdin |
|
299 | applying patch from stdin | |
300 | $ hg --cwd b tip | grep override |
|
300 | $ hg --cwd b tip | grep override | |
301 | summary: override |
|
301 | summary: override | |
302 | $ rm -r b |
|
302 | $ rm -r b | |
303 |
|
303 | |||
304 | $ cat > mkmsg.py <<EOF |
|
304 | $ cat > mkmsg.py <<EOF | |
305 | > import email.message |
|
305 | > import email.message | |
306 | > import sys |
|
306 | > import sys | |
307 | > msg = email.message.Message() |
|
307 | > msg = email.message.Message() | |
308 | > patch = open(sys.argv[1], 'rb').read() |
|
308 | > patch = open(sys.argv[1], 'rb').read() | |
309 | > msg.set_payload(b'email commit message\n' + patch) |
|
309 | > msg.set_payload(b'email commit message\n' + patch) | |
310 | > msg['Subject'] = 'email patch' |
|
310 | > msg['Subject'] = 'email patch' | |
311 | > msg['From'] = 'email patcher' |
|
311 | > msg['From'] = 'email patcher' | |
312 | > open(sys.argv[2], 'wb').write(bytes(msg)) |
|
312 | > open(sys.argv[2], 'wb').write(bytes(msg)) | |
313 | > EOF |
|
313 | > EOF | |
314 |
|
314 | |||
315 |
|
315 | |||
316 | plain diff in email, subject, message body |
|
316 | plain diff in email, subject, message body | |
317 |
|
317 | |||
318 | $ hg clone -r0 a b |
|
318 | $ hg clone -r0 a b | |
319 | adding changesets |
|
319 | adding changesets | |
320 | adding manifests |
|
320 | adding manifests | |
321 | adding file changes |
|
321 | adding file changes | |
322 | added 1 changesets with 2 changes to 2 files |
|
322 | added 1 changesets with 2 changes to 2 files | |
323 | new changesets 80971e65b431 |
|
323 | new changesets 80971e65b431 | |
324 | updating to branch default |
|
324 | updating to branch default | |
325 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
325 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
326 | $ "$PYTHON" mkmsg.py diffed-tip.patch msg.patch |
|
326 | $ "$PYTHON" mkmsg.py diffed-tip.patch msg.patch | |
327 | $ hg --cwd b import ../msg.patch |
|
327 | $ hg --cwd b import ../msg.patch | |
328 | applying ../msg.patch |
|
328 | applying ../msg.patch | |
329 | $ hg --cwd b tip | grep email |
|
329 | $ hg --cwd b tip | grep email | |
330 | user: email patcher |
|
330 | user: email patcher | |
331 | summary: email patch |
|
331 | summary: email patch | |
332 | $ rm -r b |
|
332 | $ rm -r b | |
333 |
|
333 | |||
334 |
|
334 | |||
335 | plain diff in email, no subject, message body |
|
335 | plain diff in email, no subject, message body | |
336 |
|
336 | |||
337 | $ hg clone -r0 a b |
|
337 | $ hg clone -r0 a b | |
338 | adding changesets |
|
338 | adding changesets | |
339 | adding manifests |
|
339 | adding manifests | |
340 | adding file changes |
|
340 | adding file changes | |
341 | added 1 changesets with 2 changes to 2 files |
|
341 | added 1 changesets with 2 changes to 2 files | |
342 | new changesets 80971e65b431 |
|
342 | new changesets 80971e65b431 | |
343 | updating to branch default |
|
343 | updating to branch default | |
344 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
344 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
345 | $ grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
345 | $ grep -v '^Subject:' msg.patch | hg --cwd b import - | |
346 | applying patch from stdin |
|
346 | applying patch from stdin | |
347 | $ rm -r b |
|
347 | $ rm -r b | |
348 |
|
348 | |||
349 |
|
349 | |||
350 | plain diff in email, subject, no message body |
|
350 | plain diff in email, subject, no message body | |
351 |
|
351 | |||
352 | $ hg clone -r0 a b |
|
352 | $ hg clone -r0 a b | |
353 | adding changesets |
|
353 | adding changesets | |
354 | adding manifests |
|
354 | adding manifests | |
355 | adding file changes |
|
355 | adding file changes | |
356 | added 1 changesets with 2 changes to 2 files |
|
356 | added 1 changesets with 2 changes to 2 files | |
357 | new changesets 80971e65b431 |
|
357 | new changesets 80971e65b431 | |
358 | updating to branch default |
|
358 | updating to branch default | |
359 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
359 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
360 | $ grep -v '^email ' msg.patch | hg --cwd b import - |
|
360 | $ grep -v '^email ' msg.patch | hg --cwd b import - | |
361 | applying patch from stdin |
|
361 | applying patch from stdin | |
362 | $ rm -r b |
|
362 | $ rm -r b | |
363 |
|
363 | |||
364 |
|
364 | |||
365 | plain diff in email, no subject, no message body, should fail |
|
365 | plain diff in email, no subject, no message body, should fail | |
366 |
|
366 | |||
367 | $ hg clone -r0 a b |
|
367 | $ hg clone -r0 a b | |
368 | adding changesets |
|
368 | adding changesets | |
369 | adding manifests |
|
369 | adding manifests | |
370 | adding file changes |
|
370 | adding file changes | |
371 | added 1 changesets with 2 changes to 2 files |
|
371 | added 1 changesets with 2 changes to 2 files | |
372 | new changesets 80971e65b431 |
|
372 | new changesets 80971e65b431 | |
373 | updating to branch default |
|
373 | updating to branch default | |
374 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
374 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
375 | $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - |
|
375 | $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - | |
376 | applying patch from stdin |
|
376 | applying patch from stdin | |
377 | abort: empty commit message |
|
377 | abort: empty commit message | |
378 | [10] |
|
378 | [10] | |
379 | $ rm -r b |
|
379 | $ rm -r b | |
380 |
|
380 | |||
381 |
|
381 | |||
382 | hg export in email, should use patch header |
|
382 | hg export in email, should use patch header | |
383 |
|
383 | |||
384 | $ hg clone -r0 a b |
|
384 | $ hg clone -r0 a b | |
385 | adding changesets |
|
385 | adding changesets | |
386 | adding manifests |
|
386 | adding manifests | |
387 | adding file changes |
|
387 | adding file changes | |
388 | added 1 changesets with 2 changes to 2 files |
|
388 | added 1 changesets with 2 changes to 2 files | |
389 | new changesets 80971e65b431 |
|
389 | new changesets 80971e65b431 | |
390 | updating to branch default |
|
390 | updating to branch default | |
391 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
391 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
392 | $ "$PYTHON" mkmsg.py exported-tip.patch msg.patch |
|
392 | $ "$PYTHON" mkmsg.py exported-tip.patch msg.patch | |
393 | $ cat msg.patch | hg --cwd b import - |
|
393 | $ cat msg.patch | hg --cwd b import - | |
394 | applying patch from stdin |
|
394 | applying patch from stdin | |
395 | $ hg --cwd b tip | grep second |
|
395 | $ hg --cwd b tip | grep second | |
396 | summary: second change |
|
396 | summary: second change | |
397 | $ rm -r b |
|
397 | $ rm -r b | |
398 |
|
398 | |||
399 | hg email --plain, should read X-Mercurial-Node header |
|
399 | hg email --plain, should read X-Mercurial-Node header | |
400 |
|
400 | |||
401 | $ cat >> a/.hg/hgrc << EOF |
|
401 | $ cat >> a/.hg/hgrc << EOF | |
402 | > [extensions] |
|
402 | > [extensions] | |
403 | > patchbomb = |
|
403 | > patchbomb = | |
404 | > [email] |
|
404 | > [email] | |
405 | > from = foo |
|
405 | > from = foo | |
406 | > cc = foo |
|
406 | > cc = foo | |
407 | > to = bar |
|
407 | > to = bar | |
408 | > EOF |
|
408 | > EOF | |
409 | $ hg --cwd a email -m ../tip-plain.mbox --plain --date '1970-1-1 0:1' tip |
|
409 | $ hg --cwd a email -m ../tip-plain.mbox --plain --date '1970-1-1 0:1' tip | |
410 | this patch series consists of 1 patches. |
|
410 | this patch series consists of 1 patches. | |
411 |
|
411 | |||
412 |
|
412 | |||
413 | sending [PATCH] second change ... |
|
413 | sending [PATCH] second change ... | |
414 |
|
414 | |||
415 | $ hg clone -r0 a b -q |
|
415 | $ hg clone -r0 a b -q | |
416 | $ hg --cwd b import --debug ../tip-plain.mbox |
|
416 | $ hg --cwd b import --debug ../tip-plain.mbox | |
417 | applying ../tip-plain.mbox |
|
417 | applying ../tip-plain.mbox | |
418 | Node ID: 1d4bd90af0e43687763d158dfa83ff2a4b6c0c32 |
|
418 | Node ID: 1d4bd90af0e43687763d158dfa83ff2a4b6c0c32 | |
419 | Subject: second change |
|
419 | Subject: second change | |
420 | From: foo |
|
420 | From: foo | |
421 | Content-Type: text/plain |
|
421 | Content-Type: text/plain | |
422 | found patch at byte 0 |
|
422 | found patch at byte 0 | |
423 | message: |
|
423 | message: | |
424 | second change |
|
424 | second change | |
425 | patching file a |
|
425 | patching file a | |
426 | committing files: |
|
426 | committing files: | |
427 | a |
|
427 | a | |
428 | committing manifest |
|
428 | committing manifest | |
429 | committing changelog |
|
429 | committing changelog | |
430 | created de620f6fe949 |
|
430 | created de620f6fe949 | |
431 | updating the branch cache |
|
431 | updating the branch cache | |
432 | $ hg --cwd b tip |
|
432 | $ hg --cwd b tip | |
433 | changeset: 1:de620f6fe949 |
|
433 | changeset: 1:de620f6fe949 | |
434 | tag: tip |
|
434 | tag: tip | |
435 | user: foo |
|
435 | user: foo | |
436 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
436 | date: Thu Jan 01 00:00:00 1970 +0000 | |
437 | summary: second change |
|
437 | summary: second change | |
438 |
|
438 | |||
439 | $ hg --cwd b phase tip |
|
439 | $ hg --cwd b phase tip | |
440 | 1: draft |
|
440 | 1: draft | |
441 | $ rm -r b |
|
441 | $ rm -r b | |
442 |
|
442 | |||
443 |
|
443 | |||
444 | hg import --secret |
|
444 | hg import --secret | |
445 |
|
445 | |||
446 | $ hg clone -r0 a b -q |
|
446 | $ hg clone -r0 a b -q | |
447 | $ hg --cwd b import --no-commit --secret ../exported-tip.patch |
|
447 | $ hg --cwd b import --no-commit --secret ../exported-tip.patch | |
448 | abort: cannot specify both --no-commit and --secret |
|
448 | abort: cannot specify both --no-commit and --secret | |
449 | [10] |
|
449 | [10] | |
450 | $ hg --cwd b import --secret ../exported-tip.patch |
|
450 | $ hg --cwd b import --secret ../exported-tip.patch | |
451 | applying ../exported-tip.patch |
|
451 | applying ../exported-tip.patch | |
452 | $ hg --cwd b diff -c . --nodates |
|
452 | $ hg --cwd b diff -c . --nodates | |
453 | diff -r 80971e65b431 -r 1d4bd90af0e4 a |
|
453 | diff -r 80971e65b431 -r 1d4bd90af0e4 a | |
454 | --- a/a |
|
454 | --- a/a | |
455 | +++ b/a |
|
455 | +++ b/a | |
456 | @@ -1,1 +1,2 @@ |
|
456 | @@ -1,1 +1,2 @@ | |
457 | line 1 |
|
457 | line 1 | |
458 | +line 2 |
|
458 | +line 2 | |
459 | $ hg --cwd b phase |
|
459 | $ hg --cwd b phase | |
460 | 1: secret |
|
460 | 1: secret | |
461 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet |
|
461 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet | |
462 | $ HGEDITOR=cat hg --cwd b import --secret --edit ../exported-tip.patch |
|
462 | $ HGEDITOR=cat hg --cwd b import --secret --edit ../exported-tip.patch | |
463 | applying ../exported-tip.patch |
|
463 | applying ../exported-tip.patch | |
464 | second change |
|
464 | second change | |
465 |
|
465 | |||
466 |
|
466 | |||
467 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
467 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
468 | HG: Leave message empty to abort commit. |
|
468 | HG: Leave message empty to abort commit. | |
469 | HG: -- |
|
469 | HG: -- | |
470 | HG: user: someone |
|
470 | HG: user: someone | |
471 | HG: branch 'default' |
|
471 | HG: branch 'default' | |
472 | HG: changed a |
|
472 | HG: changed a | |
473 | $ hg --cwd b diff -c . --nodates |
|
473 | $ hg --cwd b diff -c . --nodates | |
474 | diff -r 80971e65b431 -r 1d4bd90af0e4 a |
|
474 | diff -r 80971e65b431 -r 1d4bd90af0e4 a | |
475 | --- a/a |
|
475 | --- a/a | |
476 | +++ b/a |
|
476 | +++ b/a | |
477 | @@ -1,1 +1,2 @@ |
|
477 | @@ -1,1 +1,2 @@ | |
478 | line 1 |
|
478 | line 1 | |
479 | +line 2 |
|
479 | +line 2 | |
480 | $ hg --cwd b phase |
|
480 | $ hg --cwd b phase | |
481 | 1: secret |
|
481 | 1: secret | |
482 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet |
|
482 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet | |
483 | $ hg --cwd b import --bypass --secret ../exported-tip.patch |
|
483 | $ hg --cwd b import --bypass --secret ../exported-tip.patch | |
484 | applying ../exported-tip.patch |
|
484 | applying ../exported-tip.patch | |
485 | $ hg --cwd b phase -r tip |
|
485 | $ hg --cwd b phase -r tip | |
486 | 1: secret |
|
486 | 1: secret | |
487 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet |
|
487 | $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet | |
488 | $ rm -r b |
|
488 | $ rm -r b | |
489 |
|
489 | |||
490 |
|
490 | |||
491 | subject: duplicate detection, removal of [PATCH] |
|
491 | subject: duplicate detection, removal of [PATCH] | |
492 | The '---' tests the gitsendmail handling without proper mail headers |
|
492 | The '---' tests the gitsendmail handling without proper mail headers | |
493 |
|
493 | |||
494 | $ cat > mkmsg2.py <<EOF |
|
494 | $ cat > mkmsg2.py <<EOF | |
495 | > import email.message |
|
495 | > import email.message | |
496 | > import sys |
|
496 | > import sys | |
497 | > msg = email.message.Message() |
|
497 | > msg = email.message.Message() | |
498 | > patch = open(sys.argv[1], 'rb').read() |
|
498 | > patch = open(sys.argv[1], 'rb').read() | |
499 | > msg.set_payload(b'email patch\n\nnext line\n---\n' + patch) |
|
499 | > msg.set_payload(b'email patch\n\nnext line\n---\n' + patch) | |
500 | > msg['Subject'] = '[PATCH] email patch' |
|
500 | > msg['Subject'] = '[PATCH] email patch' | |
501 | > msg['From'] = 'email patcher' |
|
501 | > msg['From'] = 'email patcher' | |
502 | > open(sys.argv[2], 'wb').write(bytes(msg)) |
|
502 | > open(sys.argv[2], 'wb').write(bytes(msg)) | |
503 | > EOF |
|
503 | > EOF | |
504 |
|
504 | |||
505 |
|
505 | |||
506 | plain diff in email, [PATCH] subject, message body with subject |
|
506 | plain diff in email, [PATCH] subject, message body with subject | |
507 |
|
507 | |||
508 | $ hg clone -r0 a b |
|
508 | $ hg clone -r0 a b | |
509 | adding changesets |
|
509 | adding changesets | |
510 | adding manifests |
|
510 | adding manifests | |
511 | adding file changes |
|
511 | adding file changes | |
512 | added 1 changesets with 2 changes to 2 files |
|
512 | added 1 changesets with 2 changes to 2 files | |
513 | new changesets 80971e65b431 |
|
513 | new changesets 80971e65b431 | |
514 | updating to branch default |
|
514 | updating to branch default | |
515 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
515 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
516 | $ "$PYTHON" mkmsg2.py diffed-tip.patch msg.patch |
|
516 | $ "$PYTHON" mkmsg2.py diffed-tip.patch msg.patch | |
517 | $ cat msg.patch | hg --cwd b import - |
|
517 | $ cat msg.patch | hg --cwd b import - | |
518 | applying patch from stdin |
|
518 | applying patch from stdin | |
519 | $ hg --cwd b tip --template '{desc}\n' |
|
519 | $ hg --cwd b tip --template '{desc}\n' | |
520 | email patch |
|
520 | email patch | |
521 |
|
521 | |||
522 | next line |
|
522 | next line | |
523 | $ rm -r b |
|
523 | $ rm -r b | |
524 |
|
524 | |||
525 |
|
525 | |||
526 | Issue963: Parent of working dir incorrect after import of multiple |
|
526 | Issue963: Parent of working dir incorrect after import of multiple | |
527 | patches and rollback |
|
527 | patches and rollback | |
528 |
|
528 | |||
529 | We weren't backing up the correct dirstate file when importing many |
|
529 | We weren't backing up the correct dirstate file when importing many | |
530 | patches: import patch1 patch2; rollback |
|
530 | patches: import patch1 patch2; rollback | |
531 |
|
531 | |||
532 | $ echo line 3 >> a/a |
|
532 | $ echo line 3 >> a/a | |
533 | $ hg --cwd a ci -m'third change' |
|
533 | $ hg --cwd a ci -m'third change' | |
534 | $ hg --cwd a export -o '../patch%R' 1 2 |
|
534 | $ hg --cwd a export -o '../patch%R' 1 2 | |
535 | $ hg clone -qr0 a b |
|
535 | $ hg clone -qr0 a b | |
536 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
536 | $ hg --cwd b parents --template 'parent: {rev}\n' | |
537 | parent: 0 |
|
537 | parent: 0 | |
538 | $ hg --cwd b import -v ../patch1 ../patch2 |
|
538 | $ hg --cwd b import -v ../patch1 ../patch2 | |
539 | applying ../patch1 |
|
539 | applying ../patch1 | |
540 | patching file a |
|
540 | patching file a | |
541 | committing files: |
|
541 | committing files: | |
542 | a |
|
542 | a | |
543 | committing manifest |
|
543 | committing manifest | |
544 | committing changelog |
|
544 | committing changelog | |
545 | created 1d4bd90af0e4 |
|
545 | created 1d4bd90af0e4 | |
546 | applying ../patch2 |
|
546 | applying ../patch2 | |
547 | patching file a |
|
547 | patching file a | |
548 | committing files: |
|
548 | committing files: | |
549 | a |
|
549 | a | |
550 | committing manifest |
|
550 | committing manifest | |
551 | committing changelog |
|
551 | committing changelog | |
552 | created 6d019af21222 |
|
552 | created 6d019af21222 | |
553 | $ hg --cwd b rollback |
|
553 | $ hg --cwd b rollback | |
554 | repository tip rolled back to revision 0 (undo import) |
|
554 | repository tip rolled back to revision 0 (undo import) | |
555 | working directory now based on revision 0 |
|
555 | working directory now based on revision 0 | |
556 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
556 | $ hg --cwd b parents --template 'parent: {rev}\n' | |
557 | parent: 0 |
|
557 | parent: 0 | |
558 |
|
558 | |||
559 | Test that "hg rollback" doesn't restore dirstate to one at the |
|
559 | Test that "hg rollback" doesn't restore dirstate to one at the | |
560 | beginning of the rolled back transaction in not-"parent-gone" case. |
|
560 | beginning of the rolled back transaction in not-"parent-gone" case. | |
561 |
|
561 | |||
562 | invoking pretxncommit hook will cause marking '.hg/dirstate' as a file |
|
562 | invoking pretxncommit hook will cause marking '.hg/dirstate' as a file | |
563 | to be restored when rolling back, after DirstateTransactionPlan (see wiki |
|
563 | to be restored when rolling back, after DirstateTransactionPlan (see wiki | |
564 | page for detail). |
|
564 | page for detail). | |
565 |
|
565 | |||
566 | $ hg --cwd b branch -q foobar |
|
566 | $ hg --cwd b branch -q foobar | |
567 | $ hg --cwd b commit -m foobar |
|
567 | $ hg --cwd b commit -m foobar | |
568 | $ hg --cwd b update 0 -q |
|
568 | $ hg --cwd b update 0 -q | |
569 | $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true |
|
569 | $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true | |
570 | applying ../patch1 |
|
570 | applying ../patch1 | |
571 | applying ../patch2 |
|
571 | applying ../patch2 | |
572 | $ hg --cwd b update -q 1 |
|
572 | $ hg --cwd b update -q 1 | |
573 | $ hg --cwd b rollback -q |
|
573 | $ hg --cwd b rollback -q | |
574 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
574 | $ hg --cwd b parents --template 'parent: {rev}\n' | |
575 | parent: 1 |
|
575 | parent: 1 | |
576 |
|
576 | |||
577 | $ hg --cwd b update -q -C 0 |
|
577 | $ hg --cwd b update -q -C 0 | |
578 | $ hg --cwd b --config extensions.strip= strip -q 1 |
|
578 | $ hg --cwd b --config extensions.strip= strip -q 1 | |
579 |
|
579 | |||
580 | Test visibility of in-memory dirstate changes inside transaction to |
|
580 | Test visibility of in-memory dirstate changes inside transaction to | |
581 | external process |
|
581 | external process | |
582 |
|
582 | |||
583 | $ echo foo > a/foo |
|
583 | $ echo foo > a/foo | |
584 | $ hg --cwd a commit -A -m 'adding foo' foo |
|
584 | $ hg --cwd a commit -A -m 'adding foo' foo | |
585 | $ hg --cwd a export -o '../patch%R' 3 |
|
585 | $ hg --cwd a export -o '../patch%R' 3 | |
586 |
|
586 | |||
587 | $ cat > $TESTTMP/checkvisibility.sh <<EOF |
|
587 | $ cat > $TESTTMP/checkvisibility.sh <<EOF | |
588 | > echo "====" |
|
588 | > echo "====" | |
589 | > hg parents --template "VISIBLE {rev}:{node|short}\n" |
|
589 | > hg parents --template "VISIBLE {rev}:{node|short}\n" | |
590 | > hg status -amr |
|
590 | > hg status -amr | |
591 | > # test that pending changes are hidden |
|
591 | > # test that pending changes are hidden | |
592 | > unset HG_PENDING |
|
592 | > unset HG_PENDING | |
593 | > hg parents --template "ACTUAL {rev}:{node|short}\n" |
|
593 | > hg parents --template "ACTUAL {rev}:{node|short}\n" | |
594 | > hg status -amr |
|
594 | > hg status -amr | |
595 | > echo "====" |
|
595 | > echo "====" | |
596 | > EOF |
|
596 | > EOF | |
597 |
|
597 | |||
598 | == test visibility to external editor |
|
598 | == test visibility to external editor | |
599 |
|
599 | |||
600 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
600 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
601 | ==== |
|
601 | ==== | |
602 | VISIBLE 0:80971e65b431 |
|
602 | VISIBLE 0:80971e65b431 | |
603 | ACTUAL 0:80971e65b431 |
|
603 | ACTUAL 0:80971e65b431 | |
604 | ==== |
|
604 | ==== | |
605 |
|
605 | |||
606 | $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3 |
|
606 | $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3 | |
607 | applying ../patch1 |
|
607 | applying ../patch1 | |
608 | patching file a |
|
608 | patching file a | |
609 | ==== |
|
609 | ==== | |
610 | VISIBLE 0:80971e65b431 |
|
610 | VISIBLE 0:80971e65b431 | |
611 | M a |
|
611 | M a | |
612 | ACTUAL 0:80971e65b431 |
|
612 | ACTUAL 0:80971e65b431 | |
613 | M a |
|
613 | M a | |
614 | ==== |
|
614 | ==== | |
615 | committing files: |
|
615 | committing files: | |
616 | a |
|
616 | a | |
617 | committing manifest |
|
617 | committing manifest | |
618 | committing changelog |
|
618 | committing changelog | |
619 | created 1d4bd90af0e4 |
|
619 | created 1d4bd90af0e4 | |
620 | applying ../patch2 |
|
620 | applying ../patch2 | |
621 | patching file a |
|
621 | patching file a | |
622 | ==== |
|
622 | ==== | |
623 | VISIBLE 1:1d4bd90af0e4 |
|
623 | VISIBLE 1:1d4bd90af0e4 | |
624 | M a |
|
624 | M a | |
625 | ACTUAL 0:80971e65b431 |
|
625 | ACTUAL 0:80971e65b431 | |
626 | M a |
|
626 | M a | |
627 | ==== |
|
627 | ==== | |
628 | committing files: |
|
628 | committing files: | |
629 | a |
|
629 | a | |
630 | committing manifest |
|
630 | committing manifest | |
631 | committing changelog |
|
631 | committing changelog | |
632 | created 6d019af21222 |
|
632 | created 6d019af21222 | |
633 | applying ../patch3 |
|
633 | applying ../patch3 | |
634 | patching file foo |
|
634 | patching file foo | |
635 | adding foo |
|
635 | adding foo | |
636 | ==== |
|
636 | ==== | |
637 | VISIBLE 2:6d019af21222 |
|
637 | VISIBLE 2:6d019af21222 | |
638 | A foo |
|
638 | A foo | |
639 | ACTUAL 0:80971e65b431 |
|
639 | ACTUAL 0:80971e65b431 | |
640 | M a |
|
640 | M a | |
641 | ==== |
|
641 | ==== | |
642 | committing files: |
|
642 | committing files: | |
643 | foo |
|
643 | foo | |
644 | committing manifest |
|
644 | committing manifest | |
645 | committing changelog |
|
645 | committing changelog | |
646 | created 55e3f75b2378 |
|
646 | created 55e3f75b2378 | |
647 |
|
647 | |||
648 | $ hg --cwd b rollback -q |
|
648 | $ hg --cwd b rollback -q | |
649 |
|
649 | |||
650 | (content of file "a" is already changed and it should be recognized as |
|
650 | (content of file "a" is already changed and it should be recognized as | |
651 | "M", even though dirstate is restored to one before "hg import") |
|
651 | "M", even though dirstate is restored to one before "hg import") | |
652 |
|
652 | |||
653 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
653 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
654 | ==== |
|
654 | ==== | |
655 | VISIBLE 0:80971e65b431 |
|
655 | VISIBLE 0:80971e65b431 | |
656 | M a |
|
656 | M a | |
657 | ACTUAL 0:80971e65b431 |
|
657 | ACTUAL 0:80971e65b431 | |
658 | M a |
|
658 | M a | |
659 | ==== |
|
659 | ==== | |
660 | $ hg --cwd b revert --no-backup a |
|
660 | $ hg --cwd b revert --no-backup a | |
661 | $ rm -f b/foo |
|
661 | $ rm -f b/foo | |
662 |
|
662 | |||
663 | == test visibility to precommit external hook |
|
663 | == test visibility to precommit external hook | |
664 |
|
664 | |||
665 | $ cat >> b/.hg/hgrc <<EOF |
|
665 | $ cat >> b/.hg/hgrc <<EOF | |
666 | > [hooks] |
|
666 | > [hooks] | |
667 | > precommit.visibility = sh $TESTTMP/checkvisibility.sh |
|
667 | > precommit.visibility = sh $TESTTMP/checkvisibility.sh | |
668 | > EOF |
|
668 | > EOF | |
669 |
|
669 | |||
670 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
670 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
671 | ==== |
|
671 | ==== | |
672 | VISIBLE 0:80971e65b431 |
|
672 | VISIBLE 0:80971e65b431 | |
673 | ACTUAL 0:80971e65b431 |
|
673 | ACTUAL 0:80971e65b431 | |
674 | ==== |
|
674 | ==== | |
675 |
|
675 | |||
676 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 |
|
676 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 | |
677 | applying ../patch1 |
|
677 | applying ../patch1 | |
678 | ==== |
|
678 | ==== | |
679 | VISIBLE 0:80971e65b431 |
|
679 | VISIBLE 0:80971e65b431 | |
680 | M a |
|
680 | M a | |
681 | ACTUAL 0:80971e65b431 |
|
681 | ACTUAL 0:80971e65b431 | |
682 | M a |
|
682 | M a | |
683 | ==== |
|
683 | ==== | |
684 | applying ../patch2 |
|
684 | applying ../patch2 | |
685 | ==== |
|
685 | ==== | |
686 | VISIBLE 1:1d4bd90af0e4 |
|
686 | VISIBLE 1:1d4bd90af0e4 | |
687 | M a |
|
687 | M a | |
688 | ACTUAL 0:80971e65b431 |
|
688 | ACTUAL 0:80971e65b431 | |
689 | M a |
|
689 | M a | |
690 | ==== |
|
690 | ==== | |
691 | applying ../patch3 |
|
691 | applying ../patch3 | |
692 | ==== |
|
692 | ==== | |
693 | VISIBLE 2:6d019af21222 |
|
693 | VISIBLE 2:6d019af21222 | |
694 | A foo |
|
694 | A foo | |
695 | ACTUAL 0:80971e65b431 |
|
695 | ACTUAL 0:80971e65b431 | |
696 | M a |
|
696 | M a | |
697 | ==== |
|
697 | ==== | |
698 |
|
698 | |||
699 | $ hg --cwd b rollback -q |
|
699 | $ hg --cwd b rollback -q | |
700 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
700 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
701 | ==== |
|
701 | ==== | |
702 | VISIBLE 0:80971e65b431 |
|
702 | VISIBLE 0:80971e65b431 | |
703 | M a |
|
703 | M a | |
704 | ACTUAL 0:80971e65b431 |
|
704 | ACTUAL 0:80971e65b431 | |
705 | M a |
|
705 | M a | |
706 | ==== |
|
706 | ==== | |
707 | $ hg --cwd b revert --no-backup a |
|
707 | $ hg --cwd b revert --no-backup a | |
708 | $ rm -f b/foo |
|
708 | $ rm -f b/foo | |
709 |
|
709 | |||
710 | $ cat >> b/.hg/hgrc <<EOF |
|
710 | $ cat >> b/.hg/hgrc <<EOF | |
711 | > [hooks] |
|
711 | > [hooks] | |
712 | > precommit.visibility = |
|
712 | > precommit.visibility = | |
713 | > EOF |
|
713 | > EOF | |
714 |
|
714 | |||
715 | == test visibility to pretxncommit external hook |
|
715 | == test visibility to pretxncommit external hook | |
716 |
|
716 | |||
717 | $ cat >> b/.hg/hgrc <<EOF |
|
717 | $ cat >> b/.hg/hgrc <<EOF | |
718 | > [hooks] |
|
718 | > [hooks] | |
719 | > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh |
|
719 | > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh | |
720 | > EOF |
|
720 | > EOF | |
721 |
|
721 | |||
722 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
722 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
723 | ==== |
|
723 | ==== | |
724 | VISIBLE 0:80971e65b431 |
|
724 | VISIBLE 0:80971e65b431 | |
725 | ACTUAL 0:80971e65b431 |
|
725 | ACTUAL 0:80971e65b431 | |
726 | ==== |
|
726 | ==== | |
727 |
|
727 | |||
728 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 |
|
728 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 | |
729 | applying ../patch1 |
|
729 | applying ../patch1 | |
730 | ==== |
|
730 | ==== | |
731 | VISIBLE 0:80971e65b431 |
|
731 | VISIBLE 0:80971e65b431 | |
732 | M a |
|
732 | M a | |
733 | ACTUAL 0:80971e65b431 |
|
733 | ACTUAL 0:80971e65b431 | |
734 | M a |
|
734 | M a | |
735 | ==== |
|
735 | ==== | |
736 | applying ../patch2 |
|
736 | applying ../patch2 | |
737 | ==== |
|
737 | ==== | |
738 | VISIBLE 1:1d4bd90af0e4 |
|
738 | VISIBLE 1:1d4bd90af0e4 | |
739 | M a |
|
739 | M a | |
740 | ACTUAL 0:80971e65b431 |
|
740 | ACTUAL 0:80971e65b431 | |
741 | M a |
|
741 | M a | |
742 | ==== |
|
742 | ==== | |
743 | applying ../patch3 |
|
743 | applying ../patch3 | |
744 | ==== |
|
744 | ==== | |
745 | VISIBLE 2:6d019af21222 |
|
745 | VISIBLE 2:6d019af21222 | |
746 | A foo |
|
746 | A foo | |
747 | ACTUAL 0:80971e65b431 |
|
747 | ACTUAL 0:80971e65b431 | |
748 | M a |
|
748 | M a | |
749 | ==== |
|
749 | ==== | |
750 |
|
750 | |||
751 | $ hg --cwd b rollback -q |
|
751 | $ hg --cwd b rollback -q | |
752 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
752 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") | |
753 | ==== |
|
753 | ==== | |
754 | VISIBLE 0:80971e65b431 |
|
754 | VISIBLE 0:80971e65b431 | |
755 | M a |
|
755 | M a | |
756 | ACTUAL 0:80971e65b431 |
|
756 | ACTUAL 0:80971e65b431 | |
757 | M a |
|
757 | M a | |
758 | ==== |
|
758 | ==== | |
759 | $ hg --cwd b revert --no-backup a |
|
759 | $ hg --cwd b revert --no-backup a | |
760 | $ rm -f b/foo |
|
760 | $ rm -f b/foo | |
761 |
|
761 | |||
762 | $ cat >> b/.hg/hgrc <<EOF |
|
762 | $ cat >> b/.hg/hgrc <<EOF | |
763 | > [hooks] |
|
763 | > [hooks] | |
764 | > pretxncommit.visibility = |
|
764 | > pretxncommit.visibility = | |
765 | > EOF |
|
765 | > EOF | |
766 |
|
766 | |||
767 | $ rm -r b |
|
767 | $ rm -r b | |
768 |
|
768 | |||
769 |
|
769 | |||
770 | importing a patch in a subdirectory failed at the commit stage |
|
770 | importing a patch in a subdirectory failed at the commit stage | |
771 |
|
771 | |||
772 | $ echo line 2 >> a/d1/d2/a |
|
772 | $ echo line 2 >> a/d1/d2/a | |
773 | $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' |
|
773 | $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' | |
774 |
|
774 | |||
775 | hg import in a subdirectory |
|
775 | hg import in a subdirectory | |
776 |
|
776 | |||
777 | $ hg clone -r0 a b |
|
777 | $ hg clone -r0 a b | |
778 | adding changesets |
|
778 | adding changesets | |
779 | adding manifests |
|
779 | adding manifests | |
780 | adding file changes |
|
780 | adding file changes | |
781 | added 1 changesets with 2 changes to 2 files |
|
781 | added 1 changesets with 2 changes to 2 files | |
782 | new changesets 80971e65b431 |
|
782 | new changesets 80971e65b431 | |
783 | updating to branch default |
|
783 | updating to branch default | |
784 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
784 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
785 | $ hg --cwd a export tip > tmp |
|
785 | $ hg --cwd a export tip > tmp | |
786 | $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch |
|
786 | $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch | |
787 | $ dir=`pwd` |
|
787 | $ dir=`pwd` | |
788 | $ cd b/d1/d2 2>&1 > /dev/null |
|
788 | $ cd b/d1/d2 2>&1 > /dev/null | |
789 | $ hg import ../../../subdir-tip.patch |
|
789 | $ hg import ../../../subdir-tip.patch | |
790 | applying ../../../subdir-tip.patch |
|
790 | applying ../../../subdir-tip.patch | |
791 | $ cd "$dir" |
|
791 | $ cd "$dir" | |
792 |
|
792 | |||
793 | message should be 'subdir change' |
|
793 | message should be 'subdir change' | |
794 | committer should be 'someoneelse' |
|
794 | committer should be 'someoneelse' | |
795 |
|
795 | |||
796 | $ hg --cwd b tip |
|
796 | $ hg --cwd b tip | |
797 | changeset: 1:3577f5aea227 |
|
797 | changeset: 1:3577f5aea227 | |
798 | tag: tip |
|
798 | tag: tip | |
799 | user: someoneelse |
|
799 | user: someoneelse | |
800 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
800 | date: Thu Jan 01 00:00:01 1970 +0000 | |
801 | summary: subdir change |
|
801 | summary: subdir change | |
802 |
|
802 | |||
803 |
|
803 | |||
804 | should be empty |
|
804 | should be empty | |
805 |
|
805 | |||
806 | $ hg --cwd b status |
|
806 | $ hg --cwd b status | |
807 |
|
807 | |||
808 |
|
808 | |||
809 | Test fuzziness (ambiguous patch location, fuzz=2) |
|
809 | Test fuzziness (ambiguous patch location, fuzz=2) | |
810 |
|
810 | |||
811 | $ hg init fuzzy |
|
811 | $ hg init fuzzy | |
812 | $ cd fuzzy |
|
812 | $ cd fuzzy | |
813 | $ echo line1 > a |
|
813 | $ echo line1 > a | |
814 | $ echo line0 >> a |
|
814 | $ echo line0 >> a | |
815 | $ echo line3 >> a |
|
815 | $ echo line3 >> a | |
816 | $ hg ci -Am adda |
|
816 | $ hg ci -Am adda | |
817 | adding a |
|
817 | adding a | |
818 | $ echo line1 > a |
|
818 | $ echo line1 > a | |
819 | $ echo line2 >> a |
|
819 | $ echo line2 >> a | |
820 | $ echo line0 >> a |
|
820 | $ echo line0 >> a | |
821 | $ echo line3 >> a |
|
821 | $ echo line3 >> a | |
822 | $ hg ci -m change a |
|
822 | $ hg ci -m change a | |
823 | $ hg export tip > fuzzy-tip.patch |
|
823 | $ hg export tip > fuzzy-tip.patch | |
824 | $ hg up -C 0 |
|
824 | $ hg up -C 0 | |
825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
826 | $ echo line1 > a |
|
826 | $ echo line1 > a | |
827 | $ echo line0 >> a |
|
827 | $ echo line0 >> a | |
828 | $ echo line1 >> a |
|
828 | $ echo line1 >> a | |
829 | $ echo line0 >> a |
|
829 | $ echo line0 >> a | |
830 | $ hg ci -m brancha |
|
830 | $ hg ci -m brancha | |
831 | created new head |
|
831 | created new head | |
832 | $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch |
|
832 | $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch | |
833 | applying fuzzy-tip.patch |
|
833 | applying fuzzy-tip.patch | |
834 | patching file a |
|
834 | patching file a | |
835 | Hunk #1 FAILED at 0 |
|
835 | Hunk #1 FAILED at 0 | |
836 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
836 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
837 | abort: patch failed to apply |
|
837 | abort: patch failed to apply | |
838 | [20] |
|
838 | [20] | |
839 | $ hg import --no-commit -v fuzzy-tip.patch |
|
839 | $ hg import --no-commit -v fuzzy-tip.patch | |
840 | applying fuzzy-tip.patch |
|
840 | applying fuzzy-tip.patch | |
841 | patching file a |
|
841 | patching file a | |
842 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). |
|
842 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). | |
843 | applied to working directory |
|
843 | applied to working directory | |
844 | $ hg revert -a |
|
844 | $ hg revert -a | |
845 | reverting a |
|
845 | reverting a | |
846 |
|
846 | |||
847 | Test --exact failure |
|
847 | Test --exact failure | |
848 |
|
848 | |||
849 | $ sed 's/^# Parent .*/# Parent '"`hg log -r. -T '{node}'`"'/' \ |
|
849 | $ sed 's/^# Parent .*/# Parent '"`hg log -r. -T '{node}'`"'/' \ | |
850 | > < fuzzy-tip.patch > fuzzy-reparent.patch |
|
850 | > < fuzzy-tip.patch > fuzzy-reparent.patch | |
851 | $ hg import --config patch.fuzz=0 --exact fuzzy-reparent.patch |
|
851 | $ hg import --config patch.fuzz=0 --exact fuzzy-reparent.patch | |
852 | applying fuzzy-reparent.patch |
|
852 | applying fuzzy-reparent.patch | |
853 | patching file a |
|
853 | patching file a | |
854 | Hunk #1 FAILED at 0 |
|
854 | Hunk #1 FAILED at 0 | |
855 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
855 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
856 | abort: patch failed to apply |
|
856 | abort: patch failed to apply | |
857 | [20] |
|
857 | [20] | |
858 | $ hg up -qC |
|
858 | $ hg up -qC | |
859 | $ hg import --config patch.fuzz=2 --exact fuzzy-reparent.patch |
|
859 | $ hg import --config patch.fuzz=2 --exact fuzzy-reparent.patch | |
860 | applying fuzzy-reparent.patch |
|
860 | applying fuzzy-reparent.patch | |
861 | patching file a |
|
861 | patching file a | |
862 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). |
|
862 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). | |
863 | transaction abort! |
|
863 | transaction abort! | |
864 | rollback completed |
|
864 | rollback completed | |
865 | abort: patch is damaged or loses information |
|
865 | abort: patch is damaged or loses information | |
866 | [255] |
|
866 | [255] | |
867 | $ hg up -qC |
|
867 | $ hg up -qC | |
868 |
|
868 | |||
869 | $ grep '^#' fuzzy-tip.patch > empty.patch |
|
869 | $ grep '^#' fuzzy-tip.patch > empty.patch | |
870 | $ cat <<'EOF' >> empty.patch |
|
870 | $ cat <<'EOF' >> empty.patch | |
871 | > change |
|
871 | > change | |
872 | > |
|
872 | > | |
873 | > diff -r bb90ef1daa38 -r 0e9b883378d4 a |
|
873 | > diff -r bb90ef1daa38 -r 0e9b883378d4 a | |
874 | > --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
874 | > --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
875 | > --- b/a Thu Jan 01 00:00:00 1970 +0000 |
|
875 | > --- b/a Thu Jan 01 00:00:00 1970 +0000 | |
876 | > EOF |
|
876 | > EOF | |
877 | $ hg import --exact empty.patch |
|
877 | $ hg import --exact empty.patch | |
878 | applying empty.patch |
|
878 | applying empty.patch | |
879 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
879 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
880 | abort: patch is damaged or loses information |
|
880 | abort: patch is damaged or loses information | |
881 | [255] |
|
881 | [255] | |
882 | $ hg up -qC |
|
882 | $ hg up -qC | |
883 |
|
883 | |||
884 | import with --no-commit should have written .hg/last-message.txt |
|
884 | import with --no-commit should have written .hg/last-message.txt | |
885 |
|
885 | |||
886 | $ cat .hg/last-message.txt |
|
886 | $ cat .hg/last-message.txt | |
887 | change (no-eol) |
|
887 | change (no-eol) | |
888 |
|
888 | |||
889 |
|
889 | |||
890 | test fuzziness with eol=auto |
|
890 | test fuzziness with eol=auto | |
891 |
|
891 | |||
892 | $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch |
|
892 | $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch | |
893 | applying fuzzy-tip.patch |
|
893 | applying fuzzy-tip.patch | |
894 | patching file a |
|
894 | patching file a | |
895 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). |
|
895 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). | |
896 | applied to working directory |
|
896 | applied to working directory | |
897 | $ cd .. |
|
897 | $ cd .. | |
898 |
|
898 | |||
899 |
|
899 | |||
900 | Test hunk touching empty files (issue906) |
|
900 | Test hunk touching empty files (issue906) | |
901 |
|
901 | |||
902 | $ hg init empty |
|
902 | $ hg init empty | |
903 | $ cd empty |
|
903 | $ cd empty | |
904 | $ touch a |
|
904 | $ touch a | |
905 | $ touch b1 |
|
905 | $ touch b1 | |
906 | $ touch c1 |
|
906 | $ touch c1 | |
907 | $ echo d > d |
|
907 | $ echo d > d | |
908 | $ hg ci -Am init |
|
908 | $ hg ci -Am init | |
909 | adding a |
|
909 | adding a | |
910 | adding b1 |
|
910 | adding b1 | |
911 | adding c1 |
|
911 | adding c1 | |
912 | adding d |
|
912 | adding d | |
913 | $ echo a > a |
|
913 | $ echo a > a | |
914 | $ echo b > b1 |
|
914 | $ echo b > b1 | |
915 | $ hg mv b1 b2 |
|
915 | $ hg mv b1 b2 | |
916 | $ echo c > c1 |
|
916 | $ echo c > c1 | |
917 | $ hg copy c1 c2 |
|
917 | $ hg copy c1 c2 | |
918 | $ rm d |
|
918 | $ rm d | |
919 | $ touch d |
|
919 | $ touch d | |
920 | $ hg diff --git |
|
920 | $ hg diff --git | |
921 | diff --git a/a b/a |
|
921 | diff --git a/a b/a | |
922 | --- a/a |
|
922 | --- a/a | |
923 | +++ b/a |
|
923 | +++ b/a | |
924 | @@ -0,0 +1,1 @@ |
|
924 | @@ -0,0 +1,1 @@ | |
925 | +a |
|
925 | +a | |
926 | diff --git a/b1 b/b2 |
|
926 | diff --git a/b1 b/b2 | |
927 | rename from b1 |
|
927 | rename from b1 | |
928 | rename to b2 |
|
928 | rename to b2 | |
929 | --- a/b1 |
|
929 | --- a/b1 | |
930 | +++ b/b2 |
|
930 | +++ b/b2 | |
931 | @@ -0,0 +1,1 @@ |
|
931 | @@ -0,0 +1,1 @@ | |
932 | +b |
|
932 | +b | |
933 | diff --git a/c1 b/c1 |
|
933 | diff --git a/c1 b/c1 | |
934 | --- a/c1 |
|
934 | --- a/c1 | |
935 | +++ b/c1 |
|
935 | +++ b/c1 | |
936 | @@ -0,0 +1,1 @@ |
|
936 | @@ -0,0 +1,1 @@ | |
937 | +c |
|
937 | +c | |
938 | diff --git a/c1 b/c2 |
|
938 | diff --git a/c1 b/c2 | |
939 | copy from c1 |
|
939 | copy from c1 | |
940 | copy to c2 |
|
940 | copy to c2 | |
941 | --- a/c1 |
|
941 | --- a/c1 | |
942 | +++ b/c2 |
|
942 | +++ b/c2 | |
943 | @@ -0,0 +1,1 @@ |
|
943 | @@ -0,0 +1,1 @@ | |
944 | +c |
|
944 | +c | |
945 | diff --git a/d b/d |
|
945 | diff --git a/d b/d | |
946 | --- a/d |
|
946 | --- a/d | |
947 | +++ b/d |
|
947 | +++ b/d | |
948 | @@ -1,1 +0,0 @@ |
|
948 | @@ -1,1 +0,0 @@ | |
949 | -d |
|
949 | -d | |
950 | $ hg ci -m empty |
|
950 | $ hg ci -m empty | |
951 | $ hg export --git tip > empty.diff |
|
951 | $ hg export --git tip > empty.diff | |
952 | $ hg up -C 0 |
|
952 | $ hg up -C 0 | |
953 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
953 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
954 | $ hg import empty.diff |
|
954 | $ hg import empty.diff | |
955 | applying empty.diff |
|
955 | applying empty.diff | |
956 | $ for name in a b1 b2 c1 c2 d; do |
|
956 | $ for name in a b1 b2 c1 c2 d; do | |
957 | > echo % $name file |
|
957 | > echo % $name file | |
958 | > test -f $name && cat $name |
|
958 | > test -f $name && cat $name | |
959 | > done |
|
959 | > done | |
960 | % a file |
|
960 | % a file | |
961 | a |
|
961 | a | |
962 | % b1 file |
|
962 | % b1 file | |
963 | % b2 file |
|
963 | % b2 file | |
964 | b |
|
964 | b | |
965 | % c1 file |
|
965 | % c1 file | |
966 | c |
|
966 | c | |
967 | % c2 file |
|
967 | % c2 file | |
968 | c |
|
968 | c | |
969 | % d file |
|
969 | % d file | |
970 | $ cd .. |
|
970 | $ cd .. | |
971 |
|
971 | |||
972 |
|
972 | |||
973 | Test importing a patch ending with a binary file removal |
|
973 | Test importing a patch ending with a binary file removal | |
974 |
|
974 | |||
975 | $ hg init binaryremoval |
|
975 | $ hg init binaryremoval | |
976 | $ cd binaryremoval |
|
976 | $ cd binaryremoval | |
977 | $ echo a > a |
|
977 | $ echo a > a | |
978 | $ "$PYTHON" -c "open('b', 'wb').write(b'a\x00b')" |
|
978 | $ "$PYTHON" -c "open('b', 'wb').write(b'a\x00b')" | |
979 | $ hg ci -Am addall |
|
979 | $ hg ci -Am addall | |
980 | adding a |
|
980 | adding a | |
981 | adding b |
|
981 | adding b | |
982 | $ hg rm a |
|
982 | $ hg rm a | |
983 | $ hg rm b |
|
983 | $ hg rm b | |
984 | $ hg st |
|
984 | $ hg st | |
985 | R a |
|
985 | R a | |
986 | R b |
|
986 | R b | |
987 | $ hg ci -m remove |
|
987 | $ hg ci -m remove | |
988 | $ hg export --git . > remove.diff |
|
988 | $ hg export --git . > remove.diff | |
989 | $ cat remove.diff | grep git |
|
989 | $ cat remove.diff | grep git | |
990 | diff --git a/a b/a |
|
990 | diff --git a/a b/a | |
991 | diff --git a/b b/b |
|
991 | diff --git a/b b/b | |
992 | $ hg up -C 0 |
|
992 | $ hg up -C 0 | |
993 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
993 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
994 | $ hg import remove.diff |
|
994 | $ hg import remove.diff | |
995 | applying remove.diff |
|
995 | applying remove.diff | |
996 | $ hg manifest |
|
996 | $ hg manifest | |
997 | $ cd .. |
|
997 | $ cd .. | |
998 |
|
998 | |||
999 |
|
999 | |||
1000 | Issue927: test update+rename with common name |
|
1000 | Issue927: test update+rename with common name | |
1001 |
|
1001 | |||
1002 | $ hg init t |
|
1002 | $ hg init t | |
1003 | $ cd t |
|
1003 | $ cd t | |
1004 | $ touch a |
|
1004 | $ touch a | |
1005 | $ hg ci -Am t |
|
1005 | $ hg ci -Am t | |
1006 | adding a |
|
1006 | adding a | |
1007 | $ echo a > a |
|
1007 | $ echo a > a | |
1008 |
|
1008 | |||
1009 | Here, bfile.startswith(afile) |
|
1009 | Here, bfile.startswith(afile) | |
1010 |
|
1010 | |||
1011 | $ hg copy a a2 |
|
1011 | $ hg copy a a2 | |
1012 | $ hg ci -m copya |
|
1012 | $ hg ci -m copya | |
1013 | $ hg export --git tip > copy.diff |
|
1013 | $ hg export --git tip > copy.diff | |
1014 | $ hg up -C 0 |
|
1014 | $ hg up -C 0 | |
1015 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1015 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1016 | $ hg import copy.diff |
|
1016 | $ hg import copy.diff | |
1017 | applying copy.diff |
|
1017 | applying copy.diff | |
1018 |
|
1018 | |||
1019 | a should contain an 'a' |
|
1019 | a should contain an 'a' | |
1020 |
|
1020 | |||
1021 | $ cat a |
|
1021 | $ cat a | |
1022 | a |
|
1022 | a | |
1023 |
|
1023 | |||
1024 | and a2 should have duplicated it |
|
1024 | and a2 should have duplicated it | |
1025 |
|
1025 | |||
1026 | $ cat a2 |
|
1026 | $ cat a2 | |
1027 | a |
|
1027 | a | |
1028 | $ cd .. |
|
1028 | $ cd .. | |
1029 |
|
1029 | |||
1030 |
|
1030 | |||
1031 | test -p0 |
|
1031 | test -p0 | |
1032 |
|
1032 | |||
1033 | $ hg init p0 |
|
1033 | $ hg init p0 | |
1034 | $ cd p0 |
|
1034 | $ cd p0 | |
1035 | $ echo a > a |
|
1035 | $ echo a > a | |
1036 | $ hg ci -Am t |
|
1036 | $ hg ci -Am t | |
1037 | adding a |
|
1037 | adding a | |
1038 | $ hg import -p foo |
|
1038 | $ hg import -p foo | |
1039 | abort: invalid value 'foo' for option -p, expected int |
|
1039 | abort: invalid value 'foo' for option -p, expected int | |
1040 | [10] |
|
1040 | [10] | |
1041 | $ hg import -p0 - << EOF |
|
1041 | $ hg import -p0 - << EOF | |
1042 | > foobar |
|
1042 | > foobar | |
1043 | > --- a Sat Apr 12 22:43:58 2008 -0400 |
|
1043 | > --- a Sat Apr 12 22:43:58 2008 -0400 | |
1044 | > +++ a Sat Apr 12 22:44:05 2008 -0400 |
|
1044 | > +++ a Sat Apr 12 22:44:05 2008 -0400 | |
1045 | > @@ -1,1 +1,1 @@ |
|
1045 | > @@ -1,1 +1,1 @@ | |
1046 | > -a |
|
1046 | > -a | |
1047 | > +bb |
|
1047 | > +bb | |
1048 | > EOF |
|
1048 | > EOF | |
1049 | applying patch from stdin |
|
1049 | applying patch from stdin | |
1050 | $ hg status |
|
1050 | $ hg status | |
1051 | $ cat a |
|
1051 | $ cat a | |
1052 | bb |
|
1052 | bb | |
1053 |
|
1053 | |||
1054 | test --prefix |
|
1054 | test --prefix | |
1055 |
|
1055 | |||
1056 | $ mkdir -p dir/dir2 |
|
1056 | $ mkdir -p dir/dir2 | |
1057 | $ echo b > dir/dir2/b |
|
1057 | $ echo b > dir/dir2/b | |
1058 | $ hg ci -Am b |
|
1058 | $ hg ci -Am b | |
1059 | adding dir/dir2/b |
|
1059 | adding dir/dir2/b | |
1060 | $ hg import -p2 --prefix dir - << EOF |
|
1060 | $ hg import -p2 --prefix dir - << EOF | |
1061 | > foobar |
|
1061 | > foobar | |
1062 | > --- drop1/drop2/dir2/b |
|
1062 | > --- drop1/drop2/dir2/b | |
1063 | > +++ drop1/drop2/dir2/b |
|
1063 | > +++ drop1/drop2/dir2/b | |
1064 | > @@ -1,1 +1,1 @@ |
|
1064 | > @@ -1,1 +1,1 @@ | |
1065 | > -b |
|
1065 | > -b | |
1066 | > +cc |
|
1066 | > +cc | |
1067 | > EOF |
|
1067 | > EOF | |
1068 | applying patch from stdin |
|
1068 | applying patch from stdin | |
1069 | $ hg status |
|
1069 | $ hg status | |
1070 | $ cat dir/dir2/b |
|
1070 | $ cat dir/dir2/b | |
1071 | cc |
|
1071 | cc | |
1072 | $ cd .. |
|
1072 | $ cd .. | |
1073 |
|
1073 | |||
1074 |
|
1074 | |||
1075 | test paths outside repo root |
|
1075 | test paths outside repo root | |
1076 |
|
1076 | |||
1077 | $ mkdir outside |
|
1077 | $ mkdir outside | |
1078 | $ touch outside/foo |
|
1078 | $ touch outside/foo | |
1079 | $ hg init inside |
|
1079 | $ hg init inside | |
1080 | $ cd inside |
|
1080 | $ cd inside | |
1081 | $ hg import - <<EOF |
|
1081 | $ hg import - <<EOF | |
1082 | > diff --git a/a b/b |
|
1082 | > diff --git a/a b/b | |
1083 | > rename from ../outside/foo |
|
1083 | > rename from ../outside/foo | |
1084 | > rename to bar |
|
1084 | > rename to bar | |
1085 | > EOF |
|
1085 | > EOF | |
1086 | applying patch from stdin |
|
1086 | applying patch from stdin | |
1087 | abort: path contains illegal component: ../outside/foo |
|
1087 | abort: path contains illegal component: ../outside/foo | |
1088 |
[ |
|
1088 | [10] | |
1089 | $ cd .. |
|
1089 | $ cd .. | |
1090 |
|
1090 | |||
1091 |
|
1091 | |||
1092 | test import with similarity and git and strip (issue295 et al.) |
|
1092 | test import with similarity and git and strip (issue295 et al.) | |
1093 |
|
1093 | |||
1094 | $ hg init sim |
|
1094 | $ hg init sim | |
1095 | $ cd sim |
|
1095 | $ cd sim | |
1096 | $ echo 'this is a test' > a |
|
1096 | $ echo 'this is a test' > a | |
1097 | $ hg ci -Ama |
|
1097 | $ hg ci -Ama | |
1098 | adding a |
|
1098 | adding a | |
1099 | $ cat > ../rename.diff <<EOF |
|
1099 | $ cat > ../rename.diff <<EOF | |
1100 | > diff --git a/foo/a b/foo/a |
|
1100 | > diff --git a/foo/a b/foo/a | |
1101 | > deleted file mode 100644 |
|
1101 | > deleted file mode 100644 | |
1102 | > --- a/foo/a |
|
1102 | > --- a/foo/a | |
1103 | > +++ /dev/null |
|
1103 | > +++ /dev/null | |
1104 | > @@ -1,1 +0,0 @@ |
|
1104 | > @@ -1,1 +0,0 @@ | |
1105 | > -this is a test |
|
1105 | > -this is a test | |
1106 | > diff --git a/foo/b b/foo/b |
|
1106 | > diff --git a/foo/b b/foo/b | |
1107 | > new file mode 100644 |
|
1107 | > new file mode 100644 | |
1108 | > --- /dev/null |
|
1108 | > --- /dev/null | |
1109 | > +++ b/foo/b |
|
1109 | > +++ b/foo/b | |
1110 | > @@ -0,0 +1,2 @@ |
|
1110 | > @@ -0,0 +1,2 @@ | |
1111 | > +this is a test |
|
1111 | > +this is a test | |
1112 | > +foo |
|
1112 | > +foo | |
1113 | > EOF |
|
1113 | > EOF | |
1114 | $ hg import --no-commit -v -s 1 ../rename.diff -p2 |
|
1114 | $ hg import --no-commit -v -s 1 ../rename.diff -p2 | |
1115 | applying ../rename.diff |
|
1115 | applying ../rename.diff | |
1116 | patching file a |
|
1116 | patching file a | |
1117 | patching file b |
|
1117 | patching file b | |
1118 | adding b |
|
1118 | adding b | |
1119 | recording removal of a as rename to b (88% similar) |
|
1119 | recording removal of a as rename to b (88% similar) | |
1120 | applied to working directory |
|
1120 | applied to working directory | |
1121 | $ echo 'mod b' > b |
|
1121 | $ echo 'mod b' > b | |
1122 | $ hg st -C |
|
1122 | $ hg st -C | |
1123 | A b |
|
1123 | A b | |
1124 | a |
|
1124 | a | |
1125 | R a |
|
1125 | R a | |
1126 | $ hg revert -a |
|
1126 | $ hg revert -a | |
1127 | forgetting b |
|
1127 | forgetting b | |
1128 | undeleting a |
|
1128 | undeleting a | |
1129 | $ cat b |
|
1129 | $ cat b | |
1130 | mod b |
|
1130 | mod b | |
1131 | $ rm b |
|
1131 | $ rm b | |
1132 | $ hg import --no-commit -v -s 100 ../rename.diff -p2 |
|
1132 | $ hg import --no-commit -v -s 100 ../rename.diff -p2 | |
1133 | applying ../rename.diff |
|
1133 | applying ../rename.diff | |
1134 | patching file a |
|
1134 | patching file a | |
1135 | patching file b |
|
1135 | patching file b | |
1136 | adding b |
|
1136 | adding b | |
1137 | applied to working directory |
|
1137 | applied to working directory | |
1138 | $ hg st -C |
|
1138 | $ hg st -C | |
1139 | A b |
|
1139 | A b | |
1140 | R a |
|
1140 | R a | |
1141 | $ cd .. |
|
1141 | $ cd .. | |
1142 |
|
1142 | |||
1143 |
|
1143 | |||
1144 | Issue1495: add empty file from the end of patch |
|
1144 | Issue1495: add empty file from the end of patch | |
1145 |
|
1145 | |||
1146 | $ hg init addemptyend |
|
1146 | $ hg init addemptyend | |
1147 | $ cd addemptyend |
|
1147 | $ cd addemptyend | |
1148 | $ touch a |
|
1148 | $ touch a | |
1149 | $ hg addremove |
|
1149 | $ hg addremove | |
1150 | adding a |
|
1150 | adding a | |
1151 | $ hg ci -m "commit" |
|
1151 | $ hg ci -m "commit" | |
1152 | $ cat > a.patch <<EOF |
|
1152 | $ cat > a.patch <<EOF | |
1153 | > add a, b |
|
1153 | > add a, b | |
1154 | > diff --git a/a b/a |
|
1154 | > diff --git a/a b/a | |
1155 | > --- a/a |
|
1155 | > --- a/a | |
1156 | > +++ b/a |
|
1156 | > +++ b/a | |
1157 | > @@ -0,0 +1,1 @@ |
|
1157 | > @@ -0,0 +1,1 @@ | |
1158 | > +a |
|
1158 | > +a | |
1159 | > diff --git a/b b/b |
|
1159 | > diff --git a/b b/b | |
1160 | > new file mode 100644 |
|
1160 | > new file mode 100644 | |
1161 | > EOF |
|
1161 | > EOF | |
1162 | $ hg import --no-commit a.patch |
|
1162 | $ hg import --no-commit a.patch | |
1163 | applying a.patch |
|
1163 | applying a.patch | |
1164 |
|
1164 | |||
1165 | apply a good patch followed by an empty patch (mainly to ensure |
|
1165 | apply a good patch followed by an empty patch (mainly to ensure | |
1166 | that dirstate is *not* updated when import crashes) |
|
1166 | that dirstate is *not* updated when import crashes) | |
1167 | $ hg update -q -C . |
|
1167 | $ hg update -q -C . | |
1168 | $ rm b |
|
1168 | $ rm b | |
1169 | $ touch empty.patch |
|
1169 | $ touch empty.patch | |
1170 | $ hg import a.patch empty.patch |
|
1170 | $ hg import a.patch empty.patch | |
1171 | applying a.patch |
|
1171 | applying a.patch | |
1172 | applying empty.patch |
|
1172 | applying empty.patch | |
1173 | transaction abort! |
|
1173 | transaction abort! | |
1174 | rollback completed |
|
1174 | rollback completed | |
1175 | abort: empty.patch: no diffs found |
|
1175 | abort: empty.patch: no diffs found | |
1176 | [10] |
|
1176 | [10] | |
1177 | $ hg tip --template '{rev} {desc|firstline}\n' |
|
1177 | $ hg tip --template '{rev} {desc|firstline}\n' | |
1178 | 0 commit |
|
1178 | 0 commit | |
1179 | $ hg -q status |
|
1179 | $ hg -q status | |
1180 | M a |
|
1180 | M a | |
1181 | $ cd .. |
|
1181 | $ cd .. | |
1182 |
|
1182 | |||
1183 | create file when source is not /dev/null |
|
1183 | create file when source is not /dev/null | |
1184 |
|
1184 | |||
1185 | $ cat > create.patch <<EOF |
|
1185 | $ cat > create.patch <<EOF | |
1186 | > diff -Naur proj-orig/foo proj-new/foo |
|
1186 | > diff -Naur proj-orig/foo proj-new/foo | |
1187 | > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 |
|
1187 | > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 | |
1188 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
1188 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
1189 | > @@ -0,0 +1,1 @@ |
|
1189 | > @@ -0,0 +1,1 @@ | |
1190 | > +a |
|
1190 | > +a | |
1191 | > EOF |
|
1191 | > EOF | |
1192 |
|
1192 | |||
1193 | some people have patches like the following too |
|
1193 | some people have patches like the following too | |
1194 |
|
1194 | |||
1195 | $ cat > create2.patch <<EOF |
|
1195 | $ cat > create2.patch <<EOF | |
1196 | > diff -Naur proj-orig/foo proj-new/foo |
|
1196 | > diff -Naur proj-orig/foo proj-new/foo | |
1197 | > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 |
|
1197 | > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 | |
1198 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
1198 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 | |
1199 | > @@ -0,0 +1,1 @@ |
|
1199 | > @@ -0,0 +1,1 @@ | |
1200 | > +a |
|
1200 | > +a | |
1201 | > EOF |
|
1201 | > EOF | |
1202 | $ hg init oddcreate |
|
1202 | $ hg init oddcreate | |
1203 | $ cd oddcreate |
|
1203 | $ cd oddcreate | |
1204 | $ hg import --no-commit ../create.patch |
|
1204 | $ hg import --no-commit ../create.patch | |
1205 | applying ../create.patch |
|
1205 | applying ../create.patch | |
1206 | $ cat foo |
|
1206 | $ cat foo | |
1207 | a |
|
1207 | a | |
1208 | $ rm foo |
|
1208 | $ rm foo | |
1209 | $ hg revert foo |
|
1209 | $ hg revert foo | |
1210 | $ hg import --no-commit ../create2.patch |
|
1210 | $ hg import --no-commit ../create2.patch | |
1211 | applying ../create2.patch |
|
1211 | applying ../create2.patch | |
1212 | $ cat foo |
|
1212 | $ cat foo | |
1213 | a |
|
1213 | a | |
1214 |
|
1214 | |||
1215 | $ cd .. |
|
1215 | $ cd .. | |
1216 |
|
1216 | |||
1217 | Issue1859: first line mistaken for email headers |
|
1217 | Issue1859: first line mistaken for email headers | |
1218 |
|
1218 | |||
1219 | $ hg init emailconfusion |
|
1219 | $ hg init emailconfusion | |
1220 | $ cd emailconfusion |
|
1220 | $ cd emailconfusion | |
1221 | $ cat > a.patch <<EOF |
|
1221 | $ cat > a.patch <<EOF | |
1222 | > module: summary |
|
1222 | > module: summary | |
1223 | > |
|
1223 | > | |
1224 | > description |
|
1224 | > description | |
1225 | > |
|
1225 | > | |
1226 | > |
|
1226 | > | |
1227 | > diff -r 000000000000 -r 9b4c1e343b55 test.txt |
|
1227 | > diff -r 000000000000 -r 9b4c1e343b55 test.txt | |
1228 | > --- /dev/null |
|
1228 | > --- /dev/null | |
1229 | > +++ b/a |
|
1229 | > +++ b/a | |
1230 | > @@ -0,0 +1,1 @@ |
|
1230 | > @@ -0,0 +1,1 @@ | |
1231 | > +a |
|
1231 | > +a | |
1232 | > EOF |
|
1232 | > EOF | |
1233 | $ hg import -d '0 0' a.patch |
|
1233 | $ hg import -d '0 0' a.patch | |
1234 | applying a.patch |
|
1234 | applying a.patch | |
1235 | $ hg parents -v |
|
1235 | $ hg parents -v | |
1236 | changeset: 0:5a681217c0ad |
|
1236 | changeset: 0:5a681217c0ad | |
1237 | tag: tip |
|
1237 | tag: tip | |
1238 | user: test |
|
1238 | user: test | |
1239 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1239 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1240 | files: a |
|
1240 | files: a | |
1241 | description: |
|
1241 | description: | |
1242 | module: summary |
|
1242 | module: summary | |
1243 |
|
1243 | |||
1244 | description |
|
1244 | description | |
1245 |
|
1245 | |||
1246 |
|
1246 | |||
1247 | $ cd .. |
|
1247 | $ cd .. | |
1248 |
|
1248 | |||
1249 |
|
1249 | |||
1250 | in commit message |
|
1250 | in commit message | |
1251 |
|
1251 | |||
1252 | $ hg init commitconfusion |
|
1252 | $ hg init commitconfusion | |
1253 | $ cd commitconfusion |
|
1253 | $ cd commitconfusion | |
1254 | $ cat > a.patch <<EOF |
|
1254 | $ cat > a.patch <<EOF | |
1255 | > module: summary |
|
1255 | > module: summary | |
1256 | > |
|
1256 | > | |
1257 | > --- description |
|
1257 | > --- description | |
1258 | > |
|
1258 | > | |
1259 | > diff --git a/a b/a |
|
1259 | > diff --git a/a b/a | |
1260 | > new file mode 100644 |
|
1260 | > new file mode 100644 | |
1261 | > --- /dev/null |
|
1261 | > --- /dev/null | |
1262 | > +++ b/a |
|
1262 | > +++ b/a | |
1263 | > @@ -0,0 +1,1 @@ |
|
1263 | > @@ -0,0 +1,1 @@ | |
1264 | > +a |
|
1264 | > +a | |
1265 | > EOF |
|
1265 | > EOF | |
1266 | > hg import -d '0 0' a.patch |
|
1266 | > hg import -d '0 0' a.patch | |
1267 | > hg parents -v |
|
1267 | > hg parents -v | |
1268 | > cd .. |
|
1268 | > cd .. | |
1269 | > |
|
1269 | > | |
1270 | > echo '% tricky header splitting' |
|
1270 | > echo '% tricky header splitting' | |
1271 | > cat > trickyheaders.patch <<EOF |
|
1271 | > cat > trickyheaders.patch <<EOF | |
1272 | > From: User A <user@a> |
|
1272 | > From: User A <user@a> | |
1273 | > Subject: [PATCH] from: tricky! |
|
1273 | > Subject: [PATCH] from: tricky! | |
1274 | > |
|
1274 | > | |
1275 | > # HG changeset patch |
|
1275 | > # HG changeset patch | |
1276 | > # User User B |
|
1276 | > # User User B | |
1277 | > # Date 1266264441 18000 |
|
1277 | > # Date 1266264441 18000 | |
1278 | > # Branch stable |
|
1278 | > # Branch stable | |
1279 | > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 |
|
1279 | > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 | |
1280 | > # Parent 0000000000000000000000000000000000000000 |
|
1280 | > # Parent 0000000000000000000000000000000000000000 | |
1281 | > from: tricky! |
|
1281 | > from: tricky! | |
1282 | > |
|
1282 | > | |
1283 | > That is not a header. |
|
1283 | > That is not a header. | |
1284 | > |
|
1284 | > | |
1285 | > diff -r 000000000000 -r f2be6a1170ac foo |
|
1285 | > diff -r 000000000000 -r f2be6a1170ac foo | |
1286 | > --- /dev/null |
|
1286 | > --- /dev/null | |
1287 | > +++ b/foo |
|
1287 | > +++ b/foo | |
1288 | > @@ -0,0 +1,1 @@ |
|
1288 | > @@ -0,0 +1,1 @@ | |
1289 | > +foo |
|
1289 | > +foo | |
1290 | > EOF |
|
1290 | > EOF | |
1291 | applying a.patch |
|
1291 | applying a.patch | |
1292 | changeset: 0:f34d9187897d |
|
1292 | changeset: 0:f34d9187897d | |
1293 | tag: tip |
|
1293 | tag: tip | |
1294 | user: test |
|
1294 | user: test | |
1295 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1295 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1296 | files: a |
|
1296 | files: a | |
1297 | description: |
|
1297 | description: | |
1298 | module: summary |
|
1298 | module: summary | |
1299 |
|
1299 | |||
1300 |
|
1300 | |||
1301 | % tricky header splitting |
|
1301 | % tricky header splitting | |
1302 |
|
1302 | |||
1303 | $ hg init trickyheaders |
|
1303 | $ hg init trickyheaders | |
1304 | $ cd trickyheaders |
|
1304 | $ cd trickyheaders | |
1305 | $ hg import -d '0 0' ../trickyheaders.patch |
|
1305 | $ hg import -d '0 0' ../trickyheaders.patch | |
1306 | applying ../trickyheaders.patch |
|
1306 | applying ../trickyheaders.patch | |
1307 | $ hg export --git tip |
|
1307 | $ hg export --git tip | |
1308 | # HG changeset patch |
|
1308 | # HG changeset patch | |
1309 | # User User B |
|
1309 | # User User B | |
1310 | # Date 0 0 |
|
1310 | # Date 0 0 | |
1311 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1311 | # Thu Jan 01 00:00:00 1970 +0000 | |
1312 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 |
|
1312 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 | |
1313 | # Parent 0000000000000000000000000000000000000000 |
|
1313 | # Parent 0000000000000000000000000000000000000000 | |
1314 | from: tricky! |
|
1314 | from: tricky! | |
1315 |
|
1315 | |||
1316 | That is not a header. |
|
1316 | That is not a header. | |
1317 |
|
1317 | |||
1318 | diff --git a/foo b/foo |
|
1318 | diff --git a/foo b/foo | |
1319 | new file mode 100644 |
|
1319 | new file mode 100644 | |
1320 | --- /dev/null |
|
1320 | --- /dev/null | |
1321 | +++ b/foo |
|
1321 | +++ b/foo | |
1322 | @@ -0,0 +1,1 @@ |
|
1322 | @@ -0,0 +1,1 @@ | |
1323 | +foo |
|
1323 | +foo | |
1324 | $ cd .. |
|
1324 | $ cd .. | |
1325 |
|
1325 | |||
1326 |
|
1326 | |||
1327 | Issue2102: hg export and hg import speak different languages |
|
1327 | Issue2102: hg export and hg import speak different languages | |
1328 |
|
1328 | |||
1329 | $ hg init issue2102 |
|
1329 | $ hg init issue2102 | |
1330 | $ cd issue2102 |
|
1330 | $ cd issue2102 | |
1331 | $ mkdir -p src/cmd/gc |
|
1331 | $ mkdir -p src/cmd/gc | |
1332 | $ touch src/cmd/gc/mksys.bash |
|
1332 | $ touch src/cmd/gc/mksys.bash | |
1333 | $ hg ci -Am init |
|
1333 | $ hg ci -Am init | |
1334 | adding src/cmd/gc/mksys.bash |
|
1334 | adding src/cmd/gc/mksys.bash | |
1335 | $ hg import - <<EOF |
|
1335 | $ hg import - <<EOF | |
1336 | > # HG changeset patch |
|
1336 | > # HG changeset patch | |
1337 | > # User Rob Pike |
|
1337 | > # User Rob Pike | |
1338 | > # Date 1216685449 25200 |
|
1338 | > # Date 1216685449 25200 | |
1339 | > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 |
|
1339 | > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 | |
1340 | > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 |
|
1340 | > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 | |
1341 | > help management of empty pkg and lib directories in perforce |
|
1341 | > help management of empty pkg and lib directories in perforce | |
1342 | > |
|
1342 | > | |
1343 | > R=gri |
|
1343 | > R=gri | |
1344 | > DELTA=4 (4 added, 0 deleted, 0 changed) |
|
1344 | > DELTA=4 (4 added, 0 deleted, 0 changed) | |
1345 | > OCL=13328 |
|
1345 | > OCL=13328 | |
1346 | > CL=13328 |
|
1346 | > CL=13328 | |
1347 | > |
|
1347 | > | |
1348 | > diff --git a/lib/place-holder b/lib/place-holder |
|
1348 | > diff --git a/lib/place-holder b/lib/place-holder | |
1349 | > new file mode 100644 |
|
1349 | > new file mode 100644 | |
1350 | > --- /dev/null |
|
1350 | > --- /dev/null | |
1351 | > +++ b/lib/place-holder |
|
1351 | > +++ b/lib/place-holder | |
1352 | > @@ -0,0 +1,2 @@ |
|
1352 | > @@ -0,0 +1,2 @@ | |
1353 | > +perforce does not maintain empty directories. |
|
1353 | > +perforce does not maintain empty directories. | |
1354 | > +this file helps. |
|
1354 | > +this file helps. | |
1355 | > diff --git a/pkg/place-holder b/pkg/place-holder |
|
1355 | > diff --git a/pkg/place-holder b/pkg/place-holder | |
1356 | > new file mode 100644 |
|
1356 | > new file mode 100644 | |
1357 | > --- /dev/null |
|
1357 | > --- /dev/null | |
1358 | > +++ b/pkg/place-holder |
|
1358 | > +++ b/pkg/place-holder | |
1359 | > @@ -0,0 +1,2 @@ |
|
1359 | > @@ -0,0 +1,2 @@ | |
1360 | > +perforce does not maintain empty directories. |
|
1360 | > +perforce does not maintain empty directories. | |
1361 | > +this file helps. |
|
1361 | > +this file helps. | |
1362 | > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
1362 | > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash | |
1363 | > old mode 100644 |
|
1363 | > old mode 100644 | |
1364 | > new mode 100755 |
|
1364 | > new mode 100755 | |
1365 | > EOF |
|
1365 | > EOF | |
1366 | applying patch from stdin |
|
1366 | applying patch from stdin | |
1367 |
|
1367 | |||
1368 | #if execbit |
|
1368 | #if execbit | |
1369 |
|
1369 | |||
1370 | $ hg sum |
|
1370 | $ hg sum | |
1371 | parent: 1:d59915696727 tip |
|
1371 | parent: 1:d59915696727 tip | |
1372 | help management of empty pkg and lib directories in perforce |
|
1372 | help management of empty pkg and lib directories in perforce | |
1373 | branch: default |
|
1373 | branch: default | |
1374 | commit: (clean) |
|
1374 | commit: (clean) | |
1375 | update: (current) |
|
1375 | update: (current) | |
1376 | phases: 2 draft |
|
1376 | phases: 2 draft | |
1377 |
|
1377 | |||
1378 | $ hg diff --git -c tip |
|
1378 | $ hg diff --git -c tip | |
1379 | diff --git a/lib/place-holder b/lib/place-holder |
|
1379 | diff --git a/lib/place-holder b/lib/place-holder | |
1380 | new file mode 100644 |
|
1380 | new file mode 100644 | |
1381 | --- /dev/null |
|
1381 | --- /dev/null | |
1382 | +++ b/lib/place-holder |
|
1382 | +++ b/lib/place-holder | |
1383 | @@ -0,0 +1,2 @@ |
|
1383 | @@ -0,0 +1,2 @@ | |
1384 | +perforce does not maintain empty directories. |
|
1384 | +perforce does not maintain empty directories. | |
1385 | +this file helps. |
|
1385 | +this file helps. | |
1386 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
1386 | diff --git a/pkg/place-holder b/pkg/place-holder | |
1387 | new file mode 100644 |
|
1387 | new file mode 100644 | |
1388 | --- /dev/null |
|
1388 | --- /dev/null | |
1389 | +++ b/pkg/place-holder |
|
1389 | +++ b/pkg/place-holder | |
1390 | @@ -0,0 +1,2 @@ |
|
1390 | @@ -0,0 +1,2 @@ | |
1391 | +perforce does not maintain empty directories. |
|
1391 | +perforce does not maintain empty directories. | |
1392 | +this file helps. |
|
1392 | +this file helps. | |
1393 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
1393 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash | |
1394 | old mode 100644 |
|
1394 | old mode 100644 | |
1395 | new mode 100755 |
|
1395 | new mode 100755 | |
1396 |
|
1396 | |||
1397 | #else |
|
1397 | #else | |
1398 |
|
1398 | |||
1399 | $ hg sum |
|
1399 | $ hg sum | |
1400 | parent: 1:28f089cc9ccc tip |
|
1400 | parent: 1:28f089cc9ccc tip | |
1401 | help management of empty pkg and lib directories in perforce |
|
1401 | help management of empty pkg and lib directories in perforce | |
1402 | branch: default |
|
1402 | branch: default | |
1403 | commit: (clean) |
|
1403 | commit: (clean) | |
1404 | update: (current) |
|
1404 | update: (current) | |
1405 | phases: 2 draft |
|
1405 | phases: 2 draft | |
1406 |
|
1406 | |||
1407 | $ hg diff --git -c tip |
|
1407 | $ hg diff --git -c tip | |
1408 | diff --git a/lib/place-holder b/lib/place-holder |
|
1408 | diff --git a/lib/place-holder b/lib/place-holder | |
1409 | new file mode 100644 |
|
1409 | new file mode 100644 | |
1410 | --- /dev/null |
|
1410 | --- /dev/null | |
1411 | +++ b/lib/place-holder |
|
1411 | +++ b/lib/place-holder | |
1412 | @@ -0,0 +1,2 @@ |
|
1412 | @@ -0,0 +1,2 @@ | |
1413 | +perforce does not maintain empty directories. |
|
1413 | +perforce does not maintain empty directories. | |
1414 | +this file helps. |
|
1414 | +this file helps. | |
1415 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
1415 | diff --git a/pkg/place-holder b/pkg/place-holder | |
1416 | new file mode 100644 |
|
1416 | new file mode 100644 | |
1417 | --- /dev/null |
|
1417 | --- /dev/null | |
1418 | +++ b/pkg/place-holder |
|
1418 | +++ b/pkg/place-holder | |
1419 | @@ -0,0 +1,2 @@ |
|
1419 | @@ -0,0 +1,2 @@ | |
1420 | +perforce does not maintain empty directories. |
|
1420 | +perforce does not maintain empty directories. | |
1421 | +this file helps. |
|
1421 | +this file helps. | |
1422 |
|
1422 | |||
1423 | /* The mode change for mksys.bash is missing here, because on platforms */ |
|
1423 | /* The mode change for mksys.bash is missing here, because on platforms */ | |
1424 | /* that don't support execbits, mode changes in patches are ignored when */ |
|
1424 | /* that don't support execbits, mode changes in patches are ignored when */ | |
1425 | /* they are imported. This is obviously also the reason for why the hash */ |
|
1425 | /* they are imported. This is obviously also the reason for why the hash */ | |
1426 | /* in the created changeset is different to the one you see above the */ |
|
1426 | /* in the created changeset is different to the one you see above the */ | |
1427 | /* #else clause */ |
|
1427 | /* #else clause */ | |
1428 |
|
1428 | |||
1429 | #endif |
|
1429 | #endif | |
1430 | $ cd .. |
|
1430 | $ cd .. | |
1431 |
|
1431 | |||
1432 |
|
1432 | |||
1433 | diff lines looking like headers |
|
1433 | diff lines looking like headers | |
1434 |
|
1434 | |||
1435 | $ hg init difflineslikeheaders |
|
1435 | $ hg init difflineslikeheaders | |
1436 | $ cd difflineslikeheaders |
|
1436 | $ cd difflineslikeheaders | |
1437 | $ echo a >a |
|
1437 | $ echo a >a | |
1438 | $ echo b >b |
|
1438 | $ echo b >b | |
1439 | $ echo c >c |
|
1439 | $ echo c >c | |
1440 | $ hg ci -Am1 |
|
1440 | $ hg ci -Am1 | |
1441 | adding a |
|
1441 | adding a | |
1442 | adding b |
|
1442 | adding b | |
1443 | adding c |
|
1443 | adding c | |
1444 |
|
1444 | |||
1445 | $ echo "key: value" >>a |
|
1445 | $ echo "key: value" >>a | |
1446 | $ echo "key: value" >>b |
|
1446 | $ echo "key: value" >>b | |
1447 | $ echo "foo" >>c |
|
1447 | $ echo "foo" >>c | |
1448 | $ hg ci -m2 |
|
1448 | $ hg ci -m2 | |
1449 |
|
1449 | |||
1450 | $ hg up -C 0 |
|
1450 | $ hg up -C 0 | |
1451 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1451 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1452 | $ hg diff --git -c1 >want |
|
1452 | $ hg diff --git -c1 >want | |
1453 | $ hg diff -c1 | hg import --no-commit - |
|
1453 | $ hg diff -c1 | hg import --no-commit - | |
1454 | applying patch from stdin |
|
1454 | applying patch from stdin | |
1455 | $ hg diff --git >have |
|
1455 | $ hg diff --git >have | |
1456 | $ diff want have |
|
1456 | $ diff want have | |
1457 | $ cd .. |
|
1457 | $ cd .. | |
1458 |
|
1458 | |||
1459 | import a unified diff with no lines of context (diff -U0) |
|
1459 | import a unified diff with no lines of context (diff -U0) | |
1460 |
|
1460 | |||
1461 | $ hg init diffzero |
|
1461 | $ hg init diffzero | |
1462 | $ cd diffzero |
|
1462 | $ cd diffzero | |
1463 | $ cat > f << EOF |
|
1463 | $ cat > f << EOF | |
1464 | > c2 |
|
1464 | > c2 | |
1465 | > c4 |
|
1465 | > c4 | |
1466 | > c5 |
|
1466 | > c5 | |
1467 | > EOF |
|
1467 | > EOF | |
1468 | $ hg commit -Am0 |
|
1468 | $ hg commit -Am0 | |
1469 | adding f |
|
1469 | adding f | |
1470 |
|
1470 | |||
1471 | $ hg import --no-commit - << EOF |
|
1471 | $ hg import --no-commit - << EOF | |
1472 | > # HG changeset patch |
|
1472 | > # HG changeset patch | |
1473 | > # User test |
|
1473 | > # User test | |
1474 | > # Date 0 0 |
|
1474 | > # Date 0 0 | |
1475 | > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c |
|
1475 | > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c | |
1476 | > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794 |
|
1476 | > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794 | |
1477 | > 1 |
|
1477 | > 1 | |
1478 | > diff -r 8679a12a975b -r f4974ab632f3 f |
|
1478 | > diff -r 8679a12a975b -r f4974ab632f3 f | |
1479 | > --- a/f Thu Jan 01 00:00:00 1970 +0000 |
|
1479 | > --- a/f Thu Jan 01 00:00:00 1970 +0000 | |
1480 | > +++ b/f Thu Jan 01 00:00:00 1970 +0000 |
|
1480 | > +++ b/f Thu Jan 01 00:00:00 1970 +0000 | |
1481 | > @@ -0,0 +1,1 @@ |
|
1481 | > @@ -0,0 +1,1 @@ | |
1482 | > +c1 |
|
1482 | > +c1 | |
1483 | > @@ -1,0 +3,1 @@ |
|
1483 | > @@ -1,0 +3,1 @@ | |
1484 | > +c3 |
|
1484 | > +c3 | |
1485 | > @@ -3,1 +4,0 @@ |
|
1485 | > @@ -3,1 +4,0 @@ | |
1486 | > -c5 |
|
1486 | > -c5 | |
1487 | > EOF |
|
1487 | > EOF | |
1488 | applying patch from stdin |
|
1488 | applying patch from stdin | |
1489 |
|
1489 | |||
1490 | $ cat f |
|
1490 | $ cat f | |
1491 | c1 |
|
1491 | c1 | |
1492 | c2 |
|
1492 | c2 | |
1493 | c3 |
|
1493 | c3 | |
1494 | c4 |
|
1494 | c4 | |
1495 |
|
1495 | |||
1496 | $ cd .. |
|
1496 | $ cd .. | |
1497 |
|
1497 | |||
1498 | commit message that looks like a diff header (issue1879) |
|
1498 | commit message that looks like a diff header (issue1879) | |
1499 |
|
1499 | |||
1500 | $ hg init headerlikemsg |
|
1500 | $ hg init headerlikemsg | |
1501 | $ cd headerlikemsg |
|
1501 | $ cd headerlikemsg | |
1502 | $ touch empty |
|
1502 | $ touch empty | |
1503 | $ echo nonempty >> nonempty |
|
1503 | $ echo nonempty >> nonempty | |
1504 | $ hg ci -qAl - <<EOF |
|
1504 | $ hg ci -qAl - <<EOF | |
1505 | > blah blah |
|
1505 | > blah blah | |
1506 | > diff blah |
|
1506 | > diff blah | |
1507 | > blah blah |
|
1507 | > blah blah | |
1508 | > EOF |
|
1508 | > EOF | |
1509 | $ hg --config diff.git=1 log -pv |
|
1509 | $ hg --config diff.git=1 log -pv | |
1510 | changeset: 0:c6ef204ef767 |
|
1510 | changeset: 0:c6ef204ef767 | |
1511 | tag: tip |
|
1511 | tag: tip | |
1512 | user: test |
|
1512 | user: test | |
1513 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1513 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1514 | files: empty nonempty |
|
1514 | files: empty nonempty | |
1515 | description: |
|
1515 | description: | |
1516 | blah blah |
|
1516 | blah blah | |
1517 | diff blah |
|
1517 | diff blah | |
1518 | blah blah |
|
1518 | blah blah | |
1519 |
|
1519 | |||
1520 |
|
1520 | |||
1521 | diff --git a/empty b/empty |
|
1521 | diff --git a/empty b/empty | |
1522 | new file mode 100644 |
|
1522 | new file mode 100644 | |
1523 | diff --git a/nonempty b/nonempty |
|
1523 | diff --git a/nonempty b/nonempty | |
1524 | new file mode 100644 |
|
1524 | new file mode 100644 | |
1525 | --- /dev/null |
|
1525 | --- /dev/null | |
1526 | +++ b/nonempty |
|
1526 | +++ b/nonempty | |
1527 | @@ -0,0 +1,1 @@ |
|
1527 | @@ -0,0 +1,1 @@ | |
1528 | +nonempty |
|
1528 | +nonempty | |
1529 |
|
1529 | |||
1530 |
|
1530 | |||
1531 | (without --git, empty file is lost, but commit message should be preserved) |
|
1531 | (without --git, empty file is lost, but commit message should be preserved) | |
1532 |
|
1532 | |||
1533 | $ hg init plain |
|
1533 | $ hg init plain | |
1534 | $ hg export 0 | hg -R plain import - |
|
1534 | $ hg export 0 | hg -R plain import - | |
1535 | applying patch from stdin |
|
1535 | applying patch from stdin | |
1536 | $ hg --config diff.git=1 -R plain log -pv |
|
1536 | $ hg --config diff.git=1 -R plain log -pv | |
1537 | changeset: 0:60a2d231e71f |
|
1537 | changeset: 0:60a2d231e71f | |
1538 | tag: tip |
|
1538 | tag: tip | |
1539 | user: test |
|
1539 | user: test | |
1540 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1540 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1541 | files: nonempty |
|
1541 | files: nonempty | |
1542 | description: |
|
1542 | description: | |
1543 | blah blah |
|
1543 | blah blah | |
1544 | diff blah |
|
1544 | diff blah | |
1545 | blah blah |
|
1545 | blah blah | |
1546 |
|
1546 | |||
1547 |
|
1547 | |||
1548 | diff --git a/nonempty b/nonempty |
|
1548 | diff --git a/nonempty b/nonempty | |
1549 | new file mode 100644 |
|
1549 | new file mode 100644 | |
1550 | --- /dev/null |
|
1550 | --- /dev/null | |
1551 | +++ b/nonempty |
|
1551 | +++ b/nonempty | |
1552 | @@ -0,0 +1,1 @@ |
|
1552 | @@ -0,0 +1,1 @@ | |
1553 | +nonempty |
|
1553 | +nonempty | |
1554 |
|
1554 | |||
1555 |
|
1555 | |||
1556 | (with --git, patch contents should be fully preserved) |
|
1556 | (with --git, patch contents should be fully preserved) | |
1557 |
|
1557 | |||
1558 | $ hg init git |
|
1558 | $ hg init git | |
1559 | $ hg --config diff.git=1 export 0 | hg -R git import - |
|
1559 | $ hg --config diff.git=1 export 0 | hg -R git import - | |
1560 | applying patch from stdin |
|
1560 | applying patch from stdin | |
1561 | $ hg --config diff.git=1 -R git log -pv |
|
1561 | $ hg --config diff.git=1 -R git log -pv | |
1562 | changeset: 0:c6ef204ef767 |
|
1562 | changeset: 0:c6ef204ef767 | |
1563 | tag: tip |
|
1563 | tag: tip | |
1564 | user: test |
|
1564 | user: test | |
1565 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1565 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1566 | files: empty nonempty |
|
1566 | files: empty nonempty | |
1567 | description: |
|
1567 | description: | |
1568 | blah blah |
|
1568 | blah blah | |
1569 | diff blah |
|
1569 | diff blah | |
1570 | blah blah |
|
1570 | blah blah | |
1571 |
|
1571 | |||
1572 |
|
1572 | |||
1573 | diff --git a/empty b/empty |
|
1573 | diff --git a/empty b/empty | |
1574 | new file mode 100644 |
|
1574 | new file mode 100644 | |
1575 | diff --git a/nonempty b/nonempty |
|
1575 | diff --git a/nonempty b/nonempty | |
1576 | new file mode 100644 |
|
1576 | new file mode 100644 | |
1577 | --- /dev/null |
|
1577 | --- /dev/null | |
1578 | +++ b/nonempty |
|
1578 | +++ b/nonempty | |
1579 | @@ -0,0 +1,1 @@ |
|
1579 | @@ -0,0 +1,1 @@ | |
1580 | +nonempty |
|
1580 | +nonempty | |
1581 |
|
1581 | |||
1582 |
|
1582 | |||
1583 | $ cd .. |
|
1583 | $ cd .. | |
1584 |
|
1584 | |||
1585 | no segfault while importing a unified diff which start line is zero but chunk |
|
1585 | no segfault while importing a unified diff which start line is zero but chunk | |
1586 | size is non-zero |
|
1586 | size is non-zero | |
1587 |
|
1587 | |||
1588 | $ hg init startlinezero |
|
1588 | $ hg init startlinezero | |
1589 | $ cd startlinezero |
|
1589 | $ cd startlinezero | |
1590 | $ echo foo > foo |
|
1590 | $ echo foo > foo | |
1591 | $ hg commit -Amfoo |
|
1591 | $ hg commit -Amfoo | |
1592 | adding foo |
|
1592 | adding foo | |
1593 |
|
1593 | |||
1594 | $ hg import --no-commit - << EOF |
|
1594 | $ hg import --no-commit - << EOF | |
1595 | > diff a/foo b/foo |
|
1595 | > diff a/foo b/foo | |
1596 | > --- a/foo |
|
1596 | > --- a/foo | |
1597 | > +++ b/foo |
|
1597 | > +++ b/foo | |
1598 | > @@ -0,1 +0,1 @@ |
|
1598 | > @@ -0,1 +0,1 @@ | |
1599 | > foo |
|
1599 | > foo | |
1600 | > EOF |
|
1600 | > EOF | |
1601 | applying patch from stdin |
|
1601 | applying patch from stdin | |
1602 |
|
1602 | |||
1603 | $ cd .. |
|
1603 | $ cd .. | |
1604 |
|
1604 | |||
1605 | Test corner case involving fuzz and skew |
|
1605 | Test corner case involving fuzz and skew | |
1606 |
|
1606 | |||
1607 | $ hg init morecornercases |
|
1607 | $ hg init morecornercases | |
1608 | $ cd morecornercases |
|
1608 | $ cd morecornercases | |
1609 |
|
1609 | |||
1610 | $ cat > 01-no-context-beginning-of-file.diff <<EOF |
|
1610 | $ cat > 01-no-context-beginning-of-file.diff <<EOF | |
1611 | > diff --git a/a b/a |
|
1611 | > diff --git a/a b/a | |
1612 | > --- a/a |
|
1612 | > --- a/a | |
1613 | > +++ b/a |
|
1613 | > +++ b/a | |
1614 | > @@ -1,0 +1,1 @@ |
|
1614 | > @@ -1,0 +1,1 @@ | |
1615 | > +line |
|
1615 | > +line | |
1616 | > EOF |
|
1616 | > EOF | |
1617 |
|
1617 | |||
1618 | $ cat > 02-no-context-middle-of-file.diff <<EOF |
|
1618 | $ cat > 02-no-context-middle-of-file.diff <<EOF | |
1619 | > diff --git a/a b/a |
|
1619 | > diff --git a/a b/a | |
1620 | > --- a/a |
|
1620 | > --- a/a | |
1621 | > +++ b/a |
|
1621 | > +++ b/a | |
1622 | > @@ -1,1 +1,1 @@ |
|
1622 | > @@ -1,1 +1,1 @@ | |
1623 | > -2 |
|
1623 | > -2 | |
1624 | > +add some skew |
|
1624 | > +add some skew | |
1625 | > @@ -2,0 +2,1 @@ |
|
1625 | > @@ -2,0 +2,1 @@ | |
1626 | > +line |
|
1626 | > +line | |
1627 | > EOF |
|
1627 | > EOF | |
1628 |
|
1628 | |||
1629 | $ cat > 03-no-context-end-of-file.diff <<EOF |
|
1629 | $ cat > 03-no-context-end-of-file.diff <<EOF | |
1630 | > diff --git a/a b/a |
|
1630 | > diff --git a/a b/a | |
1631 | > --- a/a |
|
1631 | > --- a/a | |
1632 | > +++ b/a |
|
1632 | > +++ b/a | |
1633 | > @@ -10,0 +10,1 @@ |
|
1633 | > @@ -10,0 +10,1 @@ | |
1634 | > +line |
|
1634 | > +line | |
1635 | > EOF |
|
1635 | > EOF | |
1636 |
|
1636 | |||
1637 | $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF |
|
1637 | $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF | |
1638 | > diff --git a/a b/a |
|
1638 | > diff --git a/a b/a | |
1639 | > --- a/a |
|
1639 | > --- a/a | |
1640 | > +++ b/a |
|
1640 | > +++ b/a | |
1641 | > @@ -1,1 +1,1 @@ |
|
1641 | > @@ -1,1 +1,1 @@ | |
1642 | > -2 |
|
1642 | > -2 | |
1643 | > +add some skew |
|
1643 | > +add some skew | |
1644 | > @@ -2,2 +2,3 @@ |
|
1644 | > @@ -2,2 +2,3 @@ | |
1645 | > not matching, should fuzz |
|
1645 | > not matching, should fuzz | |
1646 | > ... a bit |
|
1646 | > ... a bit | |
1647 | > +line |
|
1647 | > +line | |
1648 | > EOF |
|
1648 | > EOF | |
1649 |
|
1649 | |||
1650 | $ cat > a <<EOF |
|
1650 | $ cat > a <<EOF | |
1651 | > 1 |
|
1651 | > 1 | |
1652 | > 2 |
|
1652 | > 2 | |
1653 | > 3 |
|
1653 | > 3 | |
1654 | > 4 |
|
1654 | > 4 | |
1655 | > EOF |
|
1655 | > EOF | |
1656 | $ hg ci -Am adda a |
|
1656 | $ hg ci -Am adda a | |
1657 | $ for p in *.diff; do |
|
1657 | $ for p in *.diff; do | |
1658 | > hg import -v --no-commit $p |
|
1658 | > hg import -v --no-commit $p | |
1659 | > cat a |
|
1659 | > cat a | |
1660 | > hg revert -aqC a |
|
1660 | > hg revert -aqC a | |
1661 | > # patch -p1 < $p |
|
1661 | > # patch -p1 < $p | |
1662 | > # cat a |
|
1662 | > # cat a | |
1663 | > # hg revert -aC a |
|
1663 | > # hg revert -aC a | |
1664 | > done |
|
1664 | > done | |
1665 | applying 01-no-context-beginning-of-file.diff |
|
1665 | applying 01-no-context-beginning-of-file.diff | |
1666 | patching file a |
|
1666 | patching file a | |
1667 | applied to working directory |
|
1667 | applied to working directory | |
1668 | 1 |
|
1668 | 1 | |
1669 | line |
|
1669 | line | |
1670 | 2 |
|
1670 | 2 | |
1671 | 3 |
|
1671 | 3 | |
1672 | 4 |
|
1672 | 4 | |
1673 | applying 02-no-context-middle-of-file.diff |
|
1673 | applying 02-no-context-middle-of-file.diff | |
1674 | patching file a |
|
1674 | patching file a | |
1675 | Hunk #1 succeeded at 2 (offset 1 lines). |
|
1675 | Hunk #1 succeeded at 2 (offset 1 lines). | |
1676 | Hunk #2 succeeded at 4 (offset 1 lines). |
|
1676 | Hunk #2 succeeded at 4 (offset 1 lines). | |
1677 | applied to working directory |
|
1677 | applied to working directory | |
1678 | 1 |
|
1678 | 1 | |
1679 | add some skew |
|
1679 | add some skew | |
1680 | 3 |
|
1680 | 3 | |
1681 | line |
|
1681 | line | |
1682 | 4 |
|
1682 | 4 | |
1683 | applying 03-no-context-end-of-file.diff |
|
1683 | applying 03-no-context-end-of-file.diff | |
1684 | patching file a |
|
1684 | patching file a | |
1685 | Hunk #1 succeeded at 5 (offset -6 lines). |
|
1685 | Hunk #1 succeeded at 5 (offset -6 lines). | |
1686 | applied to working directory |
|
1686 | applied to working directory | |
1687 | 1 |
|
1687 | 1 | |
1688 | 2 |
|
1688 | 2 | |
1689 | 3 |
|
1689 | 3 | |
1690 | 4 |
|
1690 | 4 | |
1691 | line |
|
1691 | line | |
1692 | applying 04-middle-of-file-completely-fuzzed.diff |
|
1692 | applying 04-middle-of-file-completely-fuzzed.diff | |
1693 | patching file a |
|
1693 | patching file a | |
1694 | Hunk #1 succeeded at 2 (offset 1 lines). |
|
1694 | Hunk #1 succeeded at 2 (offset 1 lines). | |
1695 | Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines). |
|
1695 | Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines). | |
1696 | applied to working directory |
|
1696 | applied to working directory | |
1697 | 1 |
|
1697 | 1 | |
1698 | add some skew |
|
1698 | add some skew | |
1699 | 3 |
|
1699 | 3 | |
1700 | 4 |
|
1700 | 4 | |
1701 | line |
|
1701 | line | |
1702 | $ cd .. |
|
1702 | $ cd .. | |
1703 |
|
1703 | |||
1704 | Test partial application |
|
1704 | Test partial application | |
1705 | ------------------------ |
|
1705 | ------------------------ | |
1706 |
|
1706 | |||
1707 | prepare a stack of patches depending on each other |
|
1707 | prepare a stack of patches depending on each other | |
1708 |
|
1708 | |||
1709 | $ hg init partial |
|
1709 | $ hg init partial | |
1710 | $ cd partial |
|
1710 | $ cd partial | |
1711 | $ cat << EOF > a |
|
1711 | $ cat << EOF > a | |
1712 | > one |
|
1712 | > one | |
1713 | > two |
|
1713 | > two | |
1714 | > three |
|
1714 | > three | |
1715 | > four |
|
1715 | > four | |
1716 | > five |
|
1716 | > five | |
1717 | > six |
|
1717 | > six | |
1718 | > seven |
|
1718 | > seven | |
1719 | > EOF |
|
1719 | > EOF | |
1720 | $ hg add a |
|
1720 | $ hg add a | |
1721 | $ echo 'b' > b |
|
1721 | $ echo 'b' > b | |
1722 | $ hg add b |
|
1722 | $ hg add b | |
1723 | $ hg commit -m 'initial' -u Babar |
|
1723 | $ hg commit -m 'initial' -u Babar | |
1724 | $ cat << EOF > a |
|
1724 | $ cat << EOF > a | |
1725 | > one |
|
1725 | > one | |
1726 | > two |
|
1726 | > two | |
1727 | > 3 |
|
1727 | > 3 | |
1728 | > four |
|
1728 | > four | |
1729 | > five |
|
1729 | > five | |
1730 | > six |
|
1730 | > six | |
1731 | > seven |
|
1731 | > seven | |
1732 | > EOF |
|
1732 | > EOF | |
1733 | $ hg commit -m 'three' -u Celeste |
|
1733 | $ hg commit -m 'three' -u Celeste | |
1734 | $ cat << EOF > a |
|
1734 | $ cat << EOF > a | |
1735 | > one |
|
1735 | > one | |
1736 | > two |
|
1736 | > two | |
1737 | > 3 |
|
1737 | > 3 | |
1738 | > 4 |
|
1738 | > 4 | |
1739 | > five |
|
1739 | > five | |
1740 | > six |
|
1740 | > six | |
1741 | > seven |
|
1741 | > seven | |
1742 | > EOF |
|
1742 | > EOF | |
1743 | $ hg commit -m 'four' -u Rataxes |
|
1743 | $ hg commit -m 'four' -u Rataxes | |
1744 | $ cat << EOF > a |
|
1744 | $ cat << EOF > a | |
1745 | > one |
|
1745 | > one | |
1746 | > two |
|
1746 | > two | |
1747 | > 3 |
|
1747 | > 3 | |
1748 | > 4 |
|
1748 | > 4 | |
1749 | > 5 |
|
1749 | > 5 | |
1750 | > six |
|
1750 | > six | |
1751 | > seven |
|
1751 | > seven | |
1752 | > EOF |
|
1752 | > EOF | |
1753 | $ echo bb >> b |
|
1753 | $ echo bb >> b | |
1754 | $ hg commit -m 'five' -u Arthur |
|
1754 | $ hg commit -m 'five' -u Arthur | |
1755 | $ echo 'Babar' > jungle |
|
1755 | $ echo 'Babar' > jungle | |
1756 | $ hg add jungle |
|
1756 | $ hg add jungle | |
1757 | $ hg ci -m 'jungle' -u Zephir |
|
1757 | $ hg ci -m 'jungle' -u Zephir | |
1758 | $ echo 'Celeste' >> jungle |
|
1758 | $ echo 'Celeste' >> jungle | |
1759 | $ hg ci -m 'extended jungle' -u Cornelius |
|
1759 | $ hg ci -m 'extended jungle' -u Cornelius | |
1760 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1760 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' | |
1761 | @ extended jungle [Cornelius] 1: +1/-0 |
|
1761 | @ extended jungle [Cornelius] 1: +1/-0 | |
1762 | | |
|
1762 | | | |
1763 | o jungle [Zephir] 1: +1/-0 |
|
1763 | o jungle [Zephir] 1: +1/-0 | |
1764 | | |
|
1764 | | | |
1765 | o five [Arthur] 2: +2/-1 |
|
1765 | o five [Arthur] 2: +2/-1 | |
1766 | | |
|
1766 | | | |
1767 | o four [Rataxes] 1: +1/-1 |
|
1767 | o four [Rataxes] 1: +1/-1 | |
1768 | | |
|
1768 | | | |
1769 | o three [Celeste] 1: +1/-1 |
|
1769 | o three [Celeste] 1: +1/-1 | |
1770 | | |
|
1770 | | | |
1771 | o initial [Babar] 2: +8/-0 |
|
1771 | o initial [Babar] 2: +8/-0 | |
1772 |
|
1772 | |||
1773 | Adding those config options should not change the output of diffstat. Bugfix #4755. |
|
1773 | Adding those config options should not change the output of diffstat. Bugfix #4755. | |
1774 |
|
1774 | |||
1775 | $ hg log -r . --template '{diffstat}\n' |
|
1775 | $ hg log -r . --template '{diffstat}\n' | |
1776 | 1: +1/-0 |
|
1776 | 1: +1/-0 | |
1777 | $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \ |
|
1777 | $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \ | |
1778 | > --config diff.noprefix=1 |
|
1778 | > --config diff.noprefix=1 | |
1779 | 1: +1/-0 |
|
1779 | 1: +1/-0 | |
1780 |
|
1780 | |||
1781 | Importing with some success and some errors: |
|
1781 | Importing with some success and some errors: | |
1782 |
|
1782 | |||
1783 | $ hg update --rev 'desc(initial)' |
|
1783 | $ hg update --rev 'desc(initial)' | |
1784 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1784 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1785 | $ hg export --rev 'desc(five)' | hg import --partial - |
|
1785 | $ hg export --rev 'desc(five)' | hg import --partial - | |
1786 | applying patch from stdin |
|
1786 | applying patch from stdin | |
1787 | patching file a |
|
1787 | patching file a | |
1788 | Hunk #1 FAILED at 1 |
|
1788 | Hunk #1 FAILED at 1 | |
1789 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1789 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
1790 | patch applied partially |
|
1790 | patch applied partially | |
1791 | (fix the .rej files and run `hg commit --amend`) |
|
1791 | (fix the .rej files and run `hg commit --amend`) | |
1792 | [1] |
|
1792 | [1] | |
1793 |
|
1793 | |||
1794 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1794 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' | |
1795 | @ five [Arthur] 1: +1/-0 |
|
1795 | @ five [Arthur] 1: +1/-0 | |
1796 | | |
|
1796 | | | |
1797 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1797 | | o extended jungle [Cornelius] 1: +1/-0 | |
1798 | | | |
|
1798 | | | | |
1799 | | o jungle [Zephir] 1: +1/-0 |
|
1799 | | o jungle [Zephir] 1: +1/-0 | |
1800 | | | |
|
1800 | | | | |
1801 | | o five [Arthur] 2: +2/-1 |
|
1801 | | o five [Arthur] 2: +2/-1 | |
1802 | | | |
|
1802 | | | | |
1803 | | o four [Rataxes] 1: +1/-1 |
|
1803 | | o four [Rataxes] 1: +1/-1 | |
1804 | | | |
|
1804 | | | | |
1805 | | o three [Celeste] 1: +1/-1 |
|
1805 | | o three [Celeste] 1: +1/-1 | |
1806 | |/ |
|
1806 | |/ | |
1807 | o initial [Babar] 2: +8/-0 |
|
1807 | o initial [Babar] 2: +8/-0 | |
1808 |
|
1808 | |||
1809 | $ hg export |
|
1809 | $ hg export | |
1810 | # HG changeset patch |
|
1810 | # HG changeset patch | |
1811 | # User Arthur |
|
1811 | # User Arthur | |
1812 | # Date 0 0 |
|
1812 | # Date 0 0 | |
1813 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1813 | # Thu Jan 01 00:00:00 1970 +0000 | |
1814 | # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509 |
|
1814 | # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509 | |
1815 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1815 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e | |
1816 | five |
|
1816 | five | |
1817 |
|
1817 | |||
1818 | diff -r 8e4f0351909e -r 26e6446bb252 b |
|
1818 | diff -r 8e4f0351909e -r 26e6446bb252 b | |
1819 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
1819 | --- a/b Thu Jan 01 00:00:00 1970 +0000 | |
1820 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
1820 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
1821 | @@ -1,1 +1,2 @@ |
|
1821 | @@ -1,1 +1,2 @@ | |
1822 | b |
|
1822 | b | |
1823 | +bb |
|
1823 | +bb | |
1824 | $ hg status -c . |
|
1824 | $ hg status -c . | |
1825 | C a |
|
1825 | C a | |
1826 | C b |
|
1826 | C b | |
1827 | $ ls -A |
|
1827 | $ ls -A | |
1828 | .hg |
|
1828 | .hg | |
1829 | a |
|
1829 | a | |
1830 | a.rej |
|
1830 | a.rej | |
1831 | b |
|
1831 | b | |
1832 |
|
1832 | |||
1833 | Importing with zero success: |
|
1833 | Importing with zero success: | |
1834 |
|
1834 | |||
1835 | $ hg update --rev 'desc(initial)' |
|
1835 | $ hg update --rev 'desc(initial)' | |
1836 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1836 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1837 | $ hg export --rev 'desc(four)' | hg import --partial - |
|
1837 | $ hg export --rev 'desc(four)' | hg import --partial - | |
1838 | applying patch from stdin |
|
1838 | applying patch from stdin | |
1839 | patching file a |
|
1839 | patching file a | |
1840 | Hunk #1 FAILED at 0 |
|
1840 | Hunk #1 FAILED at 0 | |
1841 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1841 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
1842 | patch applied partially |
|
1842 | patch applied partially | |
1843 | (fix the .rej files and run `hg commit --amend`) |
|
1843 | (fix the .rej files and run `hg commit --amend`) | |
1844 | [1] |
|
1844 | [1] | |
1845 |
|
1845 | |||
1846 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1846 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' | |
1847 | @ four [Rataxes] 0: +0/-0 |
|
1847 | @ four [Rataxes] 0: +0/-0 | |
1848 | | |
|
1848 | | | |
1849 | | o five [Arthur] 1: +1/-0 |
|
1849 | | o five [Arthur] 1: +1/-0 | |
1850 | |/ |
|
1850 | |/ | |
1851 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1851 | | o extended jungle [Cornelius] 1: +1/-0 | |
1852 | | | |
|
1852 | | | | |
1853 | | o jungle [Zephir] 1: +1/-0 |
|
1853 | | o jungle [Zephir] 1: +1/-0 | |
1854 | | | |
|
1854 | | | | |
1855 | | o five [Arthur] 2: +2/-1 |
|
1855 | | o five [Arthur] 2: +2/-1 | |
1856 | | | |
|
1856 | | | | |
1857 | | o four [Rataxes] 1: +1/-1 |
|
1857 | | o four [Rataxes] 1: +1/-1 | |
1858 | | | |
|
1858 | | | | |
1859 | | o three [Celeste] 1: +1/-1 |
|
1859 | | o three [Celeste] 1: +1/-1 | |
1860 | |/ |
|
1860 | |/ | |
1861 | o initial [Babar] 2: +8/-0 |
|
1861 | o initial [Babar] 2: +8/-0 | |
1862 |
|
1862 | |||
1863 | $ hg export |
|
1863 | $ hg export | |
1864 | # HG changeset patch |
|
1864 | # HG changeset patch | |
1865 | # User Rataxes |
|
1865 | # User Rataxes | |
1866 | # Date 0 0 |
|
1866 | # Date 0 0 | |
1867 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1867 | # Thu Jan 01 00:00:00 1970 +0000 | |
1868 | # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e |
|
1868 | # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e | |
1869 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1869 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e | |
1870 | four |
|
1870 | four | |
1871 |
|
1871 | |||
1872 | $ hg status -c . |
|
1872 | $ hg status -c . | |
1873 | C a |
|
1873 | C a | |
1874 | C b |
|
1874 | C b | |
1875 | $ ls -A |
|
1875 | $ ls -A | |
1876 | .hg |
|
1876 | .hg | |
1877 | a |
|
1877 | a | |
1878 | a.rej |
|
1878 | a.rej | |
1879 | b |
|
1879 | b | |
1880 |
|
1880 | |||
1881 | Importing with unknown file: |
|
1881 | Importing with unknown file: | |
1882 |
|
1882 | |||
1883 | $ hg update --rev 'desc(initial)' |
|
1883 | $ hg update --rev 'desc(initial)' | |
1884 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1884 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1885 | $ hg export --rev 'desc("extended jungle")' | hg import --partial - |
|
1885 | $ hg export --rev 'desc("extended jungle")' | hg import --partial - | |
1886 | applying patch from stdin |
|
1886 | applying patch from stdin | |
1887 | unable to find 'jungle' for patching |
|
1887 | unable to find 'jungle' for patching | |
1888 | (use '--prefix' to apply patch relative to the current directory) |
|
1888 | (use '--prefix' to apply patch relative to the current directory) | |
1889 | 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej |
|
1889 | 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej | |
1890 | patch applied partially |
|
1890 | patch applied partially | |
1891 | (fix the .rej files and run `hg commit --amend`) |
|
1891 | (fix the .rej files and run `hg commit --amend`) | |
1892 | [1] |
|
1892 | [1] | |
1893 |
|
1893 | |||
1894 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1894 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' | |
1895 | @ extended jungle [Cornelius] 0: +0/-0 |
|
1895 | @ extended jungle [Cornelius] 0: +0/-0 | |
1896 | | |
|
1896 | | | |
1897 | | o four [Rataxes] 0: +0/-0 |
|
1897 | | o four [Rataxes] 0: +0/-0 | |
1898 | |/ |
|
1898 | |/ | |
1899 | | o five [Arthur] 1: +1/-0 |
|
1899 | | o five [Arthur] 1: +1/-0 | |
1900 | |/ |
|
1900 | |/ | |
1901 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1901 | | o extended jungle [Cornelius] 1: +1/-0 | |
1902 | | | |
|
1902 | | | | |
1903 | | o jungle [Zephir] 1: +1/-0 |
|
1903 | | o jungle [Zephir] 1: +1/-0 | |
1904 | | | |
|
1904 | | | | |
1905 | | o five [Arthur] 2: +2/-1 |
|
1905 | | o five [Arthur] 2: +2/-1 | |
1906 | | | |
|
1906 | | | | |
1907 | | o four [Rataxes] 1: +1/-1 |
|
1907 | | o four [Rataxes] 1: +1/-1 | |
1908 | | | |
|
1908 | | | | |
1909 | | o three [Celeste] 1: +1/-1 |
|
1909 | | o three [Celeste] 1: +1/-1 | |
1910 | |/ |
|
1910 | |/ | |
1911 | o initial [Babar] 2: +8/-0 |
|
1911 | o initial [Babar] 2: +8/-0 | |
1912 |
|
1912 | |||
1913 | $ hg export |
|
1913 | $ hg export | |
1914 | # HG changeset patch |
|
1914 | # HG changeset patch | |
1915 | # User Cornelius |
|
1915 | # User Cornelius | |
1916 | # Date 0 0 |
|
1916 | # Date 0 0 | |
1917 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1917 | # Thu Jan 01 00:00:00 1970 +0000 | |
1918 | # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d |
|
1918 | # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d | |
1919 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1919 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e | |
1920 | extended jungle |
|
1920 | extended jungle | |
1921 |
|
1921 | |||
1922 | $ hg status -c . |
|
1922 | $ hg status -c . | |
1923 | C a |
|
1923 | C a | |
1924 | C b |
|
1924 | C b | |
1925 | $ ls -A |
|
1925 | $ ls -A | |
1926 | .hg |
|
1926 | .hg | |
1927 | a |
|
1927 | a | |
1928 | a.rej |
|
1928 | a.rej | |
1929 | b |
|
1929 | b | |
1930 | jungle.rej |
|
1930 | jungle.rej | |
1931 |
|
1931 | |||
1932 | Importing multiple failing patches: |
|
1932 | Importing multiple failing patches: | |
1933 |
|
1933 | |||
1934 | $ hg update --rev 'desc(initial)' |
|
1934 | $ hg update --rev 'desc(initial)' | |
1935 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1935 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1936 | $ echo 'B' > b # just to make another commit |
|
1936 | $ echo 'B' > b # just to make another commit | |
1937 | $ hg commit -m "a new base" |
|
1937 | $ hg commit -m "a new base" | |
1938 | created new head |
|
1938 | created new head | |
1939 | $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial - |
|
1939 | $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial - | |
1940 | applying patch from stdin |
|
1940 | applying patch from stdin | |
1941 | patching file a |
|
1941 | patching file a | |
1942 | Hunk #1 FAILED at 0 |
|
1942 | Hunk #1 FAILED at 0 | |
1943 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1943 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej | |
1944 | patch applied partially |
|
1944 | patch applied partially | |
1945 | (fix the .rej files and run `hg commit --amend`) |
|
1945 | (fix the .rej files and run `hg commit --amend`) | |
1946 | [1] |
|
1946 | [1] | |
1947 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1947 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' | |
1948 | @ four [Rataxes] 0: +0/-0 |
|
1948 | @ four [Rataxes] 0: +0/-0 | |
1949 | | |
|
1949 | | | |
1950 | o a new base [test] 1: +1/-1 |
|
1950 | o a new base [test] 1: +1/-1 | |
1951 | | |
|
1951 | | | |
1952 | | o extended jungle [Cornelius] 0: +0/-0 |
|
1952 | | o extended jungle [Cornelius] 0: +0/-0 | |
1953 | |/ |
|
1953 | |/ | |
1954 | | o four [Rataxes] 0: +0/-0 |
|
1954 | | o four [Rataxes] 0: +0/-0 | |
1955 | |/ |
|
1955 | |/ | |
1956 | | o five [Arthur] 1: +1/-0 |
|
1956 | | o five [Arthur] 1: +1/-0 | |
1957 | |/ |
|
1957 | |/ | |
1958 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1958 | | o extended jungle [Cornelius] 1: +1/-0 | |
1959 | | | |
|
1959 | | | | |
1960 | | o jungle [Zephir] 1: +1/-0 |
|
1960 | | o jungle [Zephir] 1: +1/-0 | |
1961 | | | |
|
1961 | | | | |
1962 | | o five [Arthur] 2: +2/-1 |
|
1962 | | o five [Arthur] 2: +2/-1 | |
1963 | | | |
|
1963 | | | | |
1964 | | o four [Rataxes] 1: +1/-1 |
|
1964 | | o four [Rataxes] 1: +1/-1 | |
1965 | | | |
|
1965 | | | | |
1966 | | o three [Celeste] 1: +1/-1 |
|
1966 | | o three [Celeste] 1: +1/-1 | |
1967 | |/ |
|
1967 | |/ | |
1968 | o initial [Babar] 2: +8/-0 |
|
1968 | o initial [Babar] 2: +8/-0 | |
1969 |
|
1969 | |||
1970 | $ hg export |
|
1970 | $ hg export | |
1971 | # HG changeset patch |
|
1971 | # HG changeset patch | |
1972 | # User Rataxes |
|
1972 | # User Rataxes | |
1973 | # Date 0 0 |
|
1973 | # Date 0 0 | |
1974 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1974 | # Thu Jan 01 00:00:00 1970 +0000 | |
1975 | # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d |
|
1975 | # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d | |
1976 | # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd |
|
1976 | # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd | |
1977 | four |
|
1977 | four | |
1978 |
|
1978 | |||
1979 | $ hg status -c . |
|
1979 | $ hg status -c . | |
1980 | C a |
|
1980 | C a | |
1981 | C b |
|
1981 | C b | |
1982 |
|
1982 | |||
1983 | Importing some extra header |
|
1983 | Importing some extra header | |
1984 | =========================== |
|
1984 | =========================== | |
1985 |
|
1985 | |||
1986 | $ cat > $TESTTMP/parseextra.py <<EOF |
|
1986 | $ cat > $TESTTMP/parseextra.py <<EOF | |
1987 | > import mercurial.cmdutil |
|
1987 | > import mercurial.cmdutil | |
1988 | > import mercurial.patch |
|
1988 | > import mercurial.patch | |
1989 | > |
|
1989 | > | |
1990 | > def processfoo(repo, data, extra, opts): |
|
1990 | > def processfoo(repo, data, extra, opts): | |
1991 | > if b'foo' in data: |
|
1991 | > if b'foo' in data: | |
1992 | > extra[b'foo'] = data[b'foo'] |
|
1992 | > extra[b'foo'] = data[b'foo'] | |
1993 | > def postimport(ctx): |
|
1993 | > def postimport(ctx): | |
1994 | > if b'foo' in ctx.extra(): |
|
1994 | > if b'foo' in ctx.extra(): | |
1995 | > ctx.repo().ui.write(b'imported-foo: %s\n' % ctx.extra()[b'foo']) |
|
1995 | > ctx.repo().ui.write(b'imported-foo: %s\n' % ctx.extra()[b'foo']) | |
1996 | > |
|
1996 | > | |
1997 | > mercurial.patch.patchheadermap.append((b'Foo', b'foo')) |
|
1997 | > mercurial.patch.patchheadermap.append((b'Foo', b'foo')) | |
1998 | > mercurial.cmdutil.extrapreimport.append(b'foo') |
|
1998 | > mercurial.cmdutil.extrapreimport.append(b'foo') | |
1999 | > mercurial.cmdutil.extrapreimportmap[b'foo'] = processfoo |
|
1999 | > mercurial.cmdutil.extrapreimportmap[b'foo'] = processfoo | |
2000 | > mercurial.cmdutil.extrapostimport.append(b'foo') |
|
2000 | > mercurial.cmdutil.extrapostimport.append(b'foo') | |
2001 | > mercurial.cmdutil.extrapostimportmap[b'foo'] = postimport |
|
2001 | > mercurial.cmdutil.extrapostimportmap[b'foo'] = postimport | |
2002 | > EOF |
|
2002 | > EOF | |
2003 | $ cat >> $HGRCPATH <<EOF |
|
2003 | $ cat >> $HGRCPATH <<EOF | |
2004 | > [extensions] |
|
2004 | > [extensions] | |
2005 | > parseextra=$TESTTMP/parseextra.py |
|
2005 | > parseextra=$TESTTMP/parseextra.py | |
2006 | > EOF |
|
2006 | > EOF | |
2007 | $ hg up -C tip |
|
2007 | $ hg up -C tip | |
2008 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2008 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2009 | $ cat > $TESTTMP/foo.patch <<EOF |
|
2009 | $ cat > $TESTTMP/foo.patch <<EOF | |
2010 | > # HG changeset patch |
|
2010 | > # HG changeset patch | |
2011 | > # User Rataxes |
|
2011 | > # User Rataxes | |
2012 | > # Date 0 0 |
|
2012 | > # Date 0 0 | |
2013 | > # Thu Jan 01 00:00:00 1970 +0000 |
|
2013 | > # Thu Jan 01 00:00:00 1970 +0000 | |
2014 | > # Foo bar |
|
2014 | > # Foo bar | |
2015 | > height |
|
2015 | > height | |
2016 | > |
|
2016 | > | |
2017 | > --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
2017 | > --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
2018 | > +++ b/a Wed Oct 07 09:17:44 2015 +0000 |
|
2018 | > +++ b/a Wed Oct 07 09:17:44 2015 +0000 | |
2019 | > @@ -5,3 +5,4 @@ |
|
2019 | > @@ -5,3 +5,4 @@ | |
2020 | > five |
|
2020 | > five | |
2021 | > six |
|
2021 | > six | |
2022 | > seven |
|
2022 | > seven | |
2023 | > +heigt |
|
2023 | > +heigt | |
2024 | > EOF |
|
2024 | > EOF | |
2025 | $ hg import $TESTTMP/foo.patch |
|
2025 | $ hg import $TESTTMP/foo.patch | |
2026 | applying $TESTTMP/foo.patch |
|
2026 | applying $TESTTMP/foo.patch | |
2027 | imported-foo: bar |
|
2027 | imported-foo: bar | |
2028 | $ hg log --debug -r . | grep extra |
|
2028 | $ hg log --debug -r . | grep extra | |
2029 | extra: branch=default |
|
2029 | extra: branch=default | |
2030 | extra: foo=bar |
|
2030 | extra: foo=bar | |
2031 |
|
2031 | |||
2032 | Warn the user that paths are relative to the root of |
|
2032 | Warn the user that paths are relative to the root of | |
2033 | repository when file not found for patching |
|
2033 | repository when file not found for patching | |
2034 |
|
2034 | |||
2035 | $ mkdir filedir |
|
2035 | $ mkdir filedir | |
2036 | $ echo "file1" >> filedir/file1 |
|
2036 | $ echo "file1" >> filedir/file1 | |
2037 | $ hg add filedir/file1 |
|
2037 | $ hg add filedir/file1 | |
2038 | $ hg commit -m "file1" |
|
2038 | $ hg commit -m "file1" | |
2039 | $ cd filedir |
|
2039 | $ cd filedir | |
2040 | $ hg import -p 2 - <<EOF |
|
2040 | $ hg import -p 2 - <<EOF | |
2041 | > # HG changeset patch |
|
2041 | > # HG changeset patch | |
2042 | > # User test |
|
2042 | > # User test | |
2043 | > # Date 0 0 |
|
2043 | > # Date 0 0 | |
2044 | > file2 |
|
2044 | > file2 | |
2045 | > |
|
2045 | > | |
2046 | > diff --git a/filedir/file1 b/filedir/file1 |
|
2046 | > diff --git a/filedir/file1 b/filedir/file1 | |
2047 | > --- a/filedir/file1 |
|
2047 | > --- a/filedir/file1 | |
2048 | > +++ b/filedir/file1 |
|
2048 | > +++ b/filedir/file1 | |
2049 | > @@ -1,1 +1,2 @@ |
|
2049 | > @@ -1,1 +1,2 @@ | |
2050 | > file1 |
|
2050 | > file1 | |
2051 | > +file2 |
|
2051 | > +file2 | |
2052 | > EOF |
|
2052 | > EOF | |
2053 | applying patch from stdin |
|
2053 | applying patch from stdin | |
2054 | unable to find 'file1' for patching |
|
2054 | unable to find 'file1' for patching | |
2055 | (use '--prefix' to apply patch relative to the current directory) |
|
2055 | (use '--prefix' to apply patch relative to the current directory) | |
2056 | 1 out of 1 hunks FAILED -- saving rejects to file file1.rej |
|
2056 | 1 out of 1 hunks FAILED -- saving rejects to file file1.rej | |
2057 | abort: patch failed to apply |
|
2057 | abort: patch failed to apply | |
2058 | [20] |
|
2058 | [20] | |
2059 |
|
2059 | |||
2060 | test import crash (issue5375) |
|
2060 | test import crash (issue5375) | |
2061 | $ cd .. |
|
2061 | $ cd .. | |
2062 | $ hg init repo |
|
2062 | $ hg init repo | |
2063 | $ cd repo |
|
2063 | $ cd repo | |
2064 | $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import - |
|
2064 | $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import - | |
2065 | applying patch from stdin |
|
2065 | applying patch from stdin | |
2066 | a not tracked! |
|
2066 | a not tracked! | |
2067 | abort: source file 'a' does not exist |
|
2067 | abort: source file 'a' does not exist | |
2068 | [20] |
|
2068 | [20] | |
2069 |
|
2069 | |||
2070 | test immature end of hunk |
|
2070 | test immature end of hunk | |
2071 |
|
2071 | |||
2072 | $ hg import - <<'EOF' |
|
2072 | $ hg import - <<'EOF' | |
2073 | > diff --git a/foo b/foo |
|
2073 | > diff --git a/foo b/foo | |
2074 | > --- a/foo |
|
2074 | > --- a/foo | |
2075 | > --- b/foo |
|
2075 | > --- b/foo | |
2076 | > @@ -0,0 +1,1 @@ |
|
2076 | > @@ -0,0 +1,1 @@ | |
2077 | > EOF |
|
2077 | > EOF | |
2078 | applying patch from stdin |
|
2078 | applying patch from stdin | |
2079 | abort: bad hunk #1: incomplete hunk |
|
2079 | abort: bad hunk #1: incomplete hunk | |
2080 | (check that whitespace in the patch has not been mangled) |
|
2080 | (check that whitespace in the patch has not been mangled) | |
2081 | [10] |
|
2081 | [10] | |
2082 |
|
2082 | |||
2083 | $ hg import - <<'EOF' |
|
2083 | $ hg import - <<'EOF' | |
2084 | > diff --git a/foo b/foo |
|
2084 | > diff --git a/foo b/foo | |
2085 | > --- a/foo |
|
2085 | > --- a/foo | |
2086 | > --- b/foo |
|
2086 | > --- b/foo | |
2087 | > @@ -0,0 +1,1 @@ |
|
2087 | > @@ -0,0 +1,1 @@ | |
2088 | > \ No newline at end of file |
|
2088 | > \ No newline at end of file | |
2089 | > EOF |
|
2089 | > EOF | |
2090 | applying patch from stdin |
|
2090 | applying patch from stdin | |
2091 | abort: bad hunk #1: incomplete hunk |
|
2091 | abort: bad hunk #1: incomplete hunk | |
2092 | (check that whitespace in the patch has not been mangled) |
|
2092 | (check that whitespace in the patch has not been mangled) | |
2093 | [10] |
|
2093 | [10] |
@@ -1,698 +1,698 b'' | |||||
1 | $ hg init |
|
1 | $ hg init | |
2 | $ mkdir d1 d1/d11 d2 |
|
2 | $ mkdir d1 d1/d11 d2 | |
3 | $ echo d1/a > d1/a |
|
3 | $ echo d1/a > d1/a | |
4 | $ echo d1/ba > d1/ba |
|
4 | $ echo d1/ba > d1/ba | |
5 | $ echo d1/a1 > d1/d11/a1 |
|
5 | $ echo d1/a1 > d1/d11/a1 | |
6 | $ echo d1/b > d1/b |
|
6 | $ echo d1/b > d1/b | |
7 | $ echo d2/b > d2/b |
|
7 | $ echo d2/b > d2/b | |
8 | $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b |
|
8 | $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b | |
9 | $ hg commit -m "1" |
|
9 | $ hg commit -m "1" | |
10 |
|
10 | |||
11 | rename a single file |
|
11 | rename a single file | |
12 |
|
12 | |||
13 | $ hg rename d1/d11/a1 d2/c |
|
13 | $ hg rename d1/d11/a1 d2/c | |
14 | $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml |
|
14 | $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml | |
15 | abort: filename contains 'con', which is reserved on Windows: d1/con.xml |
|
15 | abort: filename contains 'con', which is reserved on Windows: d1/con.xml | |
16 | [10] |
|
16 | [10] | |
17 | $ hg sum |
|
17 | $ hg sum | |
18 | parent: 0:9b4b6e7b2c26 tip |
|
18 | parent: 0:9b4b6e7b2c26 tip | |
19 | 1 |
|
19 | 1 | |
20 | branch: default |
|
20 | branch: default | |
21 | commit: 1 renamed |
|
21 | commit: 1 renamed | |
22 | update: (current) |
|
22 | update: (current) | |
23 | phases: 1 draft |
|
23 | phases: 1 draft | |
24 | $ hg status -C |
|
24 | $ hg status -C | |
25 | A d2/c |
|
25 | A d2/c | |
26 | d1/d11/a1 |
|
26 | d1/d11/a1 | |
27 | R d1/d11/a1 |
|
27 | R d1/d11/a1 | |
28 | $ hg update -C |
|
28 | $ hg update -C | |
29 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
29 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
30 | $ rm d2/c |
|
30 | $ rm d2/c | |
31 |
|
31 | |||
32 | rename a single file using absolute paths |
|
32 | rename a single file using absolute paths | |
33 |
|
33 | |||
34 | $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c |
|
34 | $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c | |
35 | $ hg status -C |
|
35 | $ hg status -C | |
36 | A d2/c |
|
36 | A d2/c | |
37 | d1/d11/a1 |
|
37 | d1/d11/a1 | |
38 | R d1/d11/a1 |
|
38 | R d1/d11/a1 | |
39 | $ hg update -C |
|
39 | $ hg update -C | |
40 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
40 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
41 | $ rm d2/c |
|
41 | $ rm d2/c | |
42 |
|
42 | |||
43 | rename --after a single file |
|
43 | rename --after a single file | |
44 |
|
44 | |||
45 | $ mv d1/d11/a1 d2/c |
|
45 | $ mv d1/d11/a1 d2/c | |
46 | $ hg rename --after d1/d11/a1 d2/c |
|
46 | $ hg rename --after d1/d11/a1 d2/c | |
47 | $ hg status -C |
|
47 | $ hg status -C | |
48 | A d2/c |
|
48 | A d2/c | |
49 | d1/d11/a1 |
|
49 | d1/d11/a1 | |
50 | R d1/d11/a1 |
|
50 | R d1/d11/a1 | |
51 | $ hg update -C |
|
51 | $ hg update -C | |
52 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
52 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
53 | $ rm d2/c |
|
53 | $ rm d2/c | |
54 |
|
54 | |||
55 | rename --after a single file when src and tgt already tracked |
|
55 | rename --after a single file when src and tgt already tracked | |
56 |
|
56 | |||
57 | $ mv d1/d11/a1 d2/c |
|
57 | $ mv d1/d11/a1 d2/c | |
58 | $ hg addrem -s 0 |
|
58 | $ hg addrem -s 0 | |
59 | removing d1/d11/a1 |
|
59 | removing d1/d11/a1 | |
60 | adding d2/c |
|
60 | adding d2/c | |
61 | $ hg rename --after d1/d11/a1 d2/c |
|
61 | $ hg rename --after d1/d11/a1 d2/c | |
62 | $ hg status -C |
|
62 | $ hg status -C | |
63 | A d2/c |
|
63 | A d2/c | |
64 | d1/d11/a1 |
|
64 | d1/d11/a1 | |
65 | R d1/d11/a1 |
|
65 | R d1/d11/a1 | |
66 | $ hg update -C |
|
66 | $ hg update -C | |
67 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
67 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
68 | $ rm d2/c |
|
68 | $ rm d2/c | |
69 |
|
69 | |||
70 | rename --after a single file to a nonexistent target filename |
|
70 | rename --after a single file to a nonexistent target filename | |
71 |
|
71 | |||
72 | $ hg rename --after d1/a dummy |
|
72 | $ hg rename --after d1/a dummy | |
73 | d1/a: not recording move - dummy does not exist |
|
73 | d1/a: not recording move - dummy does not exist | |
74 | [1] |
|
74 | [1] | |
75 |
|
75 | |||
76 | move a single file to an existing directory |
|
76 | move a single file to an existing directory | |
77 |
|
77 | |||
78 | $ hg rename d1/d11/a1 d2 |
|
78 | $ hg rename d1/d11/a1 d2 | |
79 | $ hg status -C |
|
79 | $ hg status -C | |
80 | A d2/a1 |
|
80 | A d2/a1 | |
81 | d1/d11/a1 |
|
81 | d1/d11/a1 | |
82 | R d1/d11/a1 |
|
82 | R d1/d11/a1 | |
83 | $ hg update -C |
|
83 | $ hg update -C | |
84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
85 | $ rm d2/a1 |
|
85 | $ rm d2/a1 | |
86 |
|
86 | |||
87 | move --after a single file to an existing directory |
|
87 | move --after a single file to an existing directory | |
88 |
|
88 | |||
89 | $ mv d1/d11/a1 d2 |
|
89 | $ mv d1/d11/a1 d2 | |
90 | $ hg rename --after d1/d11/a1 d2 |
|
90 | $ hg rename --after d1/d11/a1 d2 | |
91 | $ hg status -C |
|
91 | $ hg status -C | |
92 | A d2/a1 |
|
92 | A d2/a1 | |
93 | d1/d11/a1 |
|
93 | d1/d11/a1 | |
94 | R d1/d11/a1 |
|
94 | R d1/d11/a1 | |
95 | $ hg update -C |
|
95 | $ hg update -C | |
96 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
96 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
97 | $ rm d2/a1 |
|
97 | $ rm d2/a1 | |
98 |
|
98 | |||
99 | rename a file using a relative path |
|
99 | rename a file using a relative path | |
100 |
|
100 | |||
101 | $ (cd d1/d11; hg rename ../../d2/b e) |
|
101 | $ (cd d1/d11; hg rename ../../d2/b e) | |
102 | $ hg status -C |
|
102 | $ hg status -C | |
103 | A d1/d11/e |
|
103 | A d1/d11/e | |
104 | d2/b |
|
104 | d2/b | |
105 | R d2/b |
|
105 | R d2/b | |
106 | $ hg update -C |
|
106 | $ hg update -C | |
107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
108 | $ rm d1/d11/e |
|
108 | $ rm d1/d11/e | |
109 |
|
109 | |||
110 | rename --after a file using a relative path |
|
110 | rename --after a file using a relative path | |
111 |
|
111 | |||
112 | $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e) |
|
112 | $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e) | |
113 | $ hg status -C |
|
113 | $ hg status -C | |
114 | A d1/d11/e |
|
114 | A d1/d11/e | |
115 | d2/b |
|
115 | d2/b | |
116 | R d2/b |
|
116 | R d2/b | |
117 | $ hg update -C |
|
117 | $ hg update -C | |
118 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
119 | $ rm d1/d11/e |
|
119 | $ rm d1/d11/e | |
120 |
|
120 | |||
121 | rename directory d1 as d3 |
|
121 | rename directory d1 as d3 | |
122 |
|
122 | |||
123 | $ hg rename d1/ d3 |
|
123 | $ hg rename d1/ d3 | |
124 | moving d1/a to d3/a |
|
124 | moving d1/a to d3/a | |
125 | moving d1/b to d3/b |
|
125 | moving d1/b to d3/b | |
126 | moving d1/ba to d3/ba |
|
126 | moving d1/ba to d3/ba | |
127 | moving d1/d11/a1 to d3/d11/a1 |
|
127 | moving d1/d11/a1 to d3/d11/a1 | |
128 | $ hg status -C |
|
128 | $ hg status -C | |
129 | A d3/a |
|
129 | A d3/a | |
130 | d1/a |
|
130 | d1/a | |
131 | A d3/b |
|
131 | A d3/b | |
132 | d1/b |
|
132 | d1/b | |
133 | A d3/ba |
|
133 | A d3/ba | |
134 | d1/ba |
|
134 | d1/ba | |
135 | A d3/d11/a1 |
|
135 | A d3/d11/a1 | |
136 | d1/d11/a1 |
|
136 | d1/d11/a1 | |
137 | R d1/a |
|
137 | R d1/a | |
138 | R d1/b |
|
138 | R d1/b | |
139 | R d1/ba |
|
139 | R d1/ba | |
140 | R d1/d11/a1 |
|
140 | R d1/d11/a1 | |
141 | $ hg update -C |
|
141 | $ hg update -C | |
142 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
142 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
143 | $ rm -rf d3 |
|
143 | $ rm -rf d3 | |
144 |
|
144 | |||
145 | rename --after directory d1 as d3 |
|
145 | rename --after directory d1 as d3 | |
146 |
|
146 | |||
147 | $ mv d1 d3 |
|
147 | $ mv d1 d3 | |
148 | $ hg rename --after d1 d3 |
|
148 | $ hg rename --after d1 d3 | |
149 | moving d1/a to d3/a |
|
149 | moving d1/a to d3/a | |
150 | moving d1/b to d3/b |
|
150 | moving d1/b to d3/b | |
151 | moving d1/ba to d3/ba |
|
151 | moving d1/ba to d3/ba | |
152 | moving d1/d11/a1 to d3/d11/a1 |
|
152 | moving d1/d11/a1 to d3/d11/a1 | |
153 | $ hg status -C |
|
153 | $ hg status -C | |
154 | A d3/a |
|
154 | A d3/a | |
155 | d1/a |
|
155 | d1/a | |
156 | A d3/b |
|
156 | A d3/b | |
157 | d1/b |
|
157 | d1/b | |
158 | A d3/ba |
|
158 | A d3/ba | |
159 | d1/ba |
|
159 | d1/ba | |
160 | A d3/d11/a1 |
|
160 | A d3/d11/a1 | |
161 | d1/d11/a1 |
|
161 | d1/d11/a1 | |
162 | R d1/a |
|
162 | R d1/a | |
163 | R d1/b |
|
163 | R d1/b | |
164 | R d1/ba |
|
164 | R d1/ba | |
165 | R d1/d11/a1 |
|
165 | R d1/d11/a1 | |
166 | $ hg update -C |
|
166 | $ hg update -C | |
167 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
167 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
168 | $ rm -rf d3 |
|
168 | $ rm -rf d3 | |
169 |
|
169 | |||
170 | move a directory using a relative path |
|
170 | move a directory using a relative path | |
171 |
|
171 | |||
172 | $ (cd d2; mkdir d3; hg rename ../d1/d11 d3) |
|
172 | $ (cd d2; mkdir d3; hg rename ../d1/d11 d3) | |
173 | moving ../d1/d11/a1 to d3/d11/a1 |
|
173 | moving ../d1/d11/a1 to d3/d11/a1 | |
174 | $ hg status -C |
|
174 | $ hg status -C | |
175 | A d2/d3/d11/a1 |
|
175 | A d2/d3/d11/a1 | |
176 | d1/d11/a1 |
|
176 | d1/d11/a1 | |
177 | R d1/d11/a1 |
|
177 | R d1/d11/a1 | |
178 | $ hg update -C |
|
178 | $ hg update -C | |
179 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
179 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
180 | $ rm -rf d2/d3 |
|
180 | $ rm -rf d2/d3 | |
181 |
|
181 | |||
182 | move --after a directory using a relative path |
|
182 | move --after a directory using a relative path | |
183 |
|
183 | |||
184 | $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3) |
|
184 | $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3) | |
185 | moving ../d1/d11/a1 to d3/d11/a1 |
|
185 | moving ../d1/d11/a1 to d3/d11/a1 | |
186 | $ hg status -C |
|
186 | $ hg status -C | |
187 | A d2/d3/d11/a1 |
|
187 | A d2/d3/d11/a1 | |
188 | d1/d11/a1 |
|
188 | d1/d11/a1 | |
189 | R d1/d11/a1 |
|
189 | R d1/d11/a1 | |
190 | $ hg update -C |
|
190 | $ hg update -C | |
191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
192 | $ rm -rf d2/d3 |
|
192 | $ rm -rf d2/d3 | |
193 |
|
193 | |||
194 | move directory d1/d11 to an existing directory d2 (removes empty d1) |
|
194 | move directory d1/d11 to an existing directory d2 (removes empty d1) | |
195 |
|
195 | |||
196 | $ hg rename d1/d11/ d2 |
|
196 | $ hg rename d1/d11/ d2 | |
197 | moving d1/d11/a1 to d2/d11/a1 |
|
197 | moving d1/d11/a1 to d2/d11/a1 | |
198 | $ hg status -C |
|
198 | $ hg status -C | |
199 | A d2/d11/a1 |
|
199 | A d2/d11/a1 | |
200 | d1/d11/a1 |
|
200 | d1/d11/a1 | |
201 | R d1/d11/a1 |
|
201 | R d1/d11/a1 | |
202 | $ hg update -C |
|
202 | $ hg update -C | |
203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
204 | $ rm -rf d2/d11 |
|
204 | $ rm -rf d2/d11 | |
205 |
|
205 | |||
206 | move directories d1 and d2 to a new directory d3 |
|
206 | move directories d1 and d2 to a new directory d3 | |
207 |
|
207 | |||
208 | $ mkdir d3 |
|
208 | $ mkdir d3 | |
209 | $ hg rename d1 d2 d3 |
|
209 | $ hg rename d1 d2 d3 | |
210 | moving d1/a to d3/d1/a |
|
210 | moving d1/a to d3/d1/a | |
211 | moving d1/b to d3/d1/b |
|
211 | moving d1/b to d3/d1/b | |
212 | moving d1/ba to d3/d1/ba |
|
212 | moving d1/ba to d3/d1/ba | |
213 | moving d1/d11/a1 to d3/d1/d11/a1 |
|
213 | moving d1/d11/a1 to d3/d1/d11/a1 | |
214 | moving d2/b to d3/d2/b |
|
214 | moving d2/b to d3/d2/b | |
215 | $ hg status -C |
|
215 | $ hg status -C | |
216 | A d3/d1/a |
|
216 | A d3/d1/a | |
217 | d1/a |
|
217 | d1/a | |
218 | A d3/d1/b |
|
218 | A d3/d1/b | |
219 | d1/b |
|
219 | d1/b | |
220 | A d3/d1/ba |
|
220 | A d3/d1/ba | |
221 | d1/ba |
|
221 | d1/ba | |
222 | A d3/d1/d11/a1 |
|
222 | A d3/d1/d11/a1 | |
223 | d1/d11/a1 |
|
223 | d1/d11/a1 | |
224 | A d3/d2/b |
|
224 | A d3/d2/b | |
225 | d2/b |
|
225 | d2/b | |
226 | R d1/a |
|
226 | R d1/a | |
227 | R d1/b |
|
227 | R d1/b | |
228 | R d1/ba |
|
228 | R d1/ba | |
229 | R d1/d11/a1 |
|
229 | R d1/d11/a1 | |
230 | R d2/b |
|
230 | R d2/b | |
231 | $ hg update -C |
|
231 | $ hg update -C | |
232 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
233 | $ rm -rf d3 |
|
233 | $ rm -rf d3 | |
234 |
|
234 | |||
235 | move --after directories d1 and d2 to a new directory d3 |
|
235 | move --after directories d1 and d2 to a new directory d3 | |
236 |
|
236 | |||
237 | $ mkdir d3 |
|
237 | $ mkdir d3 | |
238 | $ mv d1 d2 d3 |
|
238 | $ mv d1 d2 d3 | |
239 | $ hg rename --after d1 d2 d3 |
|
239 | $ hg rename --after d1 d2 d3 | |
240 | moving d1/a to d3/d1/a |
|
240 | moving d1/a to d3/d1/a | |
241 | moving d1/b to d3/d1/b |
|
241 | moving d1/b to d3/d1/b | |
242 | moving d1/ba to d3/d1/ba |
|
242 | moving d1/ba to d3/d1/ba | |
243 | moving d1/d11/a1 to d3/d1/d11/a1 |
|
243 | moving d1/d11/a1 to d3/d1/d11/a1 | |
244 | moving d2/b to d3/d2/b |
|
244 | moving d2/b to d3/d2/b | |
245 | $ hg status -C |
|
245 | $ hg status -C | |
246 | A d3/d1/a |
|
246 | A d3/d1/a | |
247 | d1/a |
|
247 | d1/a | |
248 | A d3/d1/b |
|
248 | A d3/d1/b | |
249 | d1/b |
|
249 | d1/b | |
250 | A d3/d1/ba |
|
250 | A d3/d1/ba | |
251 | d1/ba |
|
251 | d1/ba | |
252 | A d3/d1/d11/a1 |
|
252 | A d3/d1/d11/a1 | |
253 | d1/d11/a1 |
|
253 | d1/d11/a1 | |
254 | A d3/d2/b |
|
254 | A d3/d2/b | |
255 | d2/b |
|
255 | d2/b | |
256 | R d1/a |
|
256 | R d1/a | |
257 | R d1/b |
|
257 | R d1/b | |
258 | R d1/ba |
|
258 | R d1/ba | |
259 | R d1/d11/a1 |
|
259 | R d1/d11/a1 | |
260 | R d2/b |
|
260 | R d2/b | |
261 | $ hg update -C |
|
261 | $ hg update -C | |
262 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
262 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
263 | $ rm -rf d3 |
|
263 | $ rm -rf d3 | |
264 |
|
264 | |||
265 | move everything under directory d1 to existing directory d2, do not |
|
265 | move everything under directory d1 to existing directory d2, do not | |
266 | overwrite existing files (d2/b) |
|
266 | overwrite existing files (d2/b) | |
267 |
|
267 | |||
268 | $ hg rename d1/* d2 |
|
268 | $ hg rename d1/* d2 | |
269 | d2/b: not overwriting - file already committed |
|
269 | d2/b: not overwriting - file already committed | |
270 | ('hg rename --force' to replace the file by recording a rename) |
|
270 | ('hg rename --force' to replace the file by recording a rename) | |
271 | moving d1/d11/a1 to d2/d11/a1 |
|
271 | moving d1/d11/a1 to d2/d11/a1 | |
272 | [1] |
|
272 | [1] | |
273 | $ hg status -C |
|
273 | $ hg status -C | |
274 | A d2/a |
|
274 | A d2/a | |
275 | d1/a |
|
275 | d1/a | |
276 | A d2/ba |
|
276 | A d2/ba | |
277 | d1/ba |
|
277 | d1/ba | |
278 | A d2/d11/a1 |
|
278 | A d2/d11/a1 | |
279 | d1/d11/a1 |
|
279 | d1/d11/a1 | |
280 | R d1/a |
|
280 | R d1/a | |
281 | R d1/ba |
|
281 | R d1/ba | |
282 | R d1/d11/a1 |
|
282 | R d1/d11/a1 | |
283 | $ diff -u d1/b d2/b |
|
283 | $ diff -u d1/b d2/b | |
284 | --- d1/b * (glob) |
|
284 | --- d1/b * (glob) | |
285 | +++ d2/b * (glob) |
|
285 | +++ d2/b * (glob) | |
286 | @@ * (glob) |
|
286 | @@ * (glob) | |
287 | -d1/b |
|
287 | -d1/b | |
288 | +d2/b |
|
288 | +d2/b | |
289 | [1] |
|
289 | [1] | |
290 | $ hg update -C |
|
290 | $ hg update -C | |
291 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
291 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
292 | $ rm d2/a d2/ba d2/d11/a1 |
|
292 | $ rm d2/a d2/ba d2/d11/a1 | |
293 |
|
293 | |||
294 | attempt to move one file into a non-existent directory |
|
294 | attempt to move one file into a non-existent directory | |
295 |
|
295 | |||
296 | $ hg rename d1/a dx/ |
|
296 | $ hg rename d1/a dx/ | |
297 | abort: destination dx/ is not a directory |
|
297 | abort: destination dx/ is not a directory | |
298 | [10] |
|
298 | [10] | |
299 | $ hg status -C |
|
299 | $ hg status -C | |
300 | $ hg update -C |
|
300 | $ hg update -C | |
301 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
301 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
302 |
|
302 | |||
303 | attempt to move potentially more than one file into a non-existent directory |
|
303 | attempt to move potentially more than one file into a non-existent directory | |
304 |
|
304 | |||
305 | $ hg rename 'glob:d1/**' dx |
|
305 | $ hg rename 'glob:d1/**' dx | |
306 | abort: with multiple sources, destination must be an existing directory |
|
306 | abort: with multiple sources, destination must be an existing directory | |
307 | [10] |
|
307 | [10] | |
308 |
|
308 | |||
309 | move every file under d1 to d2/d21 |
|
309 | move every file under d1 to d2/d21 | |
310 |
|
310 | |||
311 | $ mkdir d2/d21 |
|
311 | $ mkdir d2/d21 | |
312 | $ hg rename 'glob:d1/**' d2/d21 |
|
312 | $ hg rename 'glob:d1/**' d2/d21 | |
313 | moving d1/a to d2/d21/a |
|
313 | moving d1/a to d2/d21/a | |
314 | moving d1/b to d2/d21/b |
|
314 | moving d1/b to d2/d21/b | |
315 | moving d1/ba to d2/d21/ba |
|
315 | moving d1/ba to d2/d21/ba | |
316 | moving d1/d11/a1 to d2/d21/a1 |
|
316 | moving d1/d11/a1 to d2/d21/a1 | |
317 | $ hg status -C |
|
317 | $ hg status -C | |
318 | A d2/d21/a |
|
318 | A d2/d21/a | |
319 | d1/a |
|
319 | d1/a | |
320 | A d2/d21/a1 |
|
320 | A d2/d21/a1 | |
321 | d1/d11/a1 |
|
321 | d1/d11/a1 | |
322 | A d2/d21/b |
|
322 | A d2/d21/b | |
323 | d1/b |
|
323 | d1/b | |
324 | A d2/d21/ba |
|
324 | A d2/d21/ba | |
325 | d1/ba |
|
325 | d1/ba | |
326 | R d1/a |
|
326 | R d1/a | |
327 | R d1/b |
|
327 | R d1/b | |
328 | R d1/ba |
|
328 | R d1/ba | |
329 | R d1/d11/a1 |
|
329 | R d1/d11/a1 | |
330 | $ hg update -C |
|
330 | $ hg update -C | |
331 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
331 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
332 | $ rm -rf d2/d21 |
|
332 | $ rm -rf d2/d21 | |
333 |
|
333 | |||
334 | move --after some files under d1 to d2/d21 |
|
334 | move --after some files under d1 to d2/d21 | |
335 |
|
335 | |||
336 | $ mkdir d2/d21 |
|
336 | $ mkdir d2/d21 | |
337 | $ mv d1/a d1/d11/a1 d2/d21 |
|
337 | $ mv d1/a d1/d11/a1 d2/d21 | |
338 | $ hg rename --after 'glob:d1/**' d2/d21 |
|
338 | $ hg rename --after 'glob:d1/**' d2/d21 | |
339 | moving d1/a to d2/d21/a |
|
339 | moving d1/a to d2/d21/a | |
340 | d1/b: not recording move - d2/d21/b does not exist |
|
340 | d1/b: not recording move - d2/d21/b does not exist | |
341 | d1/ba: not recording move - d2/d21/ba does not exist |
|
341 | d1/ba: not recording move - d2/d21/ba does not exist | |
342 | moving d1/d11/a1 to d2/d21/a1 |
|
342 | moving d1/d11/a1 to d2/d21/a1 | |
343 | [1] |
|
343 | [1] | |
344 | $ hg status -C |
|
344 | $ hg status -C | |
345 | A d2/d21/a |
|
345 | A d2/d21/a | |
346 | d1/a |
|
346 | d1/a | |
347 | A d2/d21/a1 |
|
347 | A d2/d21/a1 | |
348 | d1/d11/a1 |
|
348 | d1/d11/a1 | |
349 | R d1/a |
|
349 | R d1/a | |
350 | R d1/d11/a1 |
|
350 | R d1/d11/a1 | |
351 | $ hg update -C |
|
351 | $ hg update -C | |
352 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
352 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
353 | $ rm -rf d2/d21 |
|
353 | $ rm -rf d2/d21 | |
354 |
|
354 | |||
355 | move every file under d1 starting with an 'a' to d2/d21 (regexp) |
|
355 | move every file under d1 starting with an 'a' to d2/d21 (regexp) | |
356 |
|
356 | |||
357 | $ mkdir d2/d21 |
|
357 | $ mkdir d2/d21 | |
358 | $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 |
|
358 | $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 | |
359 | moving d1/a to d2/d21/a |
|
359 | moving d1/a to d2/d21/a | |
360 | moving d1/d11/a1 to d2/d21/a1 |
|
360 | moving d1/d11/a1 to d2/d21/a1 | |
361 | $ hg status -C |
|
361 | $ hg status -C | |
362 | A d2/d21/a |
|
362 | A d2/d21/a | |
363 | d1/a |
|
363 | d1/a | |
364 | A d2/d21/a1 |
|
364 | A d2/d21/a1 | |
365 | d1/d11/a1 |
|
365 | d1/d11/a1 | |
366 | R d1/a |
|
366 | R d1/a | |
367 | R d1/d11/a1 |
|
367 | R d1/d11/a1 | |
368 | $ hg update -C |
|
368 | $ hg update -C | |
369 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
369 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
370 | $ rm -rf d2/d21 |
|
370 | $ rm -rf d2/d21 | |
371 |
|
371 | |||
372 | attempt to overwrite an existing file |
|
372 | attempt to overwrite an existing file | |
373 |
|
373 | |||
374 | $ echo "ca" > d1/ca |
|
374 | $ echo "ca" > d1/ca | |
375 | $ hg rename d1/ba d1/ca |
|
375 | $ hg rename d1/ba d1/ca | |
376 | d1/ca: not overwriting - file exists |
|
376 | d1/ca: not overwriting - file exists | |
377 | ('hg rename --after' to record the rename) |
|
377 | ('hg rename --after' to record the rename) | |
378 | [1] |
|
378 | [1] | |
379 | $ hg status -C |
|
379 | $ hg status -C | |
380 | ? d1/ca |
|
380 | ? d1/ca | |
381 | $ hg update -C |
|
381 | $ hg update -C | |
382 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
383 |
|
383 | |||
384 | forced overwrite of an existing file |
|
384 | forced overwrite of an existing file | |
385 |
|
385 | |||
386 | $ echo "ca" > d1/ca |
|
386 | $ echo "ca" > d1/ca | |
387 | $ hg rename --force d1/ba d1/ca |
|
387 | $ hg rename --force d1/ba d1/ca | |
388 | $ hg status -C |
|
388 | $ hg status -C | |
389 | A d1/ca |
|
389 | A d1/ca | |
390 | d1/ba |
|
390 | d1/ba | |
391 | R d1/ba |
|
391 | R d1/ba | |
392 | $ hg update -C |
|
392 | $ hg update -C | |
393 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
393 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
394 | $ rm d1/ca |
|
394 | $ rm d1/ca | |
395 |
|
395 | |||
396 | attempt to overwrite an existing broken symlink |
|
396 | attempt to overwrite an existing broken symlink | |
397 |
|
397 | |||
398 | #if symlink |
|
398 | #if symlink | |
399 | $ ln -s ba d1/ca |
|
399 | $ ln -s ba d1/ca | |
400 | $ hg rename --traceback d1/ba d1/ca |
|
400 | $ hg rename --traceback d1/ba d1/ca | |
401 | d1/ca: not overwriting - file exists |
|
401 | d1/ca: not overwriting - file exists | |
402 | ('hg rename --after' to record the rename) |
|
402 | ('hg rename --after' to record the rename) | |
403 | [1] |
|
403 | [1] | |
404 | $ hg status -C |
|
404 | $ hg status -C | |
405 | ? d1/ca |
|
405 | ? d1/ca | |
406 | $ hg update -C |
|
406 | $ hg update -C | |
407 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
408 | $ rm d1/ca |
|
408 | $ rm d1/ca | |
409 |
|
409 | |||
410 | replace a symlink with a file |
|
410 | replace a symlink with a file | |
411 |
|
411 | |||
412 | $ ln -s ba d1/ca |
|
412 | $ ln -s ba d1/ca | |
413 | $ hg rename --force d1/ba d1/ca |
|
413 | $ hg rename --force d1/ba d1/ca | |
414 | $ hg status -C |
|
414 | $ hg status -C | |
415 | A d1/ca |
|
415 | A d1/ca | |
416 | d1/ba |
|
416 | d1/ba | |
417 | R d1/ba |
|
417 | R d1/ba | |
418 | $ hg update -C |
|
418 | $ hg update -C | |
419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
420 | $ rm d1/ca |
|
420 | $ rm d1/ca | |
421 | #endif |
|
421 | #endif | |
422 |
|
422 | |||
423 | do not copy more than one source file to the same destination file |
|
423 | do not copy more than one source file to the same destination file | |
424 |
|
424 | |||
425 | $ mkdir d3 |
|
425 | $ mkdir d3 | |
426 | $ hg rename d1/* d2/* d3 |
|
426 | $ hg rename d1/* d2/* d3 | |
427 | moving d1/d11/a1 to d3/d11/a1 |
|
427 | moving d1/d11/a1 to d3/d11/a1 | |
428 | d3/b: not overwriting - d2/b collides with d1/b |
|
428 | d3/b: not overwriting - d2/b collides with d1/b | |
429 | [1] |
|
429 | [1] | |
430 | $ hg status -C |
|
430 | $ hg status -C | |
431 | A d3/a |
|
431 | A d3/a | |
432 | d1/a |
|
432 | d1/a | |
433 | A d3/b |
|
433 | A d3/b | |
434 | d1/b |
|
434 | d1/b | |
435 | A d3/ba |
|
435 | A d3/ba | |
436 | d1/ba |
|
436 | d1/ba | |
437 | A d3/d11/a1 |
|
437 | A d3/d11/a1 | |
438 | d1/d11/a1 |
|
438 | d1/d11/a1 | |
439 | R d1/a |
|
439 | R d1/a | |
440 | R d1/b |
|
440 | R d1/b | |
441 | R d1/ba |
|
441 | R d1/ba | |
442 | R d1/d11/a1 |
|
442 | R d1/d11/a1 | |
443 | $ hg update -C |
|
443 | $ hg update -C | |
444 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
444 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
445 | $ rm -rf d3 |
|
445 | $ rm -rf d3 | |
446 |
|
446 | |||
447 | move a whole subtree with "hg rename ." |
|
447 | move a whole subtree with "hg rename ." | |
448 |
|
448 | |||
449 | $ mkdir d3 |
|
449 | $ mkdir d3 | |
450 | $ (cd d1; hg rename . ../d3) |
|
450 | $ (cd d1; hg rename . ../d3) | |
451 | moving a to ../d3/d1/a |
|
451 | moving a to ../d3/d1/a | |
452 | moving b to ../d3/d1/b |
|
452 | moving b to ../d3/d1/b | |
453 | moving ba to ../d3/d1/ba |
|
453 | moving ba to ../d3/d1/ba | |
454 | moving d11/a1 to ../d3/d1/d11/a1 |
|
454 | moving d11/a1 to ../d3/d1/d11/a1 | |
455 | $ hg status -C |
|
455 | $ hg status -C | |
456 | A d3/d1/a |
|
456 | A d3/d1/a | |
457 | d1/a |
|
457 | d1/a | |
458 | A d3/d1/b |
|
458 | A d3/d1/b | |
459 | d1/b |
|
459 | d1/b | |
460 | A d3/d1/ba |
|
460 | A d3/d1/ba | |
461 | d1/ba |
|
461 | d1/ba | |
462 | A d3/d1/d11/a1 |
|
462 | A d3/d1/d11/a1 | |
463 | d1/d11/a1 |
|
463 | d1/d11/a1 | |
464 | R d1/a |
|
464 | R d1/a | |
465 | R d1/b |
|
465 | R d1/b | |
466 | R d1/ba |
|
466 | R d1/ba | |
467 | R d1/d11/a1 |
|
467 | R d1/d11/a1 | |
468 | $ hg update -C |
|
468 | $ hg update -C | |
469 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
469 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
470 | $ rm -rf d3 |
|
470 | $ rm -rf d3 | |
471 |
|
471 | |||
472 | move a whole subtree with "hg rename --after ." |
|
472 | move a whole subtree with "hg rename --after ." | |
473 |
|
473 | |||
474 | $ mkdir d3 |
|
474 | $ mkdir d3 | |
475 | $ mv d1/* d3 |
|
475 | $ mv d1/* d3 | |
476 | $ (cd d1; hg rename --after . ../d3) |
|
476 | $ (cd d1; hg rename --after . ../d3) | |
477 | moving a to ../d3/a |
|
477 | moving a to ../d3/a | |
478 | moving b to ../d3/b |
|
478 | moving b to ../d3/b | |
479 | moving ba to ../d3/ba |
|
479 | moving ba to ../d3/ba | |
480 | moving d11/a1 to ../d3/d11/a1 |
|
480 | moving d11/a1 to ../d3/d11/a1 | |
481 | $ hg status -C |
|
481 | $ hg status -C | |
482 | A d3/a |
|
482 | A d3/a | |
483 | d1/a |
|
483 | d1/a | |
484 | A d3/b |
|
484 | A d3/b | |
485 | d1/b |
|
485 | d1/b | |
486 | A d3/ba |
|
486 | A d3/ba | |
487 | d1/ba |
|
487 | d1/ba | |
488 | A d3/d11/a1 |
|
488 | A d3/d11/a1 | |
489 | d1/d11/a1 |
|
489 | d1/d11/a1 | |
490 | R d1/a |
|
490 | R d1/a | |
491 | R d1/b |
|
491 | R d1/b | |
492 | R d1/ba |
|
492 | R d1/ba | |
493 | R d1/d11/a1 |
|
493 | R d1/d11/a1 | |
494 | $ hg update -C |
|
494 | $ hg update -C | |
495 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
495 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
496 | $ rm -rf d3 |
|
496 | $ rm -rf d3 | |
497 |
|
497 | |||
498 | move the parent tree with "hg rename .." |
|
498 | move the parent tree with "hg rename .." | |
499 |
|
499 | |||
500 | $ (cd d1/d11; hg rename .. ../../d3) |
|
500 | $ (cd d1/d11; hg rename .. ../../d3) | |
501 | moving ../a to ../../d3/a |
|
501 | moving ../a to ../../d3/a | |
502 | moving ../b to ../../d3/b |
|
502 | moving ../b to ../../d3/b | |
503 | moving ../ba to ../../d3/ba |
|
503 | moving ../ba to ../../d3/ba | |
504 | moving a1 to ../../d3/d11/a1 |
|
504 | moving a1 to ../../d3/d11/a1 | |
505 | $ hg status -C |
|
505 | $ hg status -C | |
506 | A d3/a |
|
506 | A d3/a | |
507 | d1/a |
|
507 | d1/a | |
508 | A d3/b |
|
508 | A d3/b | |
509 | d1/b |
|
509 | d1/b | |
510 | A d3/ba |
|
510 | A d3/ba | |
511 | d1/ba |
|
511 | d1/ba | |
512 | A d3/d11/a1 |
|
512 | A d3/d11/a1 | |
513 | d1/d11/a1 |
|
513 | d1/d11/a1 | |
514 | R d1/a |
|
514 | R d1/a | |
515 | R d1/b |
|
515 | R d1/b | |
516 | R d1/ba |
|
516 | R d1/ba | |
517 | R d1/d11/a1 |
|
517 | R d1/d11/a1 | |
518 | $ hg update -C |
|
518 | $ hg update -C | |
519 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
519 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
520 | $ rm -rf d3 |
|
520 | $ rm -rf d3 | |
521 |
|
521 | |||
522 | skip removed files |
|
522 | skip removed files | |
523 |
|
523 | |||
524 | $ hg remove d1/b |
|
524 | $ hg remove d1/b | |
525 | $ hg rename d1 d3 |
|
525 | $ hg rename d1 d3 | |
526 | moving d1/a to d3/a |
|
526 | moving d1/a to d3/a | |
527 | moving d1/ba to d3/ba |
|
527 | moving d1/ba to d3/ba | |
528 | moving d1/d11/a1 to d3/d11/a1 |
|
528 | moving d1/d11/a1 to d3/d11/a1 | |
529 | $ hg status -C |
|
529 | $ hg status -C | |
530 | A d3/a |
|
530 | A d3/a | |
531 | d1/a |
|
531 | d1/a | |
532 | A d3/ba |
|
532 | A d3/ba | |
533 | d1/ba |
|
533 | d1/ba | |
534 | A d3/d11/a1 |
|
534 | A d3/d11/a1 | |
535 | d1/d11/a1 |
|
535 | d1/d11/a1 | |
536 | R d1/a |
|
536 | R d1/a | |
537 | R d1/b |
|
537 | R d1/b | |
538 | R d1/ba |
|
538 | R d1/ba | |
539 | R d1/d11/a1 |
|
539 | R d1/d11/a1 | |
540 | $ hg update -C |
|
540 | $ hg update -C | |
541 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
541 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
542 | $ rm -rf d3 |
|
542 | $ rm -rf d3 | |
543 |
|
543 | |||
544 | transitive rename |
|
544 | transitive rename | |
545 |
|
545 | |||
546 | $ hg rename d1/b d1/bb |
|
546 | $ hg rename d1/b d1/bb | |
547 | $ hg rename d1/bb d1/bc |
|
547 | $ hg rename d1/bb d1/bc | |
548 | $ hg status -C |
|
548 | $ hg status -C | |
549 | A d1/bc |
|
549 | A d1/bc | |
550 | d1/b |
|
550 | d1/b | |
551 | R d1/b |
|
551 | R d1/b | |
552 | $ hg update -C |
|
552 | $ hg update -C | |
553 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
553 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
554 | $ rm d1/bc |
|
554 | $ rm d1/bc | |
555 |
|
555 | |||
556 | transitive rename --after |
|
556 | transitive rename --after | |
557 |
|
557 | |||
558 | $ hg rename d1/b d1/bb |
|
558 | $ hg rename d1/b d1/bb | |
559 | $ mv d1/bb d1/bc |
|
559 | $ mv d1/bb d1/bc | |
560 | $ hg rename --after d1/bb d1/bc |
|
560 | $ hg rename --after d1/bb d1/bc | |
561 | $ hg status -C |
|
561 | $ hg status -C | |
562 | A d1/bc |
|
562 | A d1/bc | |
563 | d1/b |
|
563 | d1/b | |
564 | R d1/b |
|
564 | R d1/b | |
565 | $ hg update -C |
|
565 | $ hg update -C | |
566 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
566 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
567 | $ rm d1/bc |
|
567 | $ rm d1/bc | |
568 |
|
568 | |||
569 | $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)" |
|
569 | $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)" | |
570 | # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b) |
|
570 | # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b) | |
571 | $ hg rename d1/b d1/bb |
|
571 | $ hg rename d1/b d1/bb | |
572 | $ echo "some stuff added to d1/bb" >> d1/bb |
|
572 | $ echo "some stuff added to d1/bb" >> d1/bb | |
573 | $ hg rename d1/bb d1/b |
|
573 | $ hg rename d1/bb d1/b | |
574 | $ hg status -C |
|
574 | $ hg status -C | |
575 | M d1/b |
|
575 | M d1/b | |
576 | $ hg update -C |
|
576 | $ hg update -C | |
577 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
577 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
578 |
|
578 | |||
579 | overwriting with renames (issue1959) |
|
579 | overwriting with renames (issue1959) | |
580 |
|
580 | |||
581 | $ hg rename d1/a d1/c |
|
581 | $ hg rename d1/a d1/c | |
582 | $ hg rename d1/b d1/a |
|
582 | $ hg rename d1/b d1/a | |
583 | $ hg status -C |
|
583 | $ hg status -C | |
584 | M d1/a |
|
584 | M d1/a | |
585 | d1/b |
|
585 | d1/b | |
586 | A d1/c |
|
586 | A d1/c | |
587 | d1/a |
|
587 | d1/a | |
588 | R d1/b |
|
588 | R d1/b | |
589 | $ hg diff --git |
|
589 | $ hg diff --git | |
590 | diff --git a/d1/a b/d1/a |
|
590 | diff --git a/d1/a b/d1/a | |
591 | --- a/d1/a |
|
591 | --- a/d1/a | |
592 | +++ b/d1/a |
|
592 | +++ b/d1/a | |
593 | @@ -1,1 +1,1 @@ |
|
593 | @@ -1,1 +1,1 @@ | |
594 | -d1/a |
|
594 | -d1/a | |
595 | +d1/b |
|
595 | +d1/b | |
596 | diff --git a/d1/b b/d1/b |
|
596 | diff --git a/d1/b b/d1/b | |
597 | deleted file mode 100644 |
|
597 | deleted file mode 100644 | |
598 | --- a/d1/b |
|
598 | --- a/d1/b | |
599 | +++ /dev/null |
|
599 | +++ /dev/null | |
600 | @@ -1,1 +0,0 @@ |
|
600 | @@ -1,1 +0,0 @@ | |
601 | -d1/b |
|
601 | -d1/b | |
602 | diff --git a/d1/a b/d1/c |
|
602 | diff --git a/d1/a b/d1/c | |
603 | copy from d1/a |
|
603 | copy from d1/a | |
604 | copy to d1/c |
|
604 | copy to d1/c | |
605 | $ hg update -C |
|
605 | $ hg update -C | |
606 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
606 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
607 | $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget' |
|
607 | $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget' | |
608 |
|
608 | |||
609 | check illegal path components |
|
609 | check illegal path components | |
610 |
|
610 | |||
611 | $ hg rename d1/d11/a1 .hg/foo |
|
611 | $ hg rename d1/d11/a1 .hg/foo | |
612 | abort: path contains illegal component: .hg/foo |
|
612 | abort: path contains illegal component: .hg/foo | |
613 |
[ |
|
613 | [10] | |
614 | $ hg status -C |
|
614 | $ hg status -C | |
615 | $ hg rename d1/d11/a1 ../foo |
|
615 | $ hg rename d1/d11/a1 ../foo | |
616 | abort: ../foo not under root '$TESTTMP' |
|
616 | abort: ../foo not under root '$TESTTMP' | |
617 | [255] |
|
617 | [255] | |
618 | $ hg status -C |
|
618 | $ hg status -C | |
619 |
|
619 | |||
620 | $ mv d1/d11/a1 .hg/foo |
|
620 | $ mv d1/d11/a1 .hg/foo | |
621 | $ hg rename --after d1/d11/a1 .hg/foo |
|
621 | $ hg rename --after d1/d11/a1 .hg/foo | |
622 | abort: path contains illegal component: .hg/foo |
|
622 | abort: path contains illegal component: .hg/foo | |
623 |
[ |
|
623 | [10] | |
624 | $ hg status -C |
|
624 | $ hg status -C | |
625 | ! d1/d11/a1 |
|
625 | ! d1/d11/a1 | |
626 | $ hg update -C |
|
626 | $ hg update -C | |
627 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
627 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
628 | $ rm .hg/foo |
|
628 | $ rm .hg/foo | |
629 |
|
629 | |||
630 | $ hg rename d1/d11/a1 .hg |
|
630 | $ hg rename d1/d11/a1 .hg | |
631 | abort: path contains illegal component: .hg/a1 |
|
631 | abort: path contains illegal component: .hg/a1 | |
632 |
[ |
|
632 | [10] | |
633 | $ hg --config extensions.largefiles= rename d1/d11/a1 .hg |
|
633 | $ hg --config extensions.largefiles= rename d1/d11/a1 .hg | |
634 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
634 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
635 | abort: path contains illegal component: .hg/a1 |
|
635 | abort: path contains illegal component: .hg/a1 | |
636 |
[ |
|
636 | [10] | |
637 | $ hg status -C |
|
637 | $ hg status -C | |
638 | $ hg rename d1/d11/a1 .. |
|
638 | $ hg rename d1/d11/a1 .. | |
639 | abort: ../a1 not under root '$TESTTMP' |
|
639 | abort: ../a1 not under root '$TESTTMP' | |
640 | [255] |
|
640 | [255] | |
641 | $ hg --config extensions.largefiles= rename d1/d11/a1 .. |
|
641 | $ hg --config extensions.largefiles= rename d1/d11/a1 .. | |
642 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
642 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
643 | abort: ../a1 not under root '$TESTTMP' |
|
643 | abort: ../a1 not under root '$TESTTMP' | |
644 | [255] |
|
644 | [255] | |
645 | $ hg status -C |
|
645 | $ hg status -C | |
646 |
|
646 | |||
647 | $ mv d1/d11/a1 .hg |
|
647 | $ mv d1/d11/a1 .hg | |
648 | $ hg rename --after d1/d11/a1 .hg |
|
648 | $ hg rename --after d1/d11/a1 .hg | |
649 | abort: path contains illegal component: .hg/a1 |
|
649 | abort: path contains illegal component: .hg/a1 | |
650 |
[ |
|
650 | [10] | |
651 | $ hg status -C |
|
651 | $ hg status -C | |
652 | ! d1/d11/a1 |
|
652 | ! d1/d11/a1 | |
653 | $ hg update -C |
|
653 | $ hg update -C | |
654 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
654 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
655 | $ rm .hg/a1 |
|
655 | $ rm .hg/a1 | |
656 |
|
656 | |||
657 | $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo) |
|
657 | $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo) | |
658 | abort: path contains illegal component: .hg/foo |
|
658 | abort: path contains illegal component: .hg/foo | |
659 |
[ |
|
659 | [10] | |
660 | $ hg status -C |
|
660 | $ hg status -C | |
661 | $ (cd d1/d11; hg rename ../../d2/b ../../../foo) |
|
661 | $ (cd d1/d11; hg rename ../../d2/b ../../../foo) | |
662 | abort: ../../../foo not under root '$TESTTMP' |
|
662 | abort: ../../../foo not under root '$TESTTMP' | |
663 | [255] |
|
663 | [255] | |
664 | $ hg status -C |
|
664 | $ hg status -C | |
665 |
|
665 | |||
666 | check that stat information such as mtime is preserved on rename - it's unclear |
|
666 | check that stat information such as mtime is preserved on rename - it's unclear | |
667 | whether the `touch` and `stat` commands are portable, so we mimic them using |
|
667 | whether the `touch` and `stat` commands are portable, so we mimic them using | |
668 | python. Not all platforms support precision of even one-second granularity, so |
|
668 | python. Not all platforms support precision of even one-second granularity, so | |
669 | we allow a rather generous fudge factor here; 1234567890 is 2009, and the |
|
669 | we allow a rather generous fudge factor here; 1234567890 is 2009, and the | |
670 | primary thing we care about is that it's not the machine's current time; |
|
670 | primary thing we care about is that it's not the machine's current time; | |
671 | hopefully it's really unlikely for a machine to have such a broken clock that |
|
671 | hopefully it's really unlikely for a machine to have such a broken clock that | |
672 | this test fails. :) |
|
672 | this test fails. :) | |
673 |
|
673 | |||
674 | $ mkdir mtime |
|
674 | $ mkdir mtime | |
675 | Create the file (as empty), then update its mtime and atime to be 1234567890. |
|
675 | Create the file (as empty), then update its mtime and atime to be 1234567890. | |
676 | >>> import os |
|
676 | >>> import os | |
677 | >>> filename = "mtime/f" |
|
677 | >>> filename = "mtime/f" | |
678 | >>> mtime = 1234567890 |
|
678 | >>> mtime = 1234567890 | |
679 | >>> open(filename, "w").close() |
|
679 | >>> open(filename, "w").close() | |
680 | >>> os.utime(filename, (mtime, mtime)) |
|
680 | >>> os.utime(filename, (mtime, mtime)) | |
681 | $ hg ci -qAm 'add mtime dir' |
|
681 | $ hg ci -qAm 'add mtime dir' | |
682 | "hg cp" does not preserve the mtime, so it should be newer than the 2009 |
|
682 | "hg cp" does not preserve the mtime, so it should be newer than the 2009 | |
683 | timestamp. |
|
683 | timestamp. | |
684 | $ hg cp -q mtime mtime_cp |
|
684 | $ hg cp -q mtime mtime_cp | |
685 | >>> from __future__ import print_function |
|
685 | >>> from __future__ import print_function | |
686 | >>> import os |
|
686 | >>> import os | |
687 | >>> filename = "mtime_cp/f" |
|
687 | >>> filename = "mtime_cp/f" | |
688 | >>> print(os.stat(filename).st_mtime < 1234567999) |
|
688 | >>> print(os.stat(filename).st_mtime < 1234567999) | |
689 | False |
|
689 | False | |
690 | "hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp |
|
690 | "hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp | |
691 | (modulo some fudge factor due to not every system supporting 1s-level |
|
691 | (modulo some fudge factor due to not every system supporting 1s-level | |
692 | precision). |
|
692 | precision). | |
693 | $ hg mv -q mtime mtime_mv |
|
693 | $ hg mv -q mtime mtime_mv | |
694 | >>> from __future__ import print_function |
|
694 | >>> from __future__ import print_function | |
695 | >>> import os |
|
695 | >>> import os | |
696 | >>> filename = "mtime_mv/f" |
|
696 | >>> filename = "mtime_mv/f" | |
697 | >>> print(os.stat(filename).st_mtime < 1234567999) |
|
697 | >>> print(os.stat(filename).st_mtime < 1234567999) | |
698 | True |
|
698 | True |
@@ -1,652 +1,652 b'' | |||||
1 | $ hg init t |
|
1 | $ hg init t | |
2 | $ cd t |
|
2 | $ cd t | |
3 | $ mkdir -p beans |
|
3 | $ mkdir -p beans | |
4 | $ for b in kidney navy turtle borlotti black pinto; do |
|
4 | $ for b in kidney navy turtle borlotti black pinto; do | |
5 | > echo $b > beans/$b |
|
5 | > echo $b > beans/$b | |
6 | > done |
|
6 | > done | |
7 | $ mkdir -p mammals/Procyonidae |
|
7 | $ mkdir -p mammals/Procyonidae | |
8 | $ for m in cacomistle coatimundi raccoon; do |
|
8 | $ for m in cacomistle coatimundi raccoon; do | |
9 | > echo $m > mammals/Procyonidae/$m |
|
9 | > echo $m > mammals/Procyonidae/$m | |
10 | > done |
|
10 | > done | |
11 | $ echo skunk > mammals/skunk |
|
11 | $ echo skunk > mammals/skunk | |
12 | $ echo fennel > fennel |
|
12 | $ echo fennel > fennel | |
13 | $ echo fenugreek > fenugreek |
|
13 | $ echo fenugreek > fenugreek | |
14 | $ echo fiddlehead > fiddlehead |
|
14 | $ echo fiddlehead > fiddlehead | |
15 | $ hg addremove |
|
15 | $ hg addremove | |
16 | adding beans/black |
|
16 | adding beans/black | |
17 | adding beans/borlotti |
|
17 | adding beans/borlotti | |
18 | adding beans/kidney |
|
18 | adding beans/kidney | |
19 | adding beans/navy |
|
19 | adding beans/navy | |
20 | adding beans/pinto |
|
20 | adding beans/pinto | |
21 | adding beans/turtle |
|
21 | adding beans/turtle | |
22 | adding fennel |
|
22 | adding fennel | |
23 | adding fenugreek |
|
23 | adding fenugreek | |
24 | adding fiddlehead |
|
24 | adding fiddlehead | |
25 | adding mammals/Procyonidae/cacomistle |
|
25 | adding mammals/Procyonidae/cacomistle | |
26 | adding mammals/Procyonidae/coatimundi |
|
26 | adding mammals/Procyonidae/coatimundi | |
27 | adding mammals/Procyonidae/raccoon |
|
27 | adding mammals/Procyonidae/raccoon | |
28 | adding mammals/skunk |
|
28 | adding mammals/skunk | |
29 | $ hg commit -m "commit #0" |
|
29 | $ hg commit -m "commit #0" | |
30 |
|
30 | |||
31 | $ hg debugwalk -v |
|
31 | $ hg debugwalk -v | |
32 | * matcher: |
|
32 | * matcher: | |
33 | <alwaysmatcher> |
|
33 | <alwaysmatcher> | |
34 | f beans/black beans/black |
|
34 | f beans/black beans/black | |
35 | f beans/borlotti beans/borlotti |
|
35 | f beans/borlotti beans/borlotti | |
36 | f beans/kidney beans/kidney |
|
36 | f beans/kidney beans/kidney | |
37 | f beans/navy beans/navy |
|
37 | f beans/navy beans/navy | |
38 | f beans/pinto beans/pinto |
|
38 | f beans/pinto beans/pinto | |
39 | f beans/turtle beans/turtle |
|
39 | f beans/turtle beans/turtle | |
40 | f fennel fennel |
|
40 | f fennel fennel | |
41 | f fenugreek fenugreek |
|
41 | f fenugreek fenugreek | |
42 | f fiddlehead fiddlehead |
|
42 | f fiddlehead fiddlehead | |
43 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
43 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
44 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
44 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
45 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
45 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
46 | f mammals/skunk mammals/skunk |
|
46 | f mammals/skunk mammals/skunk | |
47 | $ hg debugwalk -v -I. |
|
47 | $ hg debugwalk -v -I. | |
48 | * matcher: |
|
48 | * matcher: | |
49 | <includematcher includes=''> |
|
49 | <includematcher includes=''> | |
50 | f beans/black beans/black |
|
50 | f beans/black beans/black | |
51 | f beans/borlotti beans/borlotti |
|
51 | f beans/borlotti beans/borlotti | |
52 | f beans/kidney beans/kidney |
|
52 | f beans/kidney beans/kidney | |
53 | f beans/navy beans/navy |
|
53 | f beans/navy beans/navy | |
54 | f beans/pinto beans/pinto |
|
54 | f beans/pinto beans/pinto | |
55 | f beans/turtle beans/turtle |
|
55 | f beans/turtle beans/turtle | |
56 | f fennel fennel |
|
56 | f fennel fennel | |
57 | f fenugreek fenugreek |
|
57 | f fenugreek fenugreek | |
58 | f fiddlehead fiddlehead |
|
58 | f fiddlehead fiddlehead | |
59 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
59 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
60 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
60 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
61 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
61 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
62 | f mammals/skunk mammals/skunk |
|
62 | f mammals/skunk mammals/skunk | |
63 |
|
63 | |||
64 | $ cd mammals |
|
64 | $ cd mammals | |
65 | $ hg debugwalk -v |
|
65 | $ hg debugwalk -v | |
66 | * matcher: |
|
66 | * matcher: | |
67 | <alwaysmatcher> |
|
67 | <alwaysmatcher> | |
68 | f beans/black ../beans/black |
|
68 | f beans/black ../beans/black | |
69 | f beans/borlotti ../beans/borlotti |
|
69 | f beans/borlotti ../beans/borlotti | |
70 | f beans/kidney ../beans/kidney |
|
70 | f beans/kidney ../beans/kidney | |
71 | f beans/navy ../beans/navy |
|
71 | f beans/navy ../beans/navy | |
72 | f beans/pinto ../beans/pinto |
|
72 | f beans/pinto ../beans/pinto | |
73 | f beans/turtle ../beans/turtle |
|
73 | f beans/turtle ../beans/turtle | |
74 | f fennel ../fennel |
|
74 | f fennel ../fennel | |
75 | f fenugreek ../fenugreek |
|
75 | f fenugreek ../fenugreek | |
76 | f fiddlehead ../fiddlehead |
|
76 | f fiddlehead ../fiddlehead | |
77 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
77 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
78 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
78 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
79 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
79 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
80 | f mammals/skunk skunk |
|
80 | f mammals/skunk skunk | |
81 | $ hg debugwalk -v -X ../beans |
|
81 | $ hg debugwalk -v -X ../beans | |
82 | * matcher: |
|
82 | * matcher: | |
83 | <differencematcher |
|
83 | <differencematcher | |
84 | m1=<alwaysmatcher>, |
|
84 | m1=<alwaysmatcher>, | |
85 | m2=<includematcher includes='beans(?:/|$)'>> |
|
85 | m2=<includematcher includes='beans(?:/|$)'>> | |
86 | f fennel ../fennel |
|
86 | f fennel ../fennel | |
87 | f fenugreek ../fenugreek |
|
87 | f fenugreek ../fenugreek | |
88 | f fiddlehead ../fiddlehead |
|
88 | f fiddlehead ../fiddlehead | |
89 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
89 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
90 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
90 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
91 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
91 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
92 | f mammals/skunk skunk |
|
92 | f mammals/skunk skunk | |
93 | $ hg debugwalk -v -I '*k' |
|
93 | $ hg debugwalk -v -I '*k' | |
94 | * matcher: |
|
94 | * matcher: | |
95 | <includematcher includes='mammals/[^/]*k(?:/|$)'> |
|
95 | <includematcher includes='mammals/[^/]*k(?:/|$)'> | |
96 | f mammals/skunk skunk |
|
96 | f mammals/skunk skunk | |
97 | $ hg debugwalk -v -I 'glob:*k' |
|
97 | $ hg debugwalk -v -I 'glob:*k' | |
98 | * matcher: |
|
98 | * matcher: | |
99 | <includematcher includes='mammals/[^/]*k(?:/|$)'> |
|
99 | <includematcher includes='mammals/[^/]*k(?:/|$)'> | |
100 | f mammals/skunk skunk |
|
100 | f mammals/skunk skunk | |
101 | $ hg debugwalk -v -I 'relglob:*k' |
|
101 | $ hg debugwalk -v -I 'relglob:*k' | |
102 | * matcher: |
|
102 | * matcher: | |
103 | <includematcher includes='.*k(?:/|$)'> |
|
103 | <includematcher includes='.*k(?:/|$)'> | |
104 | f beans/black ../beans/black |
|
104 | f beans/black ../beans/black | |
105 | f fenugreek ../fenugreek |
|
105 | f fenugreek ../fenugreek | |
106 | f mammals/skunk skunk |
|
106 | f mammals/skunk skunk | |
107 | $ hg debugwalk -v -I 'relglob:*k' . |
|
107 | $ hg debugwalk -v -I 'relglob:*k' . | |
108 | * matcher: |
|
108 | * matcher: | |
109 | <intersectionmatcher |
|
109 | <intersectionmatcher | |
110 | m1=<patternmatcher patterns='mammals(?:/|$)'>, |
|
110 | m1=<patternmatcher patterns='mammals(?:/|$)'>, | |
111 | m2=<includematcher includes='.*k(?:/|$)'>> |
|
111 | m2=<includematcher includes='.*k(?:/|$)'>> | |
112 | f mammals/skunk skunk |
|
112 | f mammals/skunk skunk | |
113 | $ hg debugwalk -v -I 're:.*k$' |
|
113 | $ hg debugwalk -v -I 're:.*k$' | |
114 | * matcher: |
|
114 | * matcher: | |
115 | <includematcher includes='.*k$'> |
|
115 | <includematcher includes='.*k$'> | |
116 | f beans/black ../beans/black |
|
116 | f beans/black ../beans/black | |
117 | f fenugreek ../fenugreek |
|
117 | f fenugreek ../fenugreek | |
118 | f mammals/skunk skunk |
|
118 | f mammals/skunk skunk | |
119 | $ hg debugwalk -v -I 'relre:.*k$' |
|
119 | $ hg debugwalk -v -I 'relre:.*k$' | |
120 | * matcher: |
|
120 | * matcher: | |
121 | <includematcher includes='.*.*k$'> |
|
121 | <includematcher includes='.*.*k$'> | |
122 | f beans/black ../beans/black |
|
122 | f beans/black ../beans/black | |
123 | f fenugreek ../fenugreek |
|
123 | f fenugreek ../fenugreek | |
124 | f mammals/skunk skunk |
|
124 | f mammals/skunk skunk | |
125 | $ hg debugwalk -v -I 'path:beans' |
|
125 | $ hg debugwalk -v -I 'path:beans' | |
126 | * matcher: |
|
126 | * matcher: | |
127 | <includematcher includes='beans(?:/|$)'> |
|
127 | <includematcher includes='beans(?:/|$)'> | |
128 | f beans/black ../beans/black |
|
128 | f beans/black ../beans/black | |
129 | f beans/borlotti ../beans/borlotti |
|
129 | f beans/borlotti ../beans/borlotti | |
130 | f beans/kidney ../beans/kidney |
|
130 | f beans/kidney ../beans/kidney | |
131 | f beans/navy ../beans/navy |
|
131 | f beans/navy ../beans/navy | |
132 | f beans/pinto ../beans/pinto |
|
132 | f beans/pinto ../beans/pinto | |
133 | f beans/turtle ../beans/turtle |
|
133 | f beans/turtle ../beans/turtle | |
134 | $ hg debugwalk -v -I 'relpath:detour/../../beans' |
|
134 | $ hg debugwalk -v -I 'relpath:detour/../../beans' | |
135 | * matcher: |
|
135 | * matcher: | |
136 | <includematcher includes='beans(?:/|$)'> |
|
136 | <includematcher includes='beans(?:/|$)'> | |
137 | f beans/black ../beans/black |
|
137 | f beans/black ../beans/black | |
138 | f beans/borlotti ../beans/borlotti |
|
138 | f beans/borlotti ../beans/borlotti | |
139 | f beans/kidney ../beans/kidney |
|
139 | f beans/kidney ../beans/kidney | |
140 | f beans/navy ../beans/navy |
|
140 | f beans/navy ../beans/navy | |
141 | f beans/pinto ../beans/pinto |
|
141 | f beans/pinto ../beans/pinto | |
142 | f beans/turtle ../beans/turtle |
|
142 | f beans/turtle ../beans/turtle | |
143 |
|
143 | |||
144 | $ hg debugwalk -v 'rootfilesin:' |
|
144 | $ hg debugwalk -v 'rootfilesin:' | |
145 | * matcher: |
|
145 | * matcher: | |
146 | <patternmatcher patterns="rootfilesin: ['.']"> |
|
146 | <patternmatcher patterns="rootfilesin: ['.']"> | |
147 | f fennel ../fennel |
|
147 | f fennel ../fennel | |
148 | f fenugreek ../fenugreek |
|
148 | f fenugreek ../fenugreek | |
149 | f fiddlehead ../fiddlehead |
|
149 | f fiddlehead ../fiddlehead | |
150 | $ hg debugwalk -v -I 'rootfilesin:' |
|
150 | $ hg debugwalk -v -I 'rootfilesin:' | |
151 | * matcher: |
|
151 | * matcher: | |
152 | <includematcher includes="rootfilesin: ['.']"> |
|
152 | <includematcher includes="rootfilesin: ['.']"> | |
153 | f fennel ../fennel |
|
153 | f fennel ../fennel | |
154 | f fenugreek ../fenugreek |
|
154 | f fenugreek ../fenugreek | |
155 | f fiddlehead ../fiddlehead |
|
155 | f fiddlehead ../fiddlehead | |
156 | $ hg debugwalk -v 'rootfilesin:.' |
|
156 | $ hg debugwalk -v 'rootfilesin:.' | |
157 | * matcher: |
|
157 | * matcher: | |
158 | <patternmatcher patterns="rootfilesin: ['.']"> |
|
158 | <patternmatcher patterns="rootfilesin: ['.']"> | |
159 | f fennel ../fennel |
|
159 | f fennel ../fennel | |
160 | f fenugreek ../fenugreek |
|
160 | f fenugreek ../fenugreek | |
161 | f fiddlehead ../fiddlehead |
|
161 | f fiddlehead ../fiddlehead | |
162 | $ hg debugwalk -v -I 'rootfilesin:.' |
|
162 | $ hg debugwalk -v -I 'rootfilesin:.' | |
163 | * matcher: |
|
163 | * matcher: | |
164 | <includematcher includes="rootfilesin: ['.']"> |
|
164 | <includematcher includes="rootfilesin: ['.']"> | |
165 | f fennel ../fennel |
|
165 | f fennel ../fennel | |
166 | f fenugreek ../fenugreek |
|
166 | f fenugreek ../fenugreek | |
167 | f fiddlehead ../fiddlehead |
|
167 | f fiddlehead ../fiddlehead | |
168 | $ hg debugwalk -v -X 'rootfilesin:' |
|
168 | $ hg debugwalk -v -X 'rootfilesin:' | |
169 | * matcher: |
|
169 | * matcher: | |
170 | <differencematcher |
|
170 | <differencematcher | |
171 | m1=<alwaysmatcher>, |
|
171 | m1=<alwaysmatcher>, | |
172 | m2=<includematcher includes="rootfilesin: ['.']">> |
|
172 | m2=<includematcher includes="rootfilesin: ['.']">> | |
173 | f beans/black ../beans/black |
|
173 | f beans/black ../beans/black | |
174 | f beans/borlotti ../beans/borlotti |
|
174 | f beans/borlotti ../beans/borlotti | |
175 | f beans/kidney ../beans/kidney |
|
175 | f beans/kidney ../beans/kidney | |
176 | f beans/navy ../beans/navy |
|
176 | f beans/navy ../beans/navy | |
177 | f beans/pinto ../beans/pinto |
|
177 | f beans/pinto ../beans/pinto | |
178 | f beans/turtle ../beans/turtle |
|
178 | f beans/turtle ../beans/turtle | |
179 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
179 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
180 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
180 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
181 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
181 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
182 | f mammals/skunk skunk |
|
182 | f mammals/skunk skunk | |
183 | $ hg debugwalk -v 'rootfilesin:fennel' |
|
183 | $ hg debugwalk -v 'rootfilesin:fennel' | |
184 | * matcher: |
|
184 | * matcher: | |
185 | <patternmatcher patterns="rootfilesin: ['fennel']"> |
|
185 | <patternmatcher patterns="rootfilesin: ['fennel']"> | |
186 | $ hg debugwalk -v -I 'rootfilesin:fennel' |
|
186 | $ hg debugwalk -v -I 'rootfilesin:fennel' | |
187 | * matcher: |
|
187 | * matcher: | |
188 | <includematcher includes="rootfilesin: ['fennel']"> |
|
188 | <includematcher includes="rootfilesin: ['fennel']"> | |
189 | $ hg debugwalk -v 'rootfilesin:skunk' |
|
189 | $ hg debugwalk -v 'rootfilesin:skunk' | |
190 | * matcher: |
|
190 | * matcher: | |
191 | <patternmatcher patterns="rootfilesin: ['skunk']"> |
|
191 | <patternmatcher patterns="rootfilesin: ['skunk']"> | |
192 | $ hg debugwalk -v -I 'rootfilesin:skunk' |
|
192 | $ hg debugwalk -v -I 'rootfilesin:skunk' | |
193 | * matcher: |
|
193 | * matcher: | |
194 | <includematcher includes="rootfilesin: ['skunk']"> |
|
194 | <includematcher includes="rootfilesin: ['skunk']"> | |
195 | $ hg debugwalk -v 'rootfilesin:beans' |
|
195 | $ hg debugwalk -v 'rootfilesin:beans' | |
196 | * matcher: |
|
196 | * matcher: | |
197 | <patternmatcher patterns="rootfilesin: ['beans']"> |
|
197 | <patternmatcher patterns="rootfilesin: ['beans']"> | |
198 | f beans/black ../beans/black |
|
198 | f beans/black ../beans/black | |
199 | f beans/borlotti ../beans/borlotti |
|
199 | f beans/borlotti ../beans/borlotti | |
200 | f beans/kidney ../beans/kidney |
|
200 | f beans/kidney ../beans/kidney | |
201 | f beans/navy ../beans/navy |
|
201 | f beans/navy ../beans/navy | |
202 | f beans/pinto ../beans/pinto |
|
202 | f beans/pinto ../beans/pinto | |
203 | f beans/turtle ../beans/turtle |
|
203 | f beans/turtle ../beans/turtle | |
204 | $ hg debugwalk -v -I 'rootfilesin:beans' |
|
204 | $ hg debugwalk -v -I 'rootfilesin:beans' | |
205 | * matcher: |
|
205 | * matcher: | |
206 | <includematcher includes="rootfilesin: ['beans']"> |
|
206 | <includematcher includes="rootfilesin: ['beans']"> | |
207 | f beans/black ../beans/black |
|
207 | f beans/black ../beans/black | |
208 | f beans/borlotti ../beans/borlotti |
|
208 | f beans/borlotti ../beans/borlotti | |
209 | f beans/kidney ../beans/kidney |
|
209 | f beans/kidney ../beans/kidney | |
210 | f beans/navy ../beans/navy |
|
210 | f beans/navy ../beans/navy | |
211 | f beans/pinto ../beans/pinto |
|
211 | f beans/pinto ../beans/pinto | |
212 | f beans/turtle ../beans/turtle |
|
212 | f beans/turtle ../beans/turtle | |
213 | $ hg debugwalk -v 'rootfilesin:mammals' |
|
213 | $ hg debugwalk -v 'rootfilesin:mammals' | |
214 | * matcher: |
|
214 | * matcher: | |
215 | <patternmatcher patterns="rootfilesin: ['mammals']"> |
|
215 | <patternmatcher patterns="rootfilesin: ['mammals']"> | |
216 | f mammals/skunk skunk |
|
216 | f mammals/skunk skunk | |
217 | $ hg debugwalk -v -I 'rootfilesin:mammals' |
|
217 | $ hg debugwalk -v -I 'rootfilesin:mammals' | |
218 | * matcher: |
|
218 | * matcher: | |
219 | <includematcher includes="rootfilesin: ['mammals']"> |
|
219 | <includematcher includes="rootfilesin: ['mammals']"> | |
220 | f mammals/skunk skunk |
|
220 | f mammals/skunk skunk | |
221 | $ hg debugwalk -v 'rootfilesin:mammals/' |
|
221 | $ hg debugwalk -v 'rootfilesin:mammals/' | |
222 | * matcher: |
|
222 | * matcher: | |
223 | <patternmatcher patterns="rootfilesin: ['mammals']"> |
|
223 | <patternmatcher patterns="rootfilesin: ['mammals']"> | |
224 | f mammals/skunk skunk |
|
224 | f mammals/skunk skunk | |
225 | $ hg debugwalk -v -I 'rootfilesin:mammals/' |
|
225 | $ hg debugwalk -v -I 'rootfilesin:mammals/' | |
226 | * matcher: |
|
226 | * matcher: | |
227 | <includematcher includes="rootfilesin: ['mammals']"> |
|
227 | <includematcher includes="rootfilesin: ['mammals']"> | |
228 | f mammals/skunk skunk |
|
228 | f mammals/skunk skunk | |
229 | $ hg debugwalk -v -X 'rootfilesin:mammals' |
|
229 | $ hg debugwalk -v -X 'rootfilesin:mammals' | |
230 | * matcher: |
|
230 | * matcher: | |
231 | <differencematcher |
|
231 | <differencematcher | |
232 | m1=<alwaysmatcher>, |
|
232 | m1=<alwaysmatcher>, | |
233 | m2=<includematcher includes="rootfilesin: ['mammals']">> |
|
233 | m2=<includematcher includes="rootfilesin: ['mammals']">> | |
234 | f beans/black ../beans/black |
|
234 | f beans/black ../beans/black | |
235 | f beans/borlotti ../beans/borlotti |
|
235 | f beans/borlotti ../beans/borlotti | |
236 | f beans/kidney ../beans/kidney |
|
236 | f beans/kidney ../beans/kidney | |
237 | f beans/navy ../beans/navy |
|
237 | f beans/navy ../beans/navy | |
238 | f beans/pinto ../beans/pinto |
|
238 | f beans/pinto ../beans/pinto | |
239 | f beans/turtle ../beans/turtle |
|
239 | f beans/turtle ../beans/turtle | |
240 | f fennel ../fennel |
|
240 | f fennel ../fennel | |
241 | f fenugreek ../fenugreek |
|
241 | f fenugreek ../fenugreek | |
242 | f fiddlehead ../fiddlehead |
|
242 | f fiddlehead ../fiddlehead | |
243 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
243 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
244 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
244 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
245 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
245 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
246 |
|
246 | |||
247 | $ hg debugwalk -v . |
|
247 | $ hg debugwalk -v . | |
248 | * matcher: |
|
248 | * matcher: | |
249 | <patternmatcher patterns='mammals(?:/|$)'> |
|
249 | <patternmatcher patterns='mammals(?:/|$)'> | |
250 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
250 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
251 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
251 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
252 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
252 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
253 | f mammals/skunk skunk |
|
253 | f mammals/skunk skunk | |
254 | $ hg debugwalk -v -I. |
|
254 | $ hg debugwalk -v -I. | |
255 | * matcher: |
|
255 | * matcher: | |
256 | <includematcher includes='mammals(?:/|$)'> |
|
256 | <includematcher includes='mammals(?:/|$)'> | |
257 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
257 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
258 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
258 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
259 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
259 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
260 | f mammals/skunk skunk |
|
260 | f mammals/skunk skunk | |
261 | $ hg debugwalk -v Procyonidae |
|
261 | $ hg debugwalk -v Procyonidae | |
262 | * matcher: |
|
262 | * matcher: | |
263 | <patternmatcher patterns='mammals/Procyonidae(?:/|$)'> |
|
263 | <patternmatcher patterns='mammals/Procyonidae(?:/|$)'> | |
264 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
264 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
265 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
265 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
266 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
266 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
267 |
|
267 | |||
268 | $ cd Procyonidae |
|
268 | $ cd Procyonidae | |
269 | $ hg debugwalk -v . |
|
269 | $ hg debugwalk -v . | |
270 | * matcher: |
|
270 | * matcher: | |
271 | <patternmatcher patterns='mammals/Procyonidae(?:/|$)'> |
|
271 | <patternmatcher patterns='mammals/Procyonidae(?:/|$)'> | |
272 | f mammals/Procyonidae/cacomistle cacomistle |
|
272 | f mammals/Procyonidae/cacomistle cacomistle | |
273 | f mammals/Procyonidae/coatimundi coatimundi |
|
273 | f mammals/Procyonidae/coatimundi coatimundi | |
274 | f mammals/Procyonidae/raccoon raccoon |
|
274 | f mammals/Procyonidae/raccoon raccoon | |
275 | $ hg debugwalk -v .. |
|
275 | $ hg debugwalk -v .. | |
276 | * matcher: |
|
276 | * matcher: | |
277 | <patternmatcher patterns='mammals(?:/|$)'> |
|
277 | <patternmatcher patterns='mammals(?:/|$)'> | |
278 | f mammals/Procyonidae/cacomistle cacomistle |
|
278 | f mammals/Procyonidae/cacomistle cacomistle | |
279 | f mammals/Procyonidae/coatimundi coatimundi |
|
279 | f mammals/Procyonidae/coatimundi coatimundi | |
280 | f mammals/Procyonidae/raccoon raccoon |
|
280 | f mammals/Procyonidae/raccoon raccoon | |
281 | f mammals/skunk ../skunk |
|
281 | f mammals/skunk ../skunk | |
282 | $ cd .. |
|
282 | $ cd .. | |
283 |
|
283 | |||
284 | $ hg debugwalk -v ../beans |
|
284 | $ hg debugwalk -v ../beans | |
285 | * matcher: |
|
285 | * matcher: | |
286 | <patternmatcher patterns='beans(?:/|$)'> |
|
286 | <patternmatcher patterns='beans(?:/|$)'> | |
287 | f beans/black ../beans/black |
|
287 | f beans/black ../beans/black | |
288 | f beans/borlotti ../beans/borlotti |
|
288 | f beans/borlotti ../beans/borlotti | |
289 | f beans/kidney ../beans/kidney |
|
289 | f beans/kidney ../beans/kidney | |
290 | f beans/navy ../beans/navy |
|
290 | f beans/navy ../beans/navy | |
291 | f beans/pinto ../beans/pinto |
|
291 | f beans/pinto ../beans/pinto | |
292 | f beans/turtle ../beans/turtle |
|
292 | f beans/turtle ../beans/turtle | |
293 | $ hg debugwalk -v . |
|
293 | $ hg debugwalk -v . | |
294 | * matcher: |
|
294 | * matcher: | |
295 | <patternmatcher patterns='mammals(?:/|$)'> |
|
295 | <patternmatcher patterns='mammals(?:/|$)'> | |
296 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle |
|
296 | f mammals/Procyonidae/cacomistle Procyonidae/cacomistle | |
297 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi |
|
297 | f mammals/Procyonidae/coatimundi Procyonidae/coatimundi | |
298 | f mammals/Procyonidae/raccoon Procyonidae/raccoon |
|
298 | f mammals/Procyonidae/raccoon Procyonidae/raccoon | |
299 | f mammals/skunk skunk |
|
299 | f mammals/skunk skunk | |
300 | $ hg debugwalk -v .hg |
|
300 | $ hg debugwalk -v .hg | |
301 | abort: path 'mammals/.hg' is inside nested repo 'mammals' |
|
301 | abort: path 'mammals/.hg' is inside nested repo 'mammals' | |
302 |
[ |
|
302 | [10] | |
303 | $ hg debugwalk -v ../.hg |
|
303 | $ hg debugwalk -v ../.hg | |
304 | abort: path contains illegal component: .hg |
|
304 | abort: path contains illegal component: .hg | |
305 |
[ |
|
305 | [10] | |
306 | $ cd .. |
|
306 | $ cd .. | |
307 |
|
307 | |||
308 | $ hg debugwalk -v -Ibeans |
|
308 | $ hg debugwalk -v -Ibeans | |
309 | * matcher: |
|
309 | * matcher: | |
310 | <includematcher includes='beans(?:/|$)'> |
|
310 | <includematcher includes='beans(?:/|$)'> | |
311 | f beans/black beans/black |
|
311 | f beans/black beans/black | |
312 | f beans/borlotti beans/borlotti |
|
312 | f beans/borlotti beans/borlotti | |
313 | f beans/kidney beans/kidney |
|
313 | f beans/kidney beans/kidney | |
314 | f beans/navy beans/navy |
|
314 | f beans/navy beans/navy | |
315 | f beans/pinto beans/pinto |
|
315 | f beans/pinto beans/pinto | |
316 | f beans/turtle beans/turtle |
|
316 | f beans/turtle beans/turtle | |
317 | $ hg debugwalk -v -I '{*,{b,m}*/*}k' |
|
317 | $ hg debugwalk -v -I '{*,{b,m}*/*}k' | |
318 | * matcher: |
|
318 | * matcher: | |
319 | <includematcher includes='(?:[^/]*|(?:b|m)[^/]*/[^/]*)k(?:/|$)'> |
|
319 | <includematcher includes='(?:[^/]*|(?:b|m)[^/]*/[^/]*)k(?:/|$)'> | |
320 | f beans/black beans/black |
|
320 | f beans/black beans/black | |
321 | f fenugreek fenugreek |
|
321 | f fenugreek fenugreek | |
322 | f mammals/skunk mammals/skunk |
|
322 | f mammals/skunk mammals/skunk | |
323 | $ hg debugwalk -v -Ibeans mammals |
|
323 | $ hg debugwalk -v -Ibeans mammals | |
324 | * matcher: |
|
324 | * matcher: | |
325 | <intersectionmatcher |
|
325 | <intersectionmatcher | |
326 | m1=<patternmatcher patterns='mammals(?:/|$)'>, |
|
326 | m1=<patternmatcher patterns='mammals(?:/|$)'>, | |
327 | m2=<includematcher includes='beans(?:/|$)'>> |
|
327 | m2=<includematcher includes='beans(?:/|$)'>> | |
328 | $ hg debugwalk -v -Inon-existent |
|
328 | $ hg debugwalk -v -Inon-existent | |
329 | * matcher: |
|
329 | * matcher: | |
330 | <includematcher includes='non\\-existent(?:/|$)'> |
|
330 | <includematcher includes='non\\-existent(?:/|$)'> | |
331 | $ hg debugwalk -v -Inon-existent -Ibeans/black |
|
331 | $ hg debugwalk -v -Inon-existent -Ibeans/black | |
332 | * matcher: |
|
332 | * matcher: | |
333 | <includematcher includes='non\\-existent(?:/|$)|beans/black(?:/|$)'> |
|
333 | <includematcher includes='non\\-existent(?:/|$)|beans/black(?:/|$)'> | |
334 | f beans/black beans/black |
|
334 | f beans/black beans/black | |
335 | $ hg debugwalk -v -Ibeans beans/black |
|
335 | $ hg debugwalk -v -Ibeans beans/black | |
336 | * matcher: |
|
336 | * matcher: | |
337 | <intersectionmatcher |
|
337 | <intersectionmatcher | |
338 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, |
|
338 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, | |
339 | m2=<includematcher includes='beans(?:/|$)'>> |
|
339 | m2=<includematcher includes='beans(?:/|$)'>> | |
340 | f beans/black beans/black exact |
|
340 | f beans/black beans/black exact | |
341 | $ hg debugwalk -v -Ibeans/black beans |
|
341 | $ hg debugwalk -v -Ibeans/black beans | |
342 | * matcher: |
|
342 | * matcher: | |
343 | <intersectionmatcher |
|
343 | <intersectionmatcher | |
344 | m1=<patternmatcher patterns='beans(?:/|$)'>, |
|
344 | m1=<patternmatcher patterns='beans(?:/|$)'>, | |
345 | m2=<includematcher includes='beans/black(?:/|$)'>> |
|
345 | m2=<includematcher includes='beans/black(?:/|$)'>> | |
346 | f beans/black beans/black |
|
346 | f beans/black beans/black | |
347 | $ hg debugwalk -v -Xbeans/black beans |
|
347 | $ hg debugwalk -v -Xbeans/black beans | |
348 | * matcher: |
|
348 | * matcher: | |
349 | <differencematcher |
|
349 | <differencematcher | |
350 | m1=<patternmatcher patterns='beans(?:/|$)'>, |
|
350 | m1=<patternmatcher patterns='beans(?:/|$)'>, | |
351 | m2=<includematcher includes='beans/black(?:/|$)'>> |
|
351 | m2=<includematcher includes='beans/black(?:/|$)'>> | |
352 | f beans/borlotti beans/borlotti |
|
352 | f beans/borlotti beans/borlotti | |
353 | f beans/kidney beans/kidney |
|
353 | f beans/kidney beans/kidney | |
354 | f beans/navy beans/navy |
|
354 | f beans/navy beans/navy | |
355 | f beans/pinto beans/pinto |
|
355 | f beans/pinto beans/pinto | |
356 | f beans/turtle beans/turtle |
|
356 | f beans/turtle beans/turtle | |
357 | $ hg debugwalk -v -Xbeans/black -Ibeans |
|
357 | $ hg debugwalk -v -Xbeans/black -Ibeans | |
358 | * matcher: |
|
358 | * matcher: | |
359 | <differencematcher |
|
359 | <differencematcher | |
360 | m1=<includematcher includes='beans(?:/|$)'>, |
|
360 | m1=<includematcher includes='beans(?:/|$)'>, | |
361 | m2=<includematcher includes='beans/black(?:/|$)'>> |
|
361 | m2=<includematcher includes='beans/black(?:/|$)'>> | |
362 | f beans/borlotti beans/borlotti |
|
362 | f beans/borlotti beans/borlotti | |
363 | f beans/kidney beans/kidney |
|
363 | f beans/kidney beans/kidney | |
364 | f beans/navy beans/navy |
|
364 | f beans/navy beans/navy | |
365 | f beans/pinto beans/pinto |
|
365 | f beans/pinto beans/pinto | |
366 | f beans/turtle beans/turtle |
|
366 | f beans/turtle beans/turtle | |
367 | $ hg debugwalk -v -Xbeans/black beans/black |
|
367 | $ hg debugwalk -v -Xbeans/black beans/black | |
368 | * matcher: |
|
368 | * matcher: | |
369 | <differencematcher |
|
369 | <differencematcher | |
370 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, |
|
370 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, | |
371 | m2=<includematcher includes='beans/black(?:/|$)'>> |
|
371 | m2=<includematcher includes='beans/black(?:/|$)'>> | |
372 | $ hg debugwalk -v -Xbeans/black -Ibeans/black |
|
372 | $ hg debugwalk -v -Xbeans/black -Ibeans/black | |
373 | * matcher: |
|
373 | * matcher: | |
374 | <differencematcher |
|
374 | <differencematcher | |
375 | m1=<includematcher includes='beans/black(?:/|$)'>, |
|
375 | m1=<includematcher includes='beans/black(?:/|$)'>, | |
376 | m2=<includematcher includes='beans/black(?:/|$)'>> |
|
376 | m2=<includematcher includes='beans/black(?:/|$)'>> | |
377 | $ hg debugwalk -v -Xbeans beans/black |
|
377 | $ hg debugwalk -v -Xbeans beans/black | |
378 | * matcher: |
|
378 | * matcher: | |
379 | <differencematcher |
|
379 | <differencematcher | |
380 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, |
|
380 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, | |
381 | m2=<includematcher includes='beans(?:/|$)'>> |
|
381 | m2=<includematcher includes='beans(?:/|$)'>> | |
382 | $ hg debugwalk -v -Xbeans -Ibeans/black |
|
382 | $ hg debugwalk -v -Xbeans -Ibeans/black | |
383 | * matcher: |
|
383 | * matcher: | |
384 | <differencematcher |
|
384 | <differencematcher | |
385 | m1=<includematcher includes='beans/black(?:/|$)'>, |
|
385 | m1=<includematcher includes='beans/black(?:/|$)'>, | |
386 | m2=<includematcher includes='beans(?:/|$)'>> |
|
386 | m2=<includematcher includes='beans(?:/|$)'>> | |
387 | $ hg debugwalk -v 'glob:mammals/../beans/b*' |
|
387 | $ hg debugwalk -v 'glob:mammals/../beans/b*' | |
388 | * matcher: |
|
388 | * matcher: | |
389 | <patternmatcher patterns='beans/b[^/]*$'> |
|
389 | <patternmatcher patterns='beans/b[^/]*$'> | |
390 | f beans/black beans/black |
|
390 | f beans/black beans/black | |
391 | f beans/borlotti beans/borlotti |
|
391 | f beans/borlotti beans/borlotti | |
392 | $ hg debugwalk -v '-X*/Procyonidae' mammals |
|
392 | $ hg debugwalk -v '-X*/Procyonidae' mammals | |
393 | * matcher: |
|
393 | * matcher: | |
394 | <differencematcher |
|
394 | <differencematcher | |
395 | m1=<patternmatcher patterns='mammals(?:/|$)'>, |
|
395 | m1=<patternmatcher patterns='mammals(?:/|$)'>, | |
396 | m2=<includematcher includes='[^/]*/Procyonidae(?:/|$)'>> |
|
396 | m2=<includematcher includes='[^/]*/Procyonidae(?:/|$)'>> | |
397 | f mammals/skunk mammals/skunk |
|
397 | f mammals/skunk mammals/skunk | |
398 | $ hg debugwalk -v path:mammals |
|
398 | $ hg debugwalk -v path:mammals | |
399 | * matcher: |
|
399 | * matcher: | |
400 | <patternmatcher patterns='mammals(?:/|$)'> |
|
400 | <patternmatcher patterns='mammals(?:/|$)'> | |
401 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
401 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
402 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
402 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
403 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
403 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
404 | f mammals/skunk mammals/skunk |
|
404 | f mammals/skunk mammals/skunk | |
405 | $ hg debugwalk -v .. |
|
405 | $ hg debugwalk -v .. | |
406 | abort: .. not under root '$TESTTMP/t' |
|
406 | abort: .. not under root '$TESTTMP/t' | |
407 | [255] |
|
407 | [255] | |
408 | $ hg debugwalk -v beans/../.. |
|
408 | $ hg debugwalk -v beans/../.. | |
409 | abort: beans/../.. not under root '$TESTTMP/t' |
|
409 | abort: beans/../.. not under root '$TESTTMP/t' | |
410 | [255] |
|
410 | [255] | |
411 | $ hg debugwalk -v .hg |
|
411 | $ hg debugwalk -v .hg | |
412 | abort: path contains illegal component: .hg |
|
412 | abort: path contains illegal component: .hg | |
413 |
[ |
|
413 | [10] | |
414 | $ hg debugwalk -v beans/../.hg |
|
414 | $ hg debugwalk -v beans/../.hg | |
415 | abort: path contains illegal component: .hg |
|
415 | abort: path contains illegal component: .hg | |
416 |
[ |
|
416 | [10] | |
417 | $ hg debugwalk -v beans/../.hg/data |
|
417 | $ hg debugwalk -v beans/../.hg/data | |
418 | abort: path contains illegal component: .hg/data |
|
418 | abort: path contains illegal component: .hg/data | |
419 |
[ |
|
419 | [10] | |
420 | $ hg debugwalk -v beans/.hg |
|
420 | $ hg debugwalk -v beans/.hg | |
421 | abort: path 'beans/.hg' is inside nested repo 'beans' |
|
421 | abort: path 'beans/.hg' is inside nested repo 'beans' | |
422 |
[ |
|
422 | [10] | |
423 |
|
423 | |||
424 | Test explicit paths and excludes: |
|
424 | Test explicit paths and excludes: | |
425 |
|
425 | |||
426 | $ hg debugwalk -v fennel -X fennel |
|
426 | $ hg debugwalk -v fennel -X fennel | |
427 | * matcher: |
|
427 | * matcher: | |
428 | <differencematcher |
|
428 | <differencematcher | |
429 | m1=<patternmatcher patterns='fennel(?:/|$)'>, |
|
429 | m1=<patternmatcher patterns='fennel(?:/|$)'>, | |
430 | m2=<includematcher includes='fennel(?:/|$)'>> |
|
430 | m2=<includematcher includes='fennel(?:/|$)'>> | |
431 | $ hg debugwalk -v fennel -X 'f*' |
|
431 | $ hg debugwalk -v fennel -X 'f*' | |
432 | * matcher: |
|
432 | * matcher: | |
433 | <differencematcher |
|
433 | <differencematcher | |
434 | m1=<patternmatcher patterns='fennel(?:/|$)'>, |
|
434 | m1=<patternmatcher patterns='fennel(?:/|$)'>, | |
435 | m2=<includematcher includes='f[^/]*(?:/|$)'>> |
|
435 | m2=<includematcher includes='f[^/]*(?:/|$)'>> | |
436 | $ hg debugwalk -v beans/black -X 'path:beans' |
|
436 | $ hg debugwalk -v beans/black -X 'path:beans' | |
437 | * matcher: |
|
437 | * matcher: | |
438 | <differencematcher |
|
438 | <differencematcher | |
439 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, |
|
439 | m1=<patternmatcher patterns='beans/black(?:/|$)'>, | |
440 | m2=<includematcher includes='beans(?:/|$)'>> |
|
440 | m2=<includematcher includes='beans(?:/|$)'>> | |
441 | $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans' |
|
441 | $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans' | |
442 | * matcher: |
|
442 | * matcher: | |
443 | <differencematcher |
|
443 | <differencematcher | |
444 | m1=<includematcher includes='beans/black(?:/|$)'>, |
|
444 | m1=<includematcher includes='beans/black(?:/|$)'>, | |
445 | m2=<includematcher includes='beans(?:/|$)'>> |
|
445 | m2=<includematcher includes='beans(?:/|$)'>> | |
446 |
|
446 | |||
447 | Test absolute paths: |
|
447 | Test absolute paths: | |
448 |
|
448 | |||
449 | $ hg debugwalk -v `pwd`/beans |
|
449 | $ hg debugwalk -v `pwd`/beans | |
450 | * matcher: |
|
450 | * matcher: | |
451 | <patternmatcher patterns='beans(?:/|$)'> |
|
451 | <patternmatcher patterns='beans(?:/|$)'> | |
452 | f beans/black beans/black |
|
452 | f beans/black beans/black | |
453 | f beans/borlotti beans/borlotti |
|
453 | f beans/borlotti beans/borlotti | |
454 | f beans/kidney beans/kidney |
|
454 | f beans/kidney beans/kidney | |
455 | f beans/navy beans/navy |
|
455 | f beans/navy beans/navy | |
456 | f beans/pinto beans/pinto |
|
456 | f beans/pinto beans/pinto | |
457 | f beans/turtle beans/turtle |
|
457 | f beans/turtle beans/turtle | |
458 | $ hg debugwalk -v `pwd`/.. |
|
458 | $ hg debugwalk -v `pwd`/.. | |
459 | abort: $TESTTMP/t/.. not under root '$TESTTMP/t' |
|
459 | abort: $TESTTMP/t/.. not under root '$TESTTMP/t' | |
460 | [255] |
|
460 | [255] | |
461 |
|
461 | |||
462 | Test patterns: |
|
462 | Test patterns: | |
463 |
|
463 | |||
464 | $ hg debugwalk -v glob:\* |
|
464 | $ hg debugwalk -v glob:\* | |
465 | * matcher: |
|
465 | * matcher: | |
466 | <patternmatcher patterns='[^/]*$'> |
|
466 | <patternmatcher patterns='[^/]*$'> | |
467 | f fennel fennel |
|
467 | f fennel fennel | |
468 | f fenugreek fenugreek |
|
468 | f fenugreek fenugreek | |
469 | f fiddlehead fiddlehead |
|
469 | f fiddlehead fiddlehead | |
470 | #if eol-in-paths |
|
470 | #if eol-in-paths | |
471 | $ echo glob:glob > glob:glob |
|
471 | $ echo glob:glob > glob:glob | |
472 | $ hg addremove |
|
472 | $ hg addremove | |
473 | adding glob:glob |
|
473 | adding glob:glob | |
474 | warning: filename contains ':', which is reserved on Windows: 'glob:glob' |
|
474 | warning: filename contains ':', which is reserved on Windows: 'glob:glob' | |
475 | $ hg debugwalk -v glob:\* |
|
475 | $ hg debugwalk -v glob:\* | |
476 | * matcher: |
|
476 | * matcher: | |
477 | <patternmatcher patterns='[^/]*$'> |
|
477 | <patternmatcher patterns='[^/]*$'> | |
478 | f fennel fennel |
|
478 | f fennel fennel | |
479 | f fenugreek fenugreek |
|
479 | f fenugreek fenugreek | |
480 | f fiddlehead fiddlehead |
|
480 | f fiddlehead fiddlehead | |
481 | f glob:glob glob:glob |
|
481 | f glob:glob glob:glob | |
482 | $ hg debugwalk -v glob:glob |
|
482 | $ hg debugwalk -v glob:glob | |
483 | * matcher: |
|
483 | * matcher: | |
484 | <patternmatcher patterns='glob$'> |
|
484 | <patternmatcher patterns='glob$'> | |
485 | glob: $ENOENT$ |
|
485 | glob: $ENOENT$ | |
486 | $ hg debugwalk -v glob:glob:glob |
|
486 | $ hg debugwalk -v glob:glob:glob | |
487 | * matcher: |
|
487 | * matcher: | |
488 | <patternmatcher patterns='glob:glob$'> |
|
488 | <patternmatcher patterns='glob:glob$'> | |
489 | f glob:glob glob:glob exact |
|
489 | f glob:glob glob:glob exact | |
490 | $ hg debugwalk -v path:glob:glob |
|
490 | $ hg debugwalk -v path:glob:glob | |
491 | * matcher: |
|
491 | * matcher: | |
492 | <patternmatcher patterns='glob:glob(?:/|$)'> |
|
492 | <patternmatcher patterns='glob:glob(?:/|$)'> | |
493 | f glob:glob glob:glob exact |
|
493 | f glob:glob glob:glob exact | |
494 | $ rm glob:glob |
|
494 | $ rm glob:glob | |
495 | $ hg addremove |
|
495 | $ hg addremove | |
496 | removing glob:glob |
|
496 | removing glob:glob | |
497 | #endif |
|
497 | #endif | |
498 |
|
498 | |||
499 | $ hg debugwalk -v 'glob:**e' |
|
499 | $ hg debugwalk -v 'glob:**e' | |
500 | * matcher: |
|
500 | * matcher: | |
501 | <patternmatcher patterns='.*e$'> |
|
501 | <patternmatcher patterns='.*e$'> | |
502 | f beans/turtle beans/turtle |
|
502 | f beans/turtle beans/turtle | |
503 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
503 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
504 |
|
504 | |||
505 | $ hg debugwalk -v 're:.*[kb]$' |
|
505 | $ hg debugwalk -v 're:.*[kb]$' | |
506 | * matcher: |
|
506 | * matcher: | |
507 | <patternmatcher patterns='.*[kb]$'> |
|
507 | <patternmatcher patterns='.*[kb]$'> | |
508 | f beans/black beans/black |
|
508 | f beans/black beans/black | |
509 | f fenugreek fenugreek |
|
509 | f fenugreek fenugreek | |
510 | f mammals/skunk mammals/skunk |
|
510 | f mammals/skunk mammals/skunk | |
511 |
|
511 | |||
512 | $ hg debugwalk -v path:beans/black |
|
512 | $ hg debugwalk -v path:beans/black | |
513 | * matcher: |
|
513 | * matcher: | |
514 | <patternmatcher patterns='beans/black(?:/|$)'> |
|
514 | <patternmatcher patterns='beans/black(?:/|$)'> | |
515 | f beans/black beans/black exact |
|
515 | f beans/black beans/black exact | |
516 | $ hg debugwalk -v path:beans//black |
|
516 | $ hg debugwalk -v path:beans//black | |
517 | * matcher: |
|
517 | * matcher: | |
518 | <patternmatcher patterns='beans/black(?:/|$)'> |
|
518 | <patternmatcher patterns='beans/black(?:/|$)'> | |
519 | f beans/black beans/black exact |
|
519 | f beans/black beans/black exact | |
520 |
|
520 | |||
521 | $ hg debugwalk -v relglob:Procyonidae |
|
521 | $ hg debugwalk -v relglob:Procyonidae | |
522 | * matcher: |
|
522 | * matcher: | |
523 | <patternmatcher patterns='(?:|.*/)Procyonidae$'> |
|
523 | <patternmatcher patterns='(?:|.*/)Procyonidae$'> | |
524 | $ hg debugwalk -v 'relglob:Procyonidae/**' |
|
524 | $ hg debugwalk -v 'relglob:Procyonidae/**' | |
525 | * matcher: |
|
525 | * matcher: | |
526 | <patternmatcher patterns='(?:|.*/)Procyonidae/.*$'> |
|
526 | <patternmatcher patterns='(?:|.*/)Procyonidae/.*$'> | |
527 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
527 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
528 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
528 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
529 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
529 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
530 | $ hg debugwalk -v 'relglob:Procyonidae/**' fennel |
|
530 | $ hg debugwalk -v 'relglob:Procyonidae/**' fennel | |
531 | * matcher: |
|
531 | * matcher: | |
532 | <patternmatcher patterns='(?:|.*/)Procyonidae/.*$|fennel(?:/|$)'> |
|
532 | <patternmatcher patterns='(?:|.*/)Procyonidae/.*$|fennel(?:/|$)'> | |
533 | f fennel fennel exact |
|
533 | f fennel fennel exact | |
534 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
534 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
535 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
535 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
536 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
536 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
537 | $ hg debugwalk -v beans 'glob:beans/*' |
|
537 | $ hg debugwalk -v beans 'glob:beans/*' | |
538 | * matcher: |
|
538 | * matcher: | |
539 | <patternmatcher patterns='beans(?:/|$)|beans/[^/]*$'> |
|
539 | <patternmatcher patterns='beans(?:/|$)|beans/[^/]*$'> | |
540 | f beans/black beans/black |
|
540 | f beans/black beans/black | |
541 | f beans/borlotti beans/borlotti |
|
541 | f beans/borlotti beans/borlotti | |
542 | f beans/kidney beans/kidney |
|
542 | f beans/kidney beans/kidney | |
543 | f beans/navy beans/navy |
|
543 | f beans/navy beans/navy | |
544 | f beans/pinto beans/pinto |
|
544 | f beans/pinto beans/pinto | |
545 | f beans/turtle beans/turtle |
|
545 | f beans/turtle beans/turtle | |
546 | $ hg debugwalk -v 'glob:mamm**' |
|
546 | $ hg debugwalk -v 'glob:mamm**' | |
547 | * matcher: |
|
547 | * matcher: | |
548 | <patternmatcher patterns='mamm.*$'> |
|
548 | <patternmatcher patterns='mamm.*$'> | |
549 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
549 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
550 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
550 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
551 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
551 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
552 | f mammals/skunk mammals/skunk |
|
552 | f mammals/skunk mammals/skunk | |
553 | $ hg debugwalk -v 'glob:mamm**' fennel |
|
553 | $ hg debugwalk -v 'glob:mamm**' fennel | |
554 | * matcher: |
|
554 | * matcher: | |
555 | <patternmatcher patterns='mamm.*$|fennel(?:/|$)'> |
|
555 | <patternmatcher patterns='mamm.*$|fennel(?:/|$)'> | |
556 | f fennel fennel exact |
|
556 | f fennel fennel exact | |
557 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle |
|
557 | f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle | |
558 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi |
|
558 | f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi | |
559 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon |
|
559 | f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon | |
560 | f mammals/skunk mammals/skunk |
|
560 | f mammals/skunk mammals/skunk | |
561 | $ hg debugwalk -v 'glob:j*' |
|
561 | $ hg debugwalk -v 'glob:j*' | |
562 | * matcher: |
|
562 | * matcher: | |
563 | <patternmatcher patterns='j[^/]*$'> |
|
563 | <patternmatcher patterns='j[^/]*$'> | |
564 | $ hg debugwalk -v NOEXIST |
|
564 | $ hg debugwalk -v NOEXIST | |
565 | * matcher: |
|
565 | * matcher: | |
566 | <patternmatcher patterns='NOEXIST(?:/|$)'> |
|
566 | <patternmatcher patterns='NOEXIST(?:/|$)'> | |
567 | NOEXIST: * (glob) |
|
567 | NOEXIST: * (glob) | |
568 |
|
568 | |||
569 | #if fifo |
|
569 | #if fifo | |
570 | $ mkfifo fifo |
|
570 | $ mkfifo fifo | |
571 | $ hg debugwalk -v fifo |
|
571 | $ hg debugwalk -v fifo | |
572 | * matcher: |
|
572 | * matcher: | |
573 | <patternmatcher patterns='fifo(?:/|$)'> |
|
573 | <patternmatcher patterns='fifo(?:/|$)'> | |
574 | fifo: unsupported file type (type is fifo) |
|
574 | fifo: unsupported file type (type is fifo) | |
575 | #endif |
|
575 | #endif | |
576 |
|
576 | |||
577 | $ rm fenugreek |
|
577 | $ rm fenugreek | |
578 | $ hg debugwalk -v fenugreek |
|
578 | $ hg debugwalk -v fenugreek | |
579 | * matcher: |
|
579 | * matcher: | |
580 | <patternmatcher patterns='fenugreek(?:/|$)'> |
|
580 | <patternmatcher patterns='fenugreek(?:/|$)'> | |
581 | f fenugreek fenugreek exact |
|
581 | f fenugreek fenugreek exact | |
582 | $ hg rm fenugreek |
|
582 | $ hg rm fenugreek | |
583 | $ hg debugwalk -v fenugreek |
|
583 | $ hg debugwalk -v fenugreek | |
584 | * matcher: |
|
584 | * matcher: | |
585 | <patternmatcher patterns='fenugreek(?:/|$)'> |
|
585 | <patternmatcher patterns='fenugreek(?:/|$)'> | |
586 | f fenugreek fenugreek exact |
|
586 | f fenugreek fenugreek exact | |
587 | $ touch new |
|
587 | $ touch new | |
588 | $ hg debugwalk -v new |
|
588 | $ hg debugwalk -v new | |
589 | * matcher: |
|
589 | * matcher: | |
590 | <patternmatcher patterns='new(?:/|$)'> |
|
590 | <patternmatcher patterns='new(?:/|$)'> | |
591 | f new new exact |
|
591 | f new new exact | |
592 |
|
592 | |||
593 | $ mkdir ignored |
|
593 | $ mkdir ignored | |
594 | $ touch ignored/file |
|
594 | $ touch ignored/file | |
595 | $ echo '^ignored$' > .hgignore |
|
595 | $ echo '^ignored$' > .hgignore | |
596 | $ hg debugwalk -v ignored |
|
596 | $ hg debugwalk -v ignored | |
597 | * matcher: |
|
597 | * matcher: | |
598 | <patternmatcher patterns='ignored(?:/|$)'> |
|
598 | <patternmatcher patterns='ignored(?:/|$)'> | |
599 | $ hg debugwalk -v ignored/file |
|
599 | $ hg debugwalk -v ignored/file | |
600 | * matcher: |
|
600 | * matcher: | |
601 | <patternmatcher patterns='ignored/file(?:/|$)'> |
|
601 | <patternmatcher patterns='ignored/file(?:/|$)'> | |
602 | f ignored/file ignored/file exact |
|
602 | f ignored/file ignored/file exact | |
603 |
|
603 | |||
604 | Test listfile and listfile0 |
|
604 | Test listfile and listfile0 | |
605 |
|
605 | |||
606 | $ "$PYTHON" -c "open('listfile0', 'wb').write(b'fenugreek\0new\0')" |
|
606 | $ "$PYTHON" -c "open('listfile0', 'wb').write(b'fenugreek\0new\0')" | |
607 | $ hg debugwalk -v -I 'listfile0:listfile0' |
|
607 | $ hg debugwalk -v -I 'listfile0:listfile0' | |
608 | * matcher: |
|
608 | * matcher: | |
609 | <includematcher includes='fenugreek(?:/|$)|new(?:/|$)'> |
|
609 | <includematcher includes='fenugreek(?:/|$)|new(?:/|$)'> | |
610 | f fenugreek fenugreek |
|
610 | f fenugreek fenugreek | |
611 | f new new |
|
611 | f new new | |
612 | $ "$PYTHON" -c "open('listfile', 'wb').write(b'fenugreek\nnew\r\nmammals/skunk\n')" |
|
612 | $ "$PYTHON" -c "open('listfile', 'wb').write(b'fenugreek\nnew\r\nmammals/skunk\n')" | |
613 | $ hg debugwalk -v -I 'listfile:listfile' |
|
613 | $ hg debugwalk -v -I 'listfile:listfile' | |
614 | * matcher: |
|
614 | * matcher: | |
615 | <includematcher includes='fenugreek(?:/|$)|new(?:/|$)|mammals/skunk(?:/|$)'> |
|
615 | <includematcher includes='fenugreek(?:/|$)|new(?:/|$)|mammals/skunk(?:/|$)'> | |
616 | f fenugreek fenugreek |
|
616 | f fenugreek fenugreek | |
617 | f mammals/skunk mammals/skunk |
|
617 | f mammals/skunk mammals/skunk | |
618 | f new new |
|
618 | f new new | |
619 |
|
619 | |||
620 | $ cd .. |
|
620 | $ cd .. | |
621 | $ hg debugwalk -v -R t t/mammals/skunk |
|
621 | $ hg debugwalk -v -R t t/mammals/skunk | |
622 | * matcher: |
|
622 | * matcher: | |
623 | <patternmatcher patterns='mammals/skunk(?:/|$)'> |
|
623 | <patternmatcher patterns='mammals/skunk(?:/|$)'> | |
624 | f mammals/skunk t/mammals/skunk exact |
|
624 | f mammals/skunk t/mammals/skunk exact | |
625 | $ mkdir t2 |
|
625 | $ mkdir t2 | |
626 | $ cd t2 |
|
626 | $ cd t2 | |
627 | $ hg debugwalk -v -R ../t ../t/mammals/skunk |
|
627 | $ hg debugwalk -v -R ../t ../t/mammals/skunk | |
628 | * matcher: |
|
628 | * matcher: | |
629 | <patternmatcher patterns='mammals/skunk(?:/|$)'> |
|
629 | <patternmatcher patterns='mammals/skunk(?:/|$)'> | |
630 | f mammals/skunk ../t/mammals/skunk exact |
|
630 | f mammals/skunk ../t/mammals/skunk exact | |
631 | $ hg debugwalk -v --cwd ../t mammals/skunk |
|
631 | $ hg debugwalk -v --cwd ../t mammals/skunk | |
632 | * matcher: |
|
632 | * matcher: | |
633 | <patternmatcher patterns='mammals/skunk(?:/|$)'> |
|
633 | <patternmatcher patterns='mammals/skunk(?:/|$)'> | |
634 | f mammals/skunk mammals/skunk exact |
|
634 | f mammals/skunk mammals/skunk exact | |
635 |
|
635 | |||
636 | $ cd .. |
|
636 | $ cd .. | |
637 |
|
637 | |||
638 | Test split patterns on overflow |
|
638 | Test split patterns on overflow | |
639 |
|
639 | |||
640 | $ cd t |
|
640 | $ cd t | |
641 | $ echo fennel > overflow.list |
|
641 | $ echo fennel > overflow.list | |
642 | $ cat >> printnum.py <<EOF |
|
642 | $ cat >> printnum.py <<EOF | |
643 | > from __future__ import print_function |
|
643 | > from __future__ import print_function | |
644 | > for i in range(20000 // 100): |
|
644 | > for i in range(20000 // 100): | |
645 | > print('x' * 100) |
|
645 | > print('x' * 100) | |
646 | > EOF |
|
646 | > EOF | |
647 | $ "$PYTHON" printnum.py >> overflow.list |
|
647 | $ "$PYTHON" printnum.py >> overflow.list | |
648 | $ echo fenugreek >> overflow.list |
|
648 | $ echo fenugreek >> overflow.list | |
649 | $ hg debugwalk 'listfile:overflow.list' 2>&1 | egrep -v '^xxx' |
|
649 | $ hg debugwalk 'listfile:overflow.list' 2>&1 | egrep -v '^xxx' | |
650 | f fennel fennel exact |
|
650 | f fennel fennel exact | |
651 | f fenugreek fenugreek exact |
|
651 | f fenugreek fenugreek exact | |
652 | $ cd .. |
|
652 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now