Commit Graph

13148 Commits

Author SHA1 Message Date
Matt Mackall
68fbaea0de merge with stable 2010-12-29 11:18:27 -06:00
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
8df7f9f37e test-static-http.t: increase test coverage on filenames
Tracked files starting with a period in the name begin with '~2e' in the
store for the dotencode repository format, which is encoded as '%7E2e' in
URLs when accessing the repo over static-http.

The spaces in filenames are encoded with %20 in URLs.

See also issue 2566.
2010-12-26 12:08:20 +01:00
Adrian Buehlmann
3c82cec174 test-static-http.t: get kill actually working
- signal handlers take two arguments, not one
- add missing import sys

Before this patch, the

   $ kill $!

at the end of the test just caused a hidden traceback, sys.exit(0) was not
executed.

The swallowed traceback was:

  Traceback (most recent call last):
     File "dumb.py", line 10, in <module>
       run()
     File "dumb.py", line 7, in run
       httpd.serve_forever()
     File "/usr/lib/python2.6/SocketServer.py", line 224, in serve_forever
       r, w, e = select.select([self], [], [], poll_interval)
   TypeError: <lambda>() takes exactly 1 argument (2 given)
2010-12-26 11:59:07 +01:00
Dan Villiom Podlaski Christiansen
83b3b076d6 hooks: sort any dictionaries set in the environment
The actual order of dictionary items is implementation-defined in
Python, and differs between CPython and PyPy. With this change,
test-hooks.t passes with PyPy.
2010-12-24 15:22:00 +01:00
Matt Mackall
ceea1a202f merge with stable 2010-12-28 13:31:30 -06:00
Zhigang Wang
5376237d45 smtp: fix for server doesn't support starttls extension
Currently we only support enabling TLS by using SMTP STARTTLS extension. But
not all the servers support it.

With this patch, user can choose which way to enable TLS:

* Default:

      tls = none
      port = 25

* To use STARTTLS:

      tls = starttls
      port = 465

* To use SMTP over SSL:

      tls = smtps
      port = 465

To keep backward compatibility, when tls = true, we use STARTTLS to enable TLS.

Signed-off-by: Zhigang Wang <w1z2g3@gmail.com>
2010-12-20 16:56:54 +08: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
David Soria Parra
e107057815 avoid .split() in for loops and use tuples instead
split can be more readable for longer lists like the list in
dirstate.invalidate. As dirstate.invalidate is used in wlock() and therefoe
used heavily, I think it's worth avoiding a split there too.
2010-12-02 03:43:06 +01:00
Oli Thissen
19beab3bf6 hgweb: added revision date to annotate line data
The only revision information yielded by the annotate view was the revision
number itself. The patch allows the use of per-line revision dates in the
corresponding templates.
2010-12-06 16:56:06 +01:00
Nicolas Dumazet
97f5e1fd2a patchbomb: save introductory message in .hg/last-email.txt 2010-12-21 19:44:28 +09:00
Jim Hague
e572ae4bd8 opener: forbid paths ending with directory separator (issue2507)
If Linux is asked to open a filename with a trailing directory separator,
e.g. "foo/", the open fails with EISDIR. On AIX, the open succeeds, opening
file "foo". This causes test-mq-qnew to fail on AIX.

Fix by adding 'ends with directory separator' to the conditions checked
by the path auditor. Change test to expect auditor fail message.
2010-12-17 12:05:45 +00:00
Kevin Bullock
4655fb606c record: clean up command table
The --force option to qnew has become a no-op, so qrecord doesn't need
to use it. This allows record's command table to be simplified; in the
process of doing so, this patch also cleans up the cmdtable visually.
2010-12-21 15:27:58 -06:00
Kevin Bullock
709bd128af record: clean up comments and docstrings
Rewrap comments and docstrings to a width of 72 chars and copy-edit.
2010-12-21 15:23:48 -06:00
Patrick Mezard
ad8768fb1a test-doctest: test url.py again, removed by ce9891a26112 2010-12-28 14:53:08 +01:00
Mads Kiilerich
2f015848bf merge with stable 2010-12-27 17:54:45 +01:00
Mads Kiilerich
b89ce1b270 extensions: warn about invalid extensions when listing disabled commands
Invalid extensions in hgext/ could in some cases cause a crash when searching
for unknown commands in disabled extensions.

With this change we issue a warning if extracting commands from the extensions
fails. Traceback is available on request.

Reported on https://bugzilla.redhat.com/show_bug.cgi?id=663183 with forest.py.
2010-12-26 00:43:49 +01:00
Steve Borho
7b9494aa62 convert: subversion should use util.quotecommand to wrap args to popen2
All other callers of util.popen2 and util.popen3 do this, as well as direct
callers of subprocess.Popen.
2010-12-22 13:25:00 -06:00
Steve Borho
cd3b55bab4 merge with stable 2010-12-23 13:23:20 -06:00
Matt Mackall
a892ad5a23 templater: clarify engine caching 2010-12-22 13:16:03 -06:00
Matt Mackall
31f9c93086 merge with crew 2010-12-22 13:16:00 -06:00
Nicolas Dumazet
a1400f1e14 tests: clean up test-rollback.t
The last comment is on the last file line and is useless, seems
like it was introduced in 6e9879cc5742 during unification.
2010-12-21 19:47:36 +09:00
Matt Mackall
55097570e7 merge with stable 2010-12-20 15:27:15 -06:00
Eric Eisner
5a68596380 subrepo: basic support for status of git subrepos 2010-12-20 13:59:33 -05:00
Eric Eisner
ca54cd3a42 subrepo: fix subrelpath for git subrepos
This patch conforms gitsubrepo code to the variable naming scheme of the other
subrepo implementations. All user-facing path references should be relative
to the root repository.
2010-12-20 13:59:33 -05:00
Eric Eisner
ec2e32efb2 subrepo: fix git archive parsing of directories and symfiles 2010-12-20 13:59:33 -05:00
Eric Eisner
056bbfc80f subrepo: support ignoreupdate in gitsubrepo's dirty() 2010-12-20 13:59:33 -05:00