Commit Graph

482 Commits

Author SHA1 Message Date
Matt Mackall
648df6f0b1 dispatch: generalize signature checking for extension command wrapping 2008-11-18 16:02:14 -06:00
Brendan Cully
f4cee1477f templater: return data in increasing chunk sizes
Currently hgweb is not streaming its output -- it accumulates the
entire response before sending it. This patch restores streaming
behaviour. To avoid having to synchronously write many tiny fragments,
this patch also adds buffering to the template generator. Local
testing of a fetch of a 100,000 line file with wget produces a slight
slowdown overall (up from 6.5 seconds to 7.2 seconds), but instead of
waiting 6 seconds for headers to arrive, output begins immediately.
2008-11-21 15:51:40 -08:00
Patrick Mezard
2e3aa68a1d Fix util._statfiles_clustered() failing at root of a windows drive
Report and initial fix by Andrei Vermel <avermel@mail.ru>.
2008-11-01 15:15:14 +03:00
Benoit Boissinot
214af7ec3c factor out the url handling from httprepo
Create url.py to handle all the url handling:
- proxy handling
- workaround various python bugs
- handle username/password embedded in the url
2008-10-27 21:50:01 +01:00
Benoit Allard
31ab3aeaed hgwebdir: show nested repositories (issue1336) 2008-10-22 18:23:32 +02:00
Thomas Arendsen Hein
593bff360d Add util.popen3 fallback, simplify import of Popen3 2008-10-19 12:19:55 +02:00
Thomas Arendsen Hein
b7ce96daba Fix util.popen2 for Python 2.3
1. trigger ImportError early, so fallbacks are activated
2. util.popen2 replaces previous usage of os.popen2, not popen2.popen2
2008-10-19 12:13:25 +02:00
Patrick Mezard
45970973da util: handle EINVAL in _statfiles_clustered()
Raised when osutil.listdir is called on a non-directory entry.
2008-10-18 20:50:08 +02:00
Patrick Mezard
f7eb935395 util: subprocess close_fds option is unix only 2008-10-18 15:49:15 +02:00
Petr Kodl
681e2c1a41 Take advantage of fstat calls clustering per directory if OS support it.
util module implements two versions of statfiles function

_statfiles calls lstat per file

_statfiles_clustered takes advantage of optimizations in osutil.c, stats all
files in directory at once when new directory is hit and caches the results

util.statfiles dispatches to appropriate version during module loading

The speedup on directory tree with 2k directories and 63k files is about
factor of 1.8 (1.3s -> 0.8s for hg diff - hg startup overhead about .2s)

At this point only Win32 now benefit from this patch.
Rest of OSes use the non clustered implementation.
2008-10-09 10:29:47 -04:00
Dirkjan Ochtman
67bd09df5b python2.6: use subprocess if available 2008-10-05 21:35:26 +02:00
Dirkjan Ochtman
6b51480caa merge with crew-stable 2008-08-12 17:47:08 +02:00
Matt Mackall
bfc02d4c70 util: set_flags should survive failure to create link 2008-08-10 21:55:23 -05:00
Matt Mackall
e03f4e2f73 util: set_flags shouldn't know about repo flag formats 2008-08-10 21:55:06 -05:00
Adrian Buehlmann
34afc460b4 move filename encoding functions from util.py to new store.py 2008-07-24 16:32:51 +02:00
Benoit Boissinot
664b2fafe8 merge with -stable 2008-07-23 16:14:45 +02:00
Benoit Boissinot
9d636a4b09 make mq and tags hardlink safe
The code didn't check for modes like "r+" or "rb+".
Many thanks to agriffis for noticing it.
2008-07-23 16:08:20 +02:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
b2155285a8 rename checkfolding to checkcase 2008-06-26 13:58:24 -05:00
Matt Mackall
d462e1fc26 simplify flag handling
add _checklink var to dirstate
introduce dirstate.flagfunc
switch users of util.execfunc/linkfunc to flagfunc
change manifestdict.set to take a flags string
change ctx.fileflags to ctx.flags
change gitmode func to a dict
remove util.execfunc/linkfunc
2008-06-26 13:46:34 -05:00
Paul Moore
c966bce328 Add a new function, fspath
The function, given a relative filename and a root, returns the filename
modified to use the case actually stored in the filesystem (or None if the
file does not exist). The returned name is relative to the root, but retains
the path separators used in the input path. (This is not strictly necessary,
but retaining the path separators minimises misleading test suite failures).

A win32-specific implementation (using win32api.FindFiles) is possible, but it
has not been implemented as testing seems to demonstrate that the
win32-specific code is not significantly faster (thanks to the caching of
results in the generic code).
2008-06-06 19:23:23 +01:00
Matt Mackall
b74465983b remove default arg from patkind 2008-05-12 11:37:08 -05:00
Matt Mackall
fd009cd512 walk: kill util.cmdmatcher and _matcher 2008-05-12 11:37:07 -05:00
Dirkjan Ochtman
2f149e4634 replace usage of os.popen() with util.popen()
To make this possible, I added a mode parameter to both implementations of
util.popen(), defaulting to 'r' (as it does in the Python stdlib).
2008-04-14 14:34:38 +02:00
Christian Ebert
af73383537 Let util.binary check entire data for \0 (issue1066, issue1079) 2008-04-08 13:19:36 +02:00
Bryan O'Sullivan
8250520fe1 Merge 2008-04-09 15:28:30 -07:00
Bryan O'Sullivan
6ab8739d08 Tidy code, fix typo 2008-04-09 15:27:57 -07:00
Dirkjan Ochtman
34d6bea8db python 2.6 compatibility: compatibility wrappers for hash functions 2008-04-04 22:36:40 +02:00
Patrick Mezard
a8a4885e0a util: check fileno() validity in win32 set_binary() 2008-03-21 21:56:55 +01:00
Patrick Mezard
9672ec918b util: test fileno() availability in win32 set_binary()
Fix suggested by Alexander Belchenko <bialix@ukr.net>
2008-03-20 22:41:40 +01:00
Eric Hopper
63836614e1 hgwebdir: Tiny fix for webdir on non-symlink capable platforms. 2008-03-17 12:40:02 -07:00
Eric Hopper
0a50218866 Allow hgwebdir collections to follow symlinks. 2008-03-15 12:42:34 -07:00
Eric Hopper
798a7f0917 Check for patches repo with os.path.isdir not os.path.exists 2008-03-02 08:51:02 -08:00
Matt Mackall
44c538327c dates: Fix bare times to be relative to "today" 2008-03-11 17:42:51 -05:00
Matt Mackall
555abf8390 dates: improve timezone handling
datestr:
- add format specifiers %1 and %2 for timezone hours and minutes
- remove timezone and timezone format options
- correctly find timezone hours and minutes for fractional and negative timezones
- update users

strdate:
- correctly find timezone hours and minutes for fractional and negative timezones
2008-03-11 17:42:41 -05:00
Matt Mackall
309ee9f391 dates: fix fractional timezone display rounding bug 2008-03-10 02:54:37 -05:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Peter Arrenbrecht
7f8994bad6 util: make walkrepos() return .hg/patches if present 2008-02-21 20:56:06 +01:00
Stefan Rank
e62243ce74 Also search for .hgrc if mercurial.ini not found on windows 2008-02-20 21:31:42 +01:00
Paul Moore ext:(%22)
2c78824696 Added hgexecutable support for py2exe/frozen scripts 2007-12-20 20:02:51 +00:00
Matt Mackall
ebf85d18e1 util: get rid of is_win_9x wart 2007-12-18 14:01:42 -06:00
Shun-ichi GOTO
903870798f Workaround for "Not enough space" error due to the bug of Windows.
Large write requests fail when stdout is switched to binary mode.
As a workaround, limit the data size to write once.
2007-12-14 16:47:41 +01:00
Steve Borho
dafb712d34 fix typo in sshargs
the original typo dated back to early 2005
2007-12-13 14:25:51 -06:00
Steve Borho
caa5fee772 win32: fix ssh://host:port when using Plink
Moves ssh argument building to platform specific utils code.
The win32 version looks for plink in ssh command string and
uses '-P' in lieu of '-p' for specifying a port
2007-12-12 16:44:26 -06:00
Manuel Holtgrewe
4a33cb8d98 Do not display passwords with pull/push/incoming/outgoing
Passwords specified in the repository URL are now displayed as '***'
when accessing the remote repository.
2007-11-05 20:29:32 +01:00
Maxim Dounin
8561d688a1 Fix file-changed-to-dir and dir-to-file commits (issue660).
Allow adding to dirstate files that clash with previously existing
but marked for removal. Protect from reintroducing clashes by revert.

This change doesn't address related issues with update. Current
workaround is to do "clean" update by manually removing conflicting
files/dirs from working directory.
2007-11-05 20:05:44 +03:00
Patrick Mezard
6aa1e21320 Fix Windows os.popen bug with interleaved stdout/stderr output
See python bug 1366 "popen spawned process may not write to stdout under windows" for more details.
2007-11-01 12:05:14 +01:00
Walter Doerwald
c1832411b0 Simplify utils.walkrepos(). 2007-08-28 18:00:07 +02:00
Thomas Arendsen Hein
a1c1677af4 Fix bad behaviour when specifying an invalid date (issue700)
commit (aborts _after_ typing in a commit message)
backout (aborted after the initial revert)
tag (edited .hgtags and couldn't commit)
import (patch applied, then commit fails)
qnew (aborts on bad dates, but writes any valid date into the # Date header)
qrefresh (like qnew)
sign (like tag)
fetch (merge, merge, merge, merge, abort)
2008-02-17 21:34:28 +01:00
Thomas Arendsen Hein
48cd266d6d merge with crew 2008-02-16 13:34:11 +01:00
Thomas Arendsen Hein
728ba019da Make annotae/grep print short dates with -q/--quiet.
Move shortdate() from templatefilters to util to avoid code duplication.
2008-02-16 13:33:38 +01:00
Patrick Mezard
5d1baa1a2e util: always define a dummy lookup_reg() 2008-02-13 23:09:28 +01:00
Alexis S. L. Carvalho
38c9e04993 util.pathto: return '.' instead of an empty string
This could happen with something like
pathto(repo.root, 'foo/bar', 'foo/bar')
2008-02-15 10:38:37 -02:00
Thomas Arendsen Hein
3d8e3d2b46 merge with main 2008-02-14 00:13:20 +01:00
Dirkjan Ochtman
5df65fdd07 better handle errors with date parsing (issue983)
Windows cannot always handle a 1970-01-01 parameter to time.mktime().
2008-02-13 16:46:43 +01:00
Alexis S. L. Carvalho
918227be30 Make files in .hg inherit the permissions from .hg/store 2008-02-09 18:38:54 -02:00
Matt Mackall
7fb82b40e9 ignore: split up huge patterns
Some versions of Python silently mishandle large regexes, so split
them up at a conservative 20k.
2008-02-11 16:13:43 -06:00
Matt Mackall
ad1e6058b9 filemerge: add config item for GUI tools
<tool>.gui indicates whether a tool requires a GUI to run
2008-02-03 19:29:05 -06:00
Matt Mackall
2c7d69802c merge: add registry look up bits to tool search 2008-02-03 19:29:05 -06:00
Matt Mackall
a849fab9e4 templater: move email function to util 2008-01-31 14:44:19 -06:00
Jesse Glick
e01183da16 Permit glob patterns to use nested curly braces. 2008-01-25 15:54:25 -05:00
Thomas Arendsen Hein
ddce807d45 merge with crew-stable 2008-01-22 00:55:01 +01:00
Thomas Arendsen Hein
133747d109 Fix double import of 're'. 2008-01-21 22:00:44 +01:00
Shun-ichi GOTO
da69eb2702 Fix not to use os.sep directly.
This change is intended for MBCS support.
2008-01-09 21:30:37 +09:00
Shun-ichi GOTO
fa59648c70 Add util.splitpath() and use it instead of using os.sep directly.
This change is intended to allow hooking splitpath() by win32mbcs
extension for MBCS support.
2008-01-09 21:30:36 +09:00
Shun-ichi GOTO
188e44cf4b Add endswithsep() and use it instead of using os.sep and os.altsep directly.
This change is intended to allow hooking endswithsep() by win32mbcs
extension for MBCS support.
2008-01-09 21:30:35 +09:00
Bryan O'Sullivan
5b8903b6d7 util: drop params added during experimentation 2008-01-04 13:56:31 -08:00
Bryan O'Sullivan
497bf2ca7a fetch: hide authentication details 2008-01-04 11:58:27 -08:00
Thomas Arendsen Hein
347da85c36 Removed tabs and trailing whitespace in python files 2007-12-29 19:49:48 +01:00
Patrick Mezard
db911b9d0f util: filter all st_mode with 0777 in checkexec 2007-12-29 01:14:45 +01:00
Matt Mackall
b35a91a7c0 util: simplify unique 2007-12-27 23:55:40 -06:00
Thomas Arendsen Hein
462c1975db Fix chmod of writable but unowned files (issue530)
This could happen e.g. in group writable local repositories where a file
should become executable on update.

(Patch by Benoit Boissinot attached to issue530)
2007-12-25 14:05:26 +01:00
Matt Mackall
c9efd52e9e util: simplify unique 2007-12-27 23:55:40 -06:00
Matt Mackall
50455803c5 remove unused util.localsub function 2007-12-27 23:55:40 -06:00
Matt Mackall
1baaf41264 atomictempfile: avoid chmod weirdness on Linux vfat 2007-12-27 23:55:40 -06:00
Matt Mackall
bdea7ebd1b checkexec: fix VFAT tempfile droppings with more modern Linux kernels
More recent Linux kernels don't pretend to allow any bogus chmods on
VFAT.
2007-12-27 23:55:40 -06:00
Matt Mackall
614e20b215 util: remove set_exec and set_link methods 2007-12-27 22:47:41 -06:00
Matt Mackall
717ff7e6f8 util: add new set_flags method
This is more efficient than calling set_link and set_exec
2007-12-27 22:27:45 -06:00
Thomas Arendsen Hein
b29abebc1e merge with crew-stable 2007-12-25 14:30:10 +01:00
Benoit Boissinot
c5049e31fc explicitely use integer division 2007-10-11 16:19:12 +02:00
Matt Mackall
0804290ab7 revlog: fix caching of buffer objects 2007-10-11 00:46:53 -05:00
Matt Mackall
8a3a3e49fe chunkiter: handle large reads more efficiently
- for large reads, don't attempt to read more than necessary
- if we've gathered the exact number of bytes needed, avoid a string copy
2007-10-11 00:46:52 -05:00
Matt Mackall
d3f1e8a8cf chunkiter: simplify iter logic 2007-10-11 00:46:49 -05:00
Matt Mackall
614d4b8b33 chunkbuffer: removed unused method and arg 2007-10-11 00:46:48 -05:00
Rafael Villar Burke
1b278771bf Execution bit detection fixes for VFAT on Linux
On Linux VFAT execution mode can be modified, but changes don't
persist a filesy stem remount. The current test can be trickled by
this. We can help with the det ection of VFAT checking whether new
files get created with the execution bits on
 (as usually these partitions are mounted with the exec option, for
convenience)
.
2007-10-05 01:52:53 +02:00
Bryan O'Sullivan
e317f81ab3 Add osutil module, containing a listdir function.
This is similar to os.listdir, only it returns a sorted list of tuples.
2007-10-05 15:01:06 -07:00
Bryan O'Sullivan
5e33599d0f Merge with crew. 2007-10-02 13:49:36 -07:00
Bryan O'Sullivan
65b17f114c util: add default argument to strdate 2007-10-02 13:46:59 -07:00
Benoit Boissinot
7cf891935c merge with -stable 2007-10-02 20:25:35 +02:00
Steve Borho
9f12241241 set_exec: do not chmod a symlink 2007-10-02 20:22:33 +02:00
Patrick Mezard
7c1d0710ee Merge with crew-stable 2007-09-10 23:53:23 +02:00
Alexis S. L. Carvalho
29dea75576 sshrepo: fix Windows command quoting 2007-09-10 23:34:33 +02:00
Patrick Mezard
239ea63571 extdiff: avoid repr() doubling paths backslashes under Windows 2007-09-10 23:36:01 +02:00
Robert Bachmann
ecb337b8cb Added support for the Atom syndication format 2007-08-30 16:42:17 +02:00
Benoit Boissinot
6c80bb0bbe merge with crew-stable 2007-08-24 00:39:59 +02:00
Benoit Boissinot
0d54a05da3 merge with -stable 2007-08-24 00:39:16 +02:00
Benoit Boissinot
f71cd2e266 check exec: return fallback in case of error during the check
If there is any error while checking if exec is supported,
we can return fallback.
fix issue705
2007-08-24 00:38:08 +02:00
Matt Mackall
dbef99a2d7 Merge with -stable 2007-08-19 14:04:26 -05:00
Matt Mackall
0bcff0f870 match: handle large regexes
Some Python versions don't handle large regexes, so when we hit an
overflow, split our regex in two.
2007-08-19 14:03:56 -05:00
Alexis S. L. Carvalho
3b929dfbb5 path_auditor: cache names of audited directories
We use a separate cache to avoid problems with

audit = path_auditor(repo.root)
audit("subrepo")
audit("subrepo/file")

whitelisting "subrepo" (which is fine) and then using the same whitelist
with "subrepo/file" (which is not fine).

Since we create a separate path_auditor for every path on the command line,
a "hg add dir/a dir/b dir/c" will still lstat dir 3 times just to audit
the paths.
2007-08-18 21:36:10 -03:00
Patrick Mezard
aebb857395 util: ignore invalid path errors in path_auditor. 2007-08-13 19:42:50 +02:00
Bryan O'Sullivan
6cbcae9959 Make a few portability improvements to path auditing code. 2007-08-10 10:51:47 -07:00
Bryan O'Sullivan
1b98353d91 Make audit_path more stringent.
The following properties of a path are now checked for:

    - under top-level .hg
    - starts at the root of a windows drive
    - contains ".."
    - traverses a symlink (e.g. a/symlink_here/b)
    - inside a nested repository

If any of these is true, the path is rejected.

The check for traversing a symlink is arguably stricter than necessary;
perhaps we should be checking for symlinks that point outside the
repository.
2007-08-10 10:46:03 -07:00
Patrick Mezard
6b51a27d18 Merge with crew-stable 2007-08-06 10:57:51 +02:00
Patrick Mezard
3857228c9a Fix issue 653: symlinks checkout failure on non-supporting platforms 2007-08-06 10:08:28 +02:00
Thomas Arendsen Hein
325c8db06b merge with crew-stable 2007-08-04 22:27:52 +02:00
Thomas Arendsen Hein
ae0d60a260 Simplify/correct finding the hg executable (fixes issue644)
Simply use find_exe('hg') as the default value for $HG and require to manually
set it if you have special requirements.

While the default will not always be 100% correct (i.e. the identical hg
version) for many users it is and for the others the hg executable found in
the PATH should do most things correctly.

Developers or other users with multiple installs can set $HG or run something
like util.set_hgexecutable in their shell or python scripts.

Additionally util.hgexecutable() is now available so extensions can access
the value with a public interface, too.
2007-08-04 22:25:12 +02:00
Benoit Boissinot
84d45c7794 fix unused variables reported by pychecker 2007-07-20 09:31:32 +02:00
Bryan O'Sullivan
a7c1cdf4bc Print meaningful error message if os.symlink fails 2007-07-19 15:29:33 -07:00
Jesse Glick
5b3c852e55 typo fix 2007-07-12 10:55:49 -04:00
Alexis S. L. Carvalho
3739335e3b util._hgexecutable: default to 'hg'
This should make hooks work even if util.set_hgexecutable is not called
(e.g. hgweb.cgi).

Fixes issue625.
2007-07-11 18:15:21 -03:00
Alexis S. L. Carvalho
422bcbcb1d Add symlink method to util.opener.
Differences from os.symlink:

- the symlink name is relative to the opener base directory

- if a file with that name already exists, it's removed

- if necessary, parent directories are created

- if the system (OS or filesystem) doesn't support symlinks, a
  regular file is created.  Its contents are the symlink target.
2007-07-11 17:40:41 -03:00
Alexis S. L. Carvalho
2a73361d92 turn util.opener into a class 2007-07-11 17:40:41 -03:00
Nathan Jones
8fc48b4f99 Fix serve on Windows without win32* modules. 2007-06-26 10:48:58 -04:00
Jean-Francois PIERONNE
7a71f63f2b OpenVMS patches 2007-06-08 16:24:43 +02:00
Markus F.X.J. Oberhumer
84ffe403b9 Add support for RFC2822 to util.parsedate(). 2007-06-25 14:46:20 +02:00
Thomas Arendsen Hein
2e76adae49 Remember path to 'hg' executable and pass to external tools and hooks as $HG. 2007-06-23 20:21:10 +02:00
Patrick Mezard
21ea8128a8 Merge with crew 2007-06-21 22:19:41 +02:00
Marcos Chaves
f5c072cbc9 Handle CTRL+C in serve under Windows. 2007-06-21 21:58:18 +02:00
Thomas Arendsen Hein
9a78cd828a Remove useless variable assignments in util.opener.
The original idea might have been to prevent circular references, but
as this assignment would have created another reference, this makes
no difference.
2007-06-21 19:24:27 +02:00
Eric Hopper
bdc1293e28 Provide a version independent way to use the set datatype. 2007-06-19 08:37:41 -07:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Brendan Cully
4a2d1da1c5 Work around heisenbug in Popen3.__del__ 2007-06-18 14:52:31 -07:00
Brendan Cully
497f138a19 Respect locale environment variables on darwin.
In python 2.4+ on darwin, locale.getpreferredencoding() returns
mac-roman regardless of what LC_CTYPE, LANG etc are set to. This can
produce hard-to-notice conversion errors if input text is not in
mac-roman. So this patch overrides it with setlocale/getlocale if the
environment has been customized, on the assumption that the user has
done so deliberately.
2007-06-11 12:14:31 -07:00
Thomas Arendsen Hein
7a4d62e035 Removed trailing \n in calls to util.Abort() 2007-06-09 13:25:54 +02:00
Thomas Arendsen Hein
49220695bc Removed trailing whitespace and tabs from python files 2007-06-06 20:22:52 +02:00
Alexis S. L. Carvalho
54dcd12c54 Remove atomicfile class.
The interface provided by opener(atomic=True) is inherently unsafe:
if an exception is raised in the code using the atomic file, the
possibly incomplete file will be renamed to its final destination,
defeating the whole purpose of atomic files.

To get around this, we would either need some bad hacks involving
sys.exc_info (to make sure things work in except: blocks), or an
interface to say "file is complete; rename it".

This is the exact interface provided by atomictempfile.  Since there
are no remaining users of the atomicfile class, just remove it.
2007-06-05 19:55:27 -03:00
Bryan O'Sullivan
d67a234671 Introduce find_exe. Use instead of find_in_path for programs.
The behaviour of find_in_path was broken for config options containing
path names, because it always searched the given path, even when not
necessary.  The find_exe function is more polite: if the name passed
to it contains a path component, it just returns it.
2007-05-27 14:26:54 -07:00
Patrick Mezard
37afbaec09 Fix issue483 - mq does not work under windows with gnu-win32 patch.
Add --binary option to patch command under win32.
2007-05-12 21:09:29 +02:00
Patrick Mezard
b4ca391b19 Move win32 find_in_files from util_win32 to util. 2007-05-06 16:40:53 +02:00
Alexis S. L. Carvalho
13b54a8829 Fix minor mismerge.
The caching of umask ended up being duplicated.
2007-04-28 17:55:45 -03:00
Brendan Cully
3787b004e8 Do not automatically rename an atomicfile if a write to it has generated an exception. 2007-04-25 13:14:01 -07:00
Bryan O'Sullivan
390039e974 util._matcher: speed up regexp matching.
In cdc7e3627e1b, Benoit made a change that substantially slows matching
when a big .hgignore file is in play, because it calls into the regexp
matching engine potentially hundreds of times per file to be matched.

I've partly rolled back his change, so that we only call into the matcher
once per file, but preserved the ability to report a meaningful error
message if there's a syntax error in the regexp.
2007-04-24 10:53:25 -07:00
Matt Mackall
a6178f3d01 Merge with crew 2007-04-12 12:42:22 -05:00
Matt Mackall
e293a4cd6d Merge with stable 2007-04-10 14:05:15 -05:00
Alexis S. L. Carvalho
ea51c7fac2 Merge with crew-stable. 2007-04-09 04:57:25 -03:00
Alexis S. L. Carvalho
c250e89b1e atomicfile: don't copy the original file if it'll be truncated 2007-04-09 04:24:17 -03:00
Alexis S. L. Carvalho
c9f461c7af util.opener: if requested, use atomicfile even if the file doesn't exist
Right now, surprisingly enough, if you request an atomic file but the
file still doesn't exist, you get a regular file.  AFAICS, the only time
this happens is during the initial creation of the dirstate.
2007-04-09 04:24:17 -03:00
Alexis S. L. Carvalho
cbe674cc00 cache os.umask even on windows 2007-04-09 04:24:17 -03:00
Alexis S. L. Carvalho
8cf3bc3446 Merge last few matcher/locate fixes. 2007-04-04 04:22:08 -03:00
Alexis S. L. Carvalho
e021806e69 change relglob: patterns to be consistent with glob: patterns
With this change, you have to use "hg locate 'hgweb/**'" to locate
all the files in directories named hgweb.  OTOH, "hg locate '*l'"
will locate only files that end with "l" - e.g. a file called "hg.py"
will not be matched just because it's in a directory whose name ends
with "l" (e.g. "mercurial").
2007-04-04 04:22:06 -03:00
Alexis S. L. Carvalho
8d4f62f9f3 Revert changeset 8e97d9d074da; add another test for glob: patterns
With that changeset, it's impossible to use a glob: pattern to match
e.g. all files ending in .py - glob:**.py would also match all files
in a directory called dir.py.
2007-04-04 04:22:05 -03:00
Alexis S. L. Carvalho
db8accc4c6 glob:<directory> patterns match the files in that directory.
This makes the behaviour of glob: patterns more consistent:
hg status glob:dir  and   hg status -I glob:dir  will match
the same files.

It's also consistent with the fact that {rel,}path patterns
recursively match the contents of a directory.
2007-03-20 22:09:55 -03:00
Alexis S. L. Carvalho
2ed671d3fa util._matcher: remove superfluous variable 2007-03-16 22:48:23 -03:00
Alexis S. L. Carvalho
a782e3309d util._matcher: use "." as the root of empty {rel,}path patterns
Should fix issue332. Really.
2007-03-16 22:48:20 -03:00
Alexis S. L. Carvalho
ec56d01ca6 Optimize return value of util._matcher for hgignore case 2007-03-10 23:01:02 -03:00
Alexis S. L. Carvalho
05eea28e33 Optimize return value of util._matcher for common command line case
This will trigger every time somebody runs something like "hg diff"
or "hg status" without any arguments.

The important part here is returning util.always as the match function,
which is a much simpler (and faster) function than the usual return
value, and allows other code to just skip the filtering if it knows
all files will match.
2007-03-10 23:01:00 -03:00
Alexis S. L. Carvalho
c3d6308137 remove unused "head" hack from util._matcher 2007-03-10 23:00:59 -03:00
Alexis S. L. Carvalho
b53e6f3897 change locate to use relglobs by default
This makes its default behaviour useful again (issue108), and
changes it search the entire repository by default (instead
of just the cwd), just like all other commands.

It also hides issue204 by default, but you'll still see the
same behaviour if you give it a relpath: pattern.
2007-03-10 23:00:57 -03:00
Alexis S. L. Carvalho
393022dbbb dirstate.statwalk: explicitly test for ignored directories
This removes a hack where we appended '/' to a dirname so that:
- it would not appear on the "dc" dict
- it would always be matched by the match function

This was a contorted way of checking if the directory was matched by
some hgignore pattern, and it would still fail with some uses of
--include/--exclude patterns.

Things would still work fine if we removed the check altogether and
just appended things to "work" directly, but then we would end up
walking ignored directories too, which could be quite a bit of work.

This allows further simplification of the match function returned by
util._matcher, and fixes walking the working directory with a
--include pattern that matches only the end of a name.
2007-03-10 23:00:54 -03:00