Commit Graph

12941 Commits

Author SHA1 Message Date
Adrian Buehlmann
bfc33d780a windows.rename: eliminate temp name race (issue2571)
On Windows, os.rename reliably raises OSError with errno.EEXIST if the
destination already exists (even on shares served by Samba).

Windows does *not* silently overwrite the destination of a rename.

So there is no need to first call os.path.exists on the chosen temp path.

Trusting os.path.exists is actually harmful, since using it enables the
following racy sequence of actions:

 1) os.path.exists(temp) returns False
 2) some evil other process creates a file with name temp
 3) os.rename(dst, temp) now fails because temp has been taken

Not using os.path.exists and directly trying os.rename(dst, temp)
eliminates this race.
2010-12-27 01:12:31 +01:00
Adrian Buehlmann
942d5fa3d6 checknlink: use two testfiles (issue2543)
Preventing file loss repository corruption (e.g. vanished changelog.i) when
Mercurial pushes to repositories on Windows shares served by Samba.

This is a workaround for Samba bug 7863, which is present in current latest
stable Samba 3.5.6 and various prior versions down to 3.0.26a (the oldest one
I tested).

Of course this should be fixed in Samba, but there probably aren't that many
other applications who use hardlinks that extensively and keep files open like
Mercurial, so the pressure to fix this on Samba is probably not that high. And
even if the Samba project should be able to fix their bug within a month or
two, it will take quite some time until users upgrade their Samba installs.
2010-12-13 22:38:06 +01:00
John Peberdy
2b3c69e04a help: correct documentation for branches keyword 2010-12-19 21:49:54 -05:00
Yuya Nishihara
92b5cbe067 notify: use util.ellipsis() to truncate long subject 2010-12-24 01:17:18 +09:00
Mads Kiilerich
d9f11887ef https: use web.cacerts configuration from local repo to validate remote repo 2010-12-27 17:49:58 +01:00
Steve Borho
8562094eb1 util: concentrate quoting knowledge to windows.py quotecommand()
This fixes all callers of util.quotecommand() and place special knowledge
of the bugfix in 2.7.1 in a single platform specific place.
2010-12-22 13:25:00 -06:00
Matt Mackall
64de41cf08 url: fix trailing whitespace 2010-12-20 15:26:36 -06:00
Adrian Buehlmann
9638578b5c fncachestore: copy dh directory before the manifest
Before this patch, the copy order on clone was:

  requires
  00changelog.i
  store\data
  store\00manifest.d
  store\00manifest.i
  store\00changelog.d
  store\00changelog.i
  store\dh
  store\fncache

Which provides a theoretical non-zero probability of a race during clone where
a very early reader might see a repository with missing revlog files if it sees
00changelog.i before all files inside dh have been copied.

The dh directory is similar to the data directory -- just for files with long
names (which are hashed). The manifest refers to files in data *and* dh, so dh
should be copied before the manifest.

This patch improves the copy order to:

  requires
  00changelog.i
  store\data
  store\dh
  store\fncache
  store\00manifest.d
  store\00manifest.i
  store\00changelog.d
  store\00changelog.i

I'm putting fncache to before the manifest while I'm at it, since fncache
provides a mechanism to enumerate all repository files without visiting the
manifest revisions. fncache depends only on data and dh.

Note that data must be copied first, since copying data triggers the creation
of the repository write lock in the destination repo (see hg.clone).
2010-12-17 10:40:26 +01:00
Matt Mackall
6ecba9b7c1 merge with i18n 2010-12-20 12:05:50 -06:00
Mads Kiilerich
97213d6b00 https: warn when server certificate isn't verified
Mercurial will verify HTTPS server certificates if web.cacerts is configured,
but it will by default silently not verify any certificates.

We now warn the user that when the certificate isn't verified she won't get the
security she might expect from https:
  warning: localhost certificate not verified (check web.cacerts config setting)

Self-signed certificates can be accepted silently by configuring web.cacerts to
point to a suitable certificate file.
2010-12-18 21:58:52 +01:00
Martin Geisler
e202cdedd7 i18n-da: synchronize with 3161970145e5 2010-12-10 12:48:57 +01:00
Kevin Bullock
6d031e2cdb tag: abort if not at a branch head (issue2552)
Since it's usually only desirable to make tag commits on top of branch
heads, abort if the working dir parent is not a branch head. -f/--force
may be passed to commit at a non-head anyway.

Does not abort if working dir parent is a named branch head but not a
topological head.
2010-12-06 22:04:10 -06:00
Kevin Bullock
90e6b3e885 tag: fix uncommitted merge check and error message (issue2542)
This patch corrects the check for tagging on an uncommitted merge. We
should never commit a new tag changeset on an uncommitted merge, whether
or not --rev is specified. It also changes the error message from:

  abort: cannot partially commit a merge (do not specify files or patterns)

to the much more accurate (and terse):

  abort: uncommitted merge

Local tags are ok.
2010-12-07 08:02:54 +01:00
Kevin Bullock
85d737621f tag: don't check .hgtags status if --local passed
Local tags don't create a commit, so we don't need to check the status
of .hgtags.
2010-12-13 21:20:30 -06:00
Steve Borho
1493f6fe1b util: work around behavior change in Python 2.7.1 2010-12-13 11:51:01 -06:00
Martin Geisler
dcc33331f5 merge stable heads in crew and main 2010-12-13 11:52:21 +01:00
Matt Mackall
be1d11e804 hook: fix import path handling for repo=None 2010-12-10 19:18:02 -06:00
Alexander Solovyov
e86de517fe hook: assume relative path to hook is given from repo root 2010-12-07 15:27:04 +01:00
Matt Mackall
eec34ddf7c subrepo: backed out changeset 9ce26f91f137 2010-12-10 19:08:17 -06:00
Mads Kiilerich
9933c7a60f subrepo: initialize subrepo relative default paths relative to their root 2010-12-10 01:30:16 +01:00
Brodie Rao
7b0127774f bookmarks: create undo.bookmarks using repo.opener instead of util.copyfile
This more closely matches how the other undo files are created, and we
don't care about settings permissions or times on the file, which can
fail if the user running hg doesn't own the file.
2010-12-07 20:03:04 +11:00
Brodie Rao
08a14dad90 archival: don't set gzip filename header when there's no filename
This mainly affects hgweb, which can generate tar.gz archives without
filenames. Without this change, the header would be set to ".gz",
which can confuse Safari into extracting the file and renaming it to
"gz" when "Open 'safe' files after downloading" is enabled.

file(1) before:

hg-crew-439421eab08d.tar.gz: gzip compressed data, was ".gz", last modified: Thu Dec  2 11:46:20 2010, max compression

after:

hg-crew-439421eab08d.tar.gz: gzip compressed data, last modified: Thu Dec  2 11:46:20 2010, max compression
2010-12-07 19:47:53 +11:00
Arne Babenhauserheide
ed51fada87 i18n-de: translated strings for the purge extension 2010-12-04 19:28:15 +01:00
Patrick Mezard
744f417d4c patch: write .rej files without rewriting EOLs
Do not pass reject file content to patchfile.writelines() to:
- Avoid line endings transformations
- Avoid polluting overriding implementations with unrelated data. They should
  override write_rej() to deal or ignore reject files properly.

Bug report, analysis and original patch and test by
Shun-ichi GOTO <shunichi.goto@gmail.com>
2010-12-03 11:40:30 +09:00
Wagner Bruna
0d012abbee i18n-pt_BR: synchronized with d3c56a9887e7 2010-12-02 01:28:38 -02:00
Matt Mackall
bfd7e8ec89 Added signature for changeset 3bfdb3ab811e 2010-12-01 18:46:20 -06:00
Christian Ebert
7130ab35da keyword: copy: when copied source is a symlink, follow it
1) hg cp symlink copy -> copy is a symlink.
2) cp symlink copy; hg cp -A symlink copy -> copy is a regular file.

In the second case we have to follow the symlink to its target
to find out whether we have to unexpand keywords in the copy.

Add test covering the case where the copied link's target is ignored
by keyword but has content which would match the regex for expanded
keywords to check whether we indeed leave the destination alone.
2010-12-01 10:51:49 +01:00
Adrian Buehlmann
31d1e36f3f makedirs: abort if parent == name (issue2531)
catches unknown drive letters on Windows
2010-12-01 21:15:31 +01:00
Erik Zielke
cd263d594c eol: improve help on whether EOLs are changed in working copy or repository
Improved help to make it more clear for users which changes are only
changes in the working copy and which changes that will go into the
repository (on the following commit). Futhermore a note on when the
rules will be applied to the working directory.
2010-11-22 14:36:57 +01:00
Nicolas Dumazet
48d76e5f60 churn: ignore trailing and leading spaces (issue2546) 2010-12-13 16:41:39 +09:00
Shun-ichi GOTO
c55a471867 win32mbcs: use extsetup() to wrap functions only once.
Using reposetup() may cause multiple-wrap issue in some situation
like "hg serve".
2010-11-19 18:07:15 +09:00
Wagner Bruna
e391a0d422 hgwebdir: fix incorrect index generation for invalid paths (issue2023)
8aa8db6deb47 moved the subdirectory match inside the repository match
loop. A virtual path existing/path/invalid/path would then match
existing/path, and generate a wrong index page.
2010-11-30 12:45:25 -02:00
Adrian Buehlmann
ca7126202b serve: fix doc typo 2010-11-26 18:45:35 +01:00
Kevin Bullock
27dec28da2 mq: fix failing qrefresh test
Additions to test-mq-qrefresh.t in 0880564992de (mq: ignore subrepos
(issue2499)) were originally based on a version prior to 42fb7ef18fb4
(subrepo: handle missing subrepo spec file as removed). This fixes a
test failure that resulted from the former being applied after the
latter, noticed by abuehl.
2010-11-25 21:50:41 -06:00
Adrian Buehlmann
848dac9692 makedate: abort on negative timestamps (issue2513)
catches weird clock settings
2010-11-24 19:31:43 +01:00
Adrian Buehlmann
9817658bbd parsedate: abort on negative dates (issue2513)
catches "hg commit -d '-7654321 3600'" (example)
2010-11-24 19:31:43 +01:00
Matt Mackall
b889212241 merge with i18n 2010-12-01 17:50:49 -06:00
Adrian Buehlmann
54665801ad test-clone.t: add basic cases for destination ''
The case

  $ hg clone a ''

already aborted before c1e68cd8cfa8, whereas

  $ hg clone --pull a ''

tripped the fixed issue2528.

Both basic cases are expected to fail with an abort.
2010-12-01 04:21:47 +01:00
Martin Geisler
d16a27529b hgrc.5: expand introduction for [web] section 2010-12-01 10:52:31 +01:00
Martin Geisler
b5a68ead0a hgrc.5: describe what the [auth] section is for 2010-12-01 10:21:40 +01:00
Nicolas Dumazet
0885c6dc3f util: do not recurse in makedirs if name is '' (issue2528) 2010-11-30 17:48:12 +09:00
Patrick Mezard
120ad3c801 convert/svn: fix changed files list upon directory replacements
When branch2/dir was replacing branch1/dir, we only marked branch2/dir files a
changed. Add branch1/dir files as they may not exist in branch2.
2010-11-29 20:13:11 +01:00
Steve Borho
1d324e9771 wix: allow x86 MSI packages to be installed on x64 systems 2010-11-26 20:05:16 -06:00
Steve Borho
f2a3ea2967 wix: add support for x64 native MSI packages 2010-11-26 17:40:13 -06:00
Steve Borho
a95ec762fd wix: switch Mercurial Windows installer to use py2exe --bundle 3
--bundle 3 leaves all of the compiled C extensions and other DLLs outside of
the library.zip, so we no longer add the installer folder to the system PATH.
Instead, we now ship a small bin/hg.cmd and it is placed in the PATH.

Switching to py2exe --bundle 3 is necessary because the higher bundle options
are not supported on x64.
2010-11-26 16:18:19 -06:00
Wagner Bruna
82a5cb6e8a i18n-pt_BR: synchronized with 0880564992de 2010-11-23 13:22:01 -02:00
Adrian Buehlmann
a5a62b9b6f util.datestr: do not crash on revisions with negative timestamp (issue2513)
Python's time.gmtime(lt) fails on Windows, producing a traceback with

  ValueError: (22, 'Invalid argument')

if lt < -43200.

We get a local time boundary value of -43200 if we take "the epoch"

   Thu Jan 01 00:00:00 1970 = time.gmtime(0)

from timezone 'UTC+0' into timezone 'UTC-12'. All other timezones will have
larger local time values for that point in time.

Aborting with a traceback on 'hg log' for revisions with a timestamp value
< -43200 is clearly not acceptable.

Returning "invalid timestamp" or similar as string representation is not an
option either, since that may crash other tools which parse the output of
'hg log'.

Instead, we teach util.datestr() to return the epoch in timezone UTC+0 on
*all platforms*, represented by the string

  Thu Jan 01 00:00:00 1970 +0000

if the timestamp's unix time value is negative.

(based on a patch originally proposed by Benjamin Pollack)
2010-11-23 13:11:40 +01:00
Adrian Buehlmann
c0bc968f19 checknlink: return False if .hgtmp file preexists (issue2517)
If os_link fails on Windows, errno is always errno.EINVAL,
so we can't really say if the testlink could not be created
because (a) the FS doesn't support hardlinks or (b) there
is a leaked .hgtmp file lying around from a previous crashed
run.

So let's err on the safe side, keep the code simple and assume
we can't detect hardlinks in both cases.
2010-11-23 22:53:47 +01:00
Kevin Bullock
79f5039252 mq: ignore subrepos (issue2499)
If MQ allows modifying .hgsub or .hgsubstate in a patch, it can easily
lead to an inconsistent subrepo state. This patch prevents qrefresh from
adding any modifications to .hgsub or .hgsubstate to a patch. The user
is warned that these files are not included in the patch.

The tests test both the slightly irrational and the pathological cases.
2010-11-16 13:06:07 -06:00
Christian Ebert
0a8e9b8d50 keyword: s/config/configuration/ in help 2010-11-22 16:05:31 +01:00