Commit Graph

8368 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
1a00d3603f merge: check filename case collision between changesets for branch merging
this patch makes branch merging abort when merged changesets have same
file in different case on case insensitive filesystem.

this patch does not prevent linear update which merges between target
and working contexts, because 'branchmerge' is False in such case.
2011-12-16 21:21:27 +09:00
FUJIWARA Katsunori
fe972435d4 i18n: use encoding.lower/upper for encoding aware case folding
this patch uses encoding.lower/upper for case folding, because ones of
str can not fold case of non ascii characters correctly.

to avoid cyclic dependency and to encapsulate logic of normcase in
each platforms, this patch introduces encodinglower/encodingupper in
both posix/windows specific files.

this patch does not change implementation of normcase() in posix.py,
because we do not know the encoding of filenames on POSIX.

some "normcase()" are excluded from function wrap list in
hgext/win32mbcs.py, because they become encoding aware by this patch.
2011-12-16 21:09:41 +09:00
FUJIWARA Katsunori
cfdf6a59f4 windows: use upper() instead of lower() or os.path.normcase()
this patch uses upper() instead of lower() or os.path.normcase() for
case folding on Windows(NTFS), because lower-ing causes problems for
some languages on it.

see below for detail about problem of lower-ing:

    https://blogs.msdn.com/b/michkap/archive/2005/01/16/353873.aspx
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
055136813d icasefs: avoid normcase()-ing in util.fspath() for efficiency
'dirstate._normalize()', the only caller of 'util.fspath()', has
already normcase()-ed path before invocation of it.

normcase()-ed root can be cached on dirstate side, too.

so, this patch changes 'util.fspath()' API specification to avoid
normcase()-ing in it.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
c71595845e icasefs: use util.normcase() instead of lower() or os.path.normcase in fspath
this also avoids lower()-ing on each path components by reuse the path
normcase()-ed at beginning of function.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
167dff84e5 dirstate: prevent useless util.fspath() invocation for '.'
at first of dirstate.walk() on case insensitive filesystem,
normalization of '.' causes util.fspath() invocation, but '.' is not
cached in it.

this invocation is not only useless, but also harmful: initial "hg
tag" causes creation of ".hgtags" file after dirstate.walk(), and
looking up ".hgtags" in cache will fail, because directory contents of
root is already cached at util.fspath() invocation for '.'.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
f9ca02bd18 icasefs: consider as case sensitive if there is no counterevidence, for safety
for safety, this patch prevents case-less name from misleading into
case insensitivity, even though such names should not be used.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
44af3b0ebf pathauditor: switch normcase logic according to case sensitivity of filesystem
this patch applies 'util.normcase()' to audit path only on case
insensitive filesystem.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
6b07b41e4f pathauditor: preserve case in abort messages
this patch uses both plain and normcase()-ed pathes to preserve letter
case of path in abort messages.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
afdb157d48 pathauditor: use normcase()-ed path for audit result cache
in current pathauditor implementation, un-normcase()-ed path is
stored into and compared with audit result cache.

this is not efficiency on case insensitive filesystem.
2011-12-16 21:09:40 +09:00
Matt Mackall
e6d872a339 changelog: handle decoding of NULs in extra more carefully (issue3156)
Escaped NULs adjacent to [0-7] could be decoded as octal. This hits
about 0.24% of changesets with transplant, which stores binary nodes.
2011-12-16 18:23:15 -06:00
FUJIWARA Katsunori
ee602b5c96 icasefs: use util.normcase() instead of str.lower() or os.path.normpath() 2011-12-12 17:10:19 +09:00
Renato Cunha
cb456a1751 diff: don't crash when diffing a revision with a deleted subrepo (issue3153)
When a user requested a diff between a revision (r1) that contained a subrepo
and another (r2) that did not, mercurial would crash if r1 was specified before
r2 but would execute the diff otherwise. This fixes this behavior by skipping
the missing subrepo in the diff.
2011-12-14 12:28:00 -02:00
Martin Geisler
034d08dce7 status: add missing ":" to help text 2011-12-15 11:13:38 +01:00
Matt Mackall
a69962e18c branch: warn on branching 2011-12-08 14:32:44 -06:00
Matt Mackall
d91862b8e5 branch: move note about permanence to the top, add 'global' 2011-12-05 17:09:11 -06:00
Patrick Mezard
3a0effcd7b util: fix url.__str__() for windows file URLs
Before:

  >>> str(url('file:///c:/tmp/foo/bar'))
  'file:c%3C/tmp/foo/bar'

After:

  >>> str(url('file:///c:/tmp/foo/bar'))
  'file:///c%3C/tmp/foo/bar'

The previous behaviour had no effect on mercurial itself (clone command for
instance) because we fortunately called .localpath() on the parsed URL.
hgsubversion was not so lucky and cloning a local subversion repository on
Windows no longer worked on the default branch (it works on stable because
2b62605189dc defeats the hasdriveletter() test in url class).

I do not know if the %3C is correct or not but svn accepts file:// URLs
containing it. Mads fixed it in 2b62605189dc, so we can always backport should
the need arise.
2011-12-04 18:22:25 +01:00
Greg Ward
d364c25d5a rollback: always call destroyed() (regression from 1.9)
The contract for repo.destroyed() is that it is called whenever
changesets are destroyed, either by strip or by rollback. That
contract was inadvertently broken in 6c30b131b2ae, when we made a
chunk of code conditional on destroying one of the working dir's
parents. Oops: it doesn't matter *which* changesets are destroyed or
what their relationship is to the working dir, we should call
repo.destroyed() whenever we destroy changesets.
2011-12-01 17:39:30 -05:00
Matt Mackall
720ed4fcd7 alias: shortcut command matching show shadowing works properly (issue3104)
An alias for 'log' was stored in the same command table as
'^log|history'. If the hash function happens to give the latter first,
the alias is effectively ignored when matching 'log'.
2011-12-01 15:51:36 -06:00
Sune Foldager
b1f5c2e814 bundlerepo: don't write branch cache to disk
Calling branchmap() or similar on a bundlerepo would write the bundle-augmented
branch cache to disk, requiring a subsequent expensive rebuild when the repo
is used without the bundle.
2011-12-01 14:17:17 +01:00
Matt Mackall
a837de171f revset: balance %l or-expressions (issue3129) 2011-11-30 22:43:24 -06:00
Benoit Allard
f3be9c5304 diff: '\ No newline at end of file' is also not part of the header
Diff containing '\ No newline at end of file' were colorized incorrectly.
2011-11-29 19:51:35 +01:00
Matt Mackall
4ed869c059 posix: fix HFS+ percent-encoding folding
We use 'ignore' rather than 'replace' so we don't have to deal with
u+FFFD in UTF-8 round-trip.
2011-11-23 14:22:37 -08:00
Augie Fackler
ca0638e3d0 clone: don't save user's password in .hg/hgrc (Issue3122) 2011-11-22 12:06:42 -06:00
Matt Mackall
de7392db69 posix: add extended support for OS X path folding
OS X does the following transformation on paths for comparisons:

a) 8-bit strings are decoded as UTF-8 to UTF-16
b) undecodable bytes are percent-escaped
c) accented characters are converted to NFD decomposed form, approximately
d) characters are converted to _lowercase_ using internal tables

Both (c) and (d) are done using internal tables that vary from release
to release and match Unicode specs to greater or lesser extent. We
approximate these functions using Python's internal Unicode data.

With this change, Mercurial will (in almost all cases) match OS X
folding and not report unknown file aliases for files in UTF-8 or
other encodings.
2011-11-22 17:26:32 -06:00
Matt Mackall
14399ab3d4 dirstate: use util.normcase to build foldmap 2011-11-22 17:26:31 -06:00
Mads Kiilerich
ba2b5b0d23 update: don't clobber untracked files with wrong casing 2011-11-20 23:09:32 +01:00
Mads Kiilerich
7f38d9b9d4 help: Backed out changeset daf758dccb52, description of file urls
This help entry didn't try to describe the 'localhost' notation. It described a
non-standard host-less notation where 'local' just was the first part of a
sample relative path. It describe "urls" with relative and absolute paths like:

  file://file.txt
  file:///tmp/file.txt
  file://c:/tmp/file.txt
2011-11-18 01:32:28 +01:00
Matt Mackall
8de0c77dee revset: follow(nosuchfile) should give an empty set (issue3114) 2011-11-20 15:29:55 -06:00
Eric Roshan Eisner
5dcac2b222 subrepo: fix git status false positive (issue3109)
It turns out there's a separate command to force git to look at file contents
if the stat has changed.
2011-11-11 11:11:11 +11:11
Thomas De Schampheleire
09f4a92184 hook: flush stdout before redirecting to stderr
When hook output redirection is enabled (e.g. when cloning over ssh), hook
output on stdout is redirected to stderr, to prevent the repository data on
stdout from being corrupted.
In certain cases, the redirection could cause part of the repository data to
end up on stderr as well. In case of a clone, this causes:
"abort: consistency error in delta!"

This was seen with a clone over ssh, an outgoing hook present (any
non-python type, e.g. 'pwd'), on certain repositories only,
probably depending on the distribution of the sent data)

This patch updates the hook redirection code to flush stdout before
redirecting, removing the problem.
2011-11-16 08:34:36 +01:00
Patrick Mezard
942cefafa6 import: fix parent selection when importing merges
With "wp1" and "wp2" the current working directory parents, "p1" and "p2" the
patch parents and "parents" the resulting commit parents, the current behaviour
is:

--bypass --exact p2 parents
0        0       0  [wp1, wp2]
0        0       1  [wp1, wp2]/buggy
0        1       0  [p1]
0        1       1  [p1, p2]
1        0       0  [wp1, wp2]
1        0       1  [p1, p2]
1        1       0  [p1]
1        1       1  [p1, p2]

The original behaviour before 1f543fd375c5 was:

--bypass --exact p2 parents
0        0       0  [wp1, wp2]
0        0       1  if p1 == wp1 then [p1, p2] otherwise [wp1, wp2]
0        1       0  [p1]
0        1       1  [p1, p2]

This patch restores the previous behaviour when --bypass is not set, and align
--bypass behaviour when --exact is not set with merge diffs.
2011-11-16 12:53:10 +01:00
Patrick Mezard
16811ddcba diff: --ignore-blank-lines was too enthusiastic
It was ignoring changes from:

ab

to:

a
b
2011-11-13 21:37:14 +01:00
Stefano Tortarolo
f195f71994 graft: disallow grafting grafted csets in specific situations (issue3091)
In particular, we do not allow:
- grafting an already grafted cset onto its original branch
- grafting already grafted csets with the same origin onto each other
2011-11-12 14:00:25 +01:00
Stefano Tortarolo
dfee711e26 graft: preserve original source in subsequent grafts 2011-11-12 13:15:40 +01:00
Dmitry Panov
6649925e57 makedate: wrong timezone offset if DST rules changed this year (issue2511)
Python's time module sets timezone and altzone based on UTC offsets of
two dates: first and middle day of the current year. This approach
doesn't work on a year when DST rules change.

For example Russia abandoned winter time this year, so the correct UTC
offset should be +4 now, but time.timezone returns 3 hours difference
because that's what it was on 01.01.2011.

Related python issue: http://bugs.python.org/issue1647654
2011-11-13 00:29:26 +00:00
Marc-Antoine Ruel
05df0333e0 posix: fix findexe() to check for file type and access 2011-11-16 17:55:32 -06:00
Mads Kiilerich
b49a4ee31a subrepo: use correct paths for subrepos with ..-relative paths on windows
posixpath normpath of c:\foo\bar/../baz is baz, so now we pconvert first.
2011-11-15 02:16:30 +01:00
Mads Kiilerich
065de91b14 add missing localization markup 2011-11-11 01:07:10 +01:00
Mads Kiilerich
5d7000644a url: handle file://localhost/c:/foo "correctly"
The path was parsed correctly, but localpath prepended an extra '/' (as in
'/c:/foo') because it assumed it was an absolute unix path.
2011-11-16 00:10:56 +01:00
Mads Kiilerich
85ec0fb7bf help: it is 'file://localhost/', not 'file://local/'
The documentation has apparently always been wrong.
2011-11-16 00:10:52 +01:00
Matt Mackall
3eab62750e dirstate: fix case-folding identity for traditional Unix
We used to use os.path.normcase which was a no-op, which was unhelpful
for cases like VFAT on Linux.
2011-11-15 14:25:11 -06:00
Stefano Tortarolo
a179a7e151 graft: mark a string for translation 2011-11-08 21:31:39 +01:00
Nicolas Venegas
2582d1e3d9 mdiff/patch: fix bad hunk handling for unified diffs with zero context
Prior to this patch "hg diff -U0", i.e., zero lines of context, would
output hunk headers with a start line one greater than what GNU patch
and git output. Guido van Rossum documents the unified diff format[1]
as having a start line value "one lower than one would expect" for
zero length hunks.

Comparing the behaviour of the three systems prior to this patch in
transforming

  c1
  c3

to

  c1
  c2
  c3

- GNU "diff -U0" reports the hunk as "@@ -1,0 +2 @@"
- "git diff -U0" reports the hunk as "@@ -1,0 +2 @@"
- "hg diff -U0" reports the hunk as "@@ -2,0 +2,1 @@"

After this patch, "hg diff -U0" reports "@@ -1,0 +2,1 @@".

Since "hg export --config diff.unified=0" outputs zero-context unified
diffs, "hg import" has also been updated to account for start lines
one less than expected for zero length hunk ranges.

[1]: http://www.artima.com/weblogs/viewpost.jsp?thread=164293
2011-11-09 16:55:59 -08:00
Martin Geisler
3d4a8c449c merge with main 2011-11-04 10:31:38 +01:00
David M. Carr
b8f899bd68 subrepo: improve help for svn subrepo support
Add details on which commands are supported for Subversion subrepos.
2011-11-03 23:12:31 -04:00
David M. Carr
6878ff4146 subrepo: improve help for git subrepo support
Add details on which commands are supported for git subrepos.
2011-11-03 23:12:30 -04:00
David M. Carr
4025aa1003 subrepo: update help for commit to reflect new default behavior
Update the subrepo help to be consistent with the new default behavior,
which is to abort if any subrepo is dirty.
2011-11-03 23:11:40 -04:00
Matt Mackall
864ce9da04 misc: adding missing file close() calls
Spotted by Victor Stinner <victor.stinner@haypocalc.com>
2011-11-03 11:24:55 -05:00
Matt Mackall
e576cf8a52 dirstate: don't fail when dropping a not-tracked file (issue3080)
Complex merges with divergent renames can cause a file to be 'moved'
twice, causing dirstate.drop() to be called twice. Rather than try to
ensure there are no unexpected corner cases where this can happen, we
simply ignore drops of files that aren't tracked.
2011-11-01 15:19:37 -05:00
FUJIWARA Katsunori
f6b7a91d98 minirst: use unicode string as intermediate form for replacement
# this change redones part of e0051068893a, backed out by 38c00c035629

Some character encodings use ASCII characters other than
control/alphabet/digit as a part of multi-bytes characters, so direct
replacing with such characters on strings in local encoding causes
invalid byte sequences.

[mpm: test changed to simple doctest]
2011-10-31 21:06:18 +09:00
Matt Mackall
9580de9b45 util: add a doctest for empty sha() calls 2011-10-31 15:41:39 -05:00
Matt Mackall
bbf72a4e6e util: allow sha1() with no args
Normally this works because we replace util.sha1 with hashlib.sha1
after first use, but if the first user doesn't provide an arg, it
breaks.
2011-10-31 14:22:11 -05:00
Matt Mackall
7215130ac4 strip: backout 9aac86f54486 (issue3077) 2011-10-30 12:10:09 -05:00
Matt Mackall
b066b57e3c backout 17bc9a6bb165 (issue3077) (issue3071)
Using util.realpath turns out to create complex issues on both Mac and
Windows. Back this change out for the release.
2011-10-29 11:02:23 -05:00
Brodie Rao
aabbd72d18 hgweb: fix dynamic date calculation not working under Safari
While Chrome, Firefox, and IE 6+ support the current date format being
passed to Date(), Safari doesn't:

> new Date('Mon Oct 24 13:58:01 2011 +0200')
  Invalid Date

However, the rfc822date format--officially supported by
ECMAScript[1]--does work:

> new Date('Mon, 24 Oct 2011 13:58:01 +0200')
  Mon Oct 24 2011 04:58:01 GMT-0700 (PDT)

This change replaces all instances of {date|date} in HTML with
{date|rfc822date}. For elements that only have the "age" class,
there's no outward change for users with JavaScript enabled. For
elements with both the "age" and "date" classes, the full date
displayed uses the new format.

Tested in IE 6, Safari 5.1.1, Google Chrome 15, and Firefox 7.0.1.

[1]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse
2011-10-27 11:57:08 -07:00
Peer Stritzinger
ed0c1f398e revert: fix missing removes when parent was changed in dirstate
When dirstate parent is changed with dirstate.setparent before a
revert so it no longer points to where the dirstate refered to, revert
does not remove all files it should:

Revert to a different revision needs also to remove files that are not
found through disptables and not in the context or parent manifest.
2011-10-26 18:47:12 +02:00
Patrick Mezard
1e1f58f358 diffstat: be more picky when marking file as 'binary' (issue2816)
The 'Bin' marker was added to every changed file for which we could not find
any diff changes. This included binary files but also copy/renames and mode
changes. Since Mercurial regular diff format emits a 'Binary file XXX has
changed' line when fed with binary files, we use that and the usual git marker
to tell them from other cases. In particular, new empty files are no longer
reported as binary.

Still, this fix is not complete since copy/renames/mode changes are now
reported as '0' lines changes, instead of 'Bin'.
2011-10-24 13:41:19 +02:00
Matt Mackall
b7f097bf54 graft: fix duplicate filter logic 2011-10-24 16:57:14 -05:00
Matt Mackall
0d1e03e15b graft: fix duplicate scan message 2011-10-24 16:57:14 -05:00
Matt Mackall
226e1ff7c0 util: don't complain about '..' in path components not working on Windows 2011-10-24 16:57:14 -05:00
Matt Mackall
11a871ed47 graft: fix formatting of message 2011-10-24 12:09:12 -05:00
Thomas Arendsen Hein
51c498ead0 consistency: use util.realpath instead of os.path.realpath where useful
exceptions:
  hg: os.path.realpath used before util can be imported
  tests/run-tests.py: may not import mercurial modules
2011-10-24 13:51:24 +02:00
Thomas Arendsen Hein
f4c6197057 posix: workaround for os.path.realpath bug in Python 2.4.1 and before
os.path.realpath didn't resolve symlinks that were the first component of
the path, see http://bugs.python.org/issue1213894
2011-10-24 13:32:23 +02:00
Matt Mackall
788df2a72b windows: sanity-check symlink placeholders
On Windows, we store symlinks as plain files with the link contents.
Via user error or NFS/Samba assistance, these files often end up with
'normal' file contents. Committing these changes thus gives an
invalid symlink that can't be checked out on Unix.

Here we filter out any modified symlink placeholders that look
suspicious when computing status:

- more than 1K (looks more like a normal file)
- contain NULs (not allowed on Unix, probably a binary)
- contains \n (filenames can't contain \n, very unusual for symlinks,
  very common for files)
2011-10-23 16:32:27 -05:00
Matt Mackall
3044265f69 windows: recompute flags when committing a merge (issue1802)
Before this patch, Windows always did the wrong thing with exec bits
when committing a merge: consult the flags in first parent.

Now we manually recompute the result of merging flags at commit time,
which almost always does the right thing (except when there are
conflicts between symlink and exec flags).

To do this, we:

- pull flag synthesis out into its own function
- delay building this function unless it's needed
- add a merge case that compares flags in local and other against the ancestor

This has been tested in multiple ways on Linux:

- running the whole test suite with both old and new code in place,
  checking for differences in each flags() result
- running the whole test suite while comparing real on-disk flags
  against synthetic ones for merges
- test-issue1802 (from Martin Geisler) which disables exec bit
  checking on Unix
2011-10-22 16:12:33 -05:00
Kevin Bullock
dd00f9e122 import: abort usefully if no patch name given 2011-10-21 11:10:43 -05:00
Pierre-Yves David
4d3328f835 revset: disambiguous the node variable
The module could be confused with the function.
2011-10-21 14:15:58 +02:00
Matt Mackall
01c8789013 revset: deal with empty lists in formatspec 2011-10-21 12:12:21 -05:00
Martin Geisler
acfa971cf1 subrepos: abort commit by default if a subrepo is dirty (BC)
This changeset flips the default value of ui.commitsubrepos setting
from True to False and adds a --subrepos flag to commit.

The commit, status, and diff commands behave like this with regard to
recusion and the ui.commitsubrepos setting:

          | recurses      | recurses
          | by default    | with --subrepos
  --------+---------------+----------------
  commit: | commitsubrepo | True
  status: | False         | True
  diff:   | False         | True

By changing the default from True to False, the table becomes
consistent in the two columns:

* without --subrepos on the command line, commit will abort if a
  subrepo is dirty and status/diff wont show changes inside subrepos.

* with --subrepos, all three commands will recurse.

A --subrepos flag on the command line overrides the config settin.g
2011-10-21 00:33:08 +02:00
Wagner Bruna
7a521d704e bisect: add i18n contexts 2011-10-18 09:38:14 -02:00
Wagner Bruna
d4e8e13b0d import: add i18n context 2011-10-18 09:38:10 -02:00
Mads Kiilerich
06d30b903b grep: correct handling of matching lines without line ending (issue3050)
Matching lines without trailing '\n' was missing the last character.

That seems to have been an unintended side effect of 8abe3f27975c.
The test in c21748e4cd4d documents the bad behaviour.
2011-10-16 01:26:06 +02:00
Pierre-Yves David
88aa929fad discovery: Fix error print mentioning a 'None' branch
When talking to old server discovery use heads of the 'None' branch to refer to
topological heads. This use of None should never make it to the end user.
2011-10-17 11:37:59 +02:00
Matt Mackall
9dea83bdb8 auth: fix realm handling with Python < 2.4.3 (issue2739) 2011-10-17 13:42:42 -05:00
Martin Geisler
c49aaff90e subrepo: abort in hgsubrepo._get if the destination is obstructed
Before, we deleted foo when we determined that there were zero
changesets in the foo subrepo. Any files in foo was deleted too. We
now delete foo/.hg instead, and the normal checks in hg.clone will
then abort if there are untracked files in foo.
2011-10-17 18:01:38 +02:00
Martin Geisler
ebc547d4c7 subrepo: pull revisions on demand when archiving hg subrepos
Before, running 'hg archive -S' could result in

 abort: unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'!

if a subrepo was missing completely or had missing changesets. Now,
the missing changesets will be pulled or cloned as appropriate.

This make Mercurial subrepos match Git subrepos which already took
care to fetch any missing commits before starting the archive.
2011-10-17 16:45:19 +02:00
Thomas Arendsen Hein
5a6f0ca4ac commands: use separate try/except and try/finally as needed for python2.4
69d55e9a084a introduced a try/except/finally block, which breaks compatibility
with python2.4
2011-10-16 11:12:59 +02:00
Matt Mackall
2ba9ce4879 revset: fix %r handling in formatspec 2011-10-15 12:52:43 -05:00
Matt Mackall
275981abb2 revset: add %r for embedded revset support to formatspec
This allows folding external revsets or lists of revsets into a revset
expression. Revsets are pre-parsed for validity so that syntax errors
don't escape.
2011-10-15 10:20:08 -05:00
Angel Ezquerra
16f9562667 revert: warn that subrepos cannot be reverted
(tests added by mpm)
2011-10-15 01:06:52 +02:00
Greg Ward
aeec456986 merge: expand environment variables and ~/ in tool.executable
hgrc(5) already implies that this works, so we might as well support it.

Another approach would be to implement this in util.findexe(): that
would benefit other callers of findexe(), e.g. convert and anyone
calling the user's editor. But findexe() is really implemented in
both posix.py and windows.py, so this would make both of those modules
depend on util.py: not good. So keep it narrow and only for merge
tools.
2011-10-12 21:45:58 -04:00
Matt Mackall
7791d14df5 minirst: add style flag to format 2011-10-15 00:39:04 -05:00
Matt Mackall
cdd258d4fd minirst: add basic HTML formatting support 2011-10-15 00:39:01 -05:00
Matt Mackall
7751048134 graft: use status verbosity for reporting grafts 2011-10-14 15:40:50 -05:00
Angel Ezquerra
30a511a833 push: propagate --new-branch and --ssh options when pushing subrepos
Up until now the all the push command options were ignored when pushing
subrepos. In particular, the fact that the --new-branch command was not passed
down to subrepos made it not possible to push a repo when any of its
subrepos had a new branch, even if you used the --new-branch option of the push
command.

In addition the error message was confusing since it showed the following hint:
"--new-branch hint: use 'hg push --new-branch' to create new remote branches".
However using the --new_branch flag did not fix the problem, as it was ignored
when pushing subrepos.

This patch passes the --new-branch and --ssh flags to every subrepo that is
pushed.

Issues/Limitations:

- All subrepo types get these flags, but only the mercurial subrepos use them.
- It is no longer possible to _not_ pass down these flags to subrepos when
pushing:
   * An alternative would be to introduce a --subrepos flag that should be
used to pass down these flags to the subrepos.
   * If we did this, it could make sense to make the --force flag respect this
   new --subrepos flag as well for consistency's sake.
- Matt suggested that the ssh related flags could also be passed down to
subrepos during pull and clone. However it seems that it would be the "update"
command that would need to get those, since subrepos are only pulled on update.
In any case I'd prefer to leave that for a later patch.
2011-09-29 17:20:04 +02:00
Pierre-Yves David
051b2da122 phases: implement `phase() and hidden()` method for workingctx
Working ctx don't have revision number and need a dedicated implementation.
2011-12-21 23:56:15 +01:00
Pierre-Yves David
78429733cd Add a phases.new-commit option to control minimal phase of new commit
this option is both intended for human and internal code usage.
2011-12-20 01:31:25 +01:00
Pierre-Yves David
dd39afe5c4 phases: update doc to mention secret phase 2011-12-20 01:34:12 +01:00
Pierre-Yves David
164efe3ee5 phases: add a mutable boolean property on context 2011-12-19 23:31:38 +01:00
Matt Mackall
228f9f6b08 merge with stable 2011-12-21 14:36:08 -06:00
Pierre-Yves David
1fd5692284 phases: add a function to compute visible heads
This function will be used to hide secret changeset.
2011-12-19 11:37:44 +01:00
Pierre-Yves David
3d9a6a91e3 phases: Add a third phase for secret changeset 2011-12-18 23:16:46 +01:00
Pierre-Yves David
d7a17ef9c1 phases: fix advanceboundary behavior when targetphase !=0
Changeset was properly removed from upper phase but was not explicitly added to
target phase. If advanced changesets had not pwasnt in target phase they was
considered public (0-phase).
2011-12-19 11:29:39 +01:00
Matt Mackall
7cf4e6eacb merge with stable 2011-12-16 19:05:59 -06:00
Pierre-Yves David
f9b3764a1f phases: change publish behavior to only alter behavior when server.
Older publish=True was:

  1) Content of Publishing server are seen as public by client.
  2) Any changegroup *added* to a publish=True server is public.

New definition are:

  1) Content of Publishing server are seen as public by client.
  2) Any changegroup *pushed* to a publish=True server is public.

See mercurial/phase.py documentation for exact final behavior
2011-12-15 23:08:09 +01:00
Matt Mackall
9f8ee10163 util: don't mess with builtins to emulate buffer() 2011-12-15 15:27:11 -06:00
Matt Mackall
49b0ffe198 util: clean up function ordering 2011-12-15 14:59:22 -06:00
Matt Mackall
03f5247248 merge with stable 2011-12-15 14:37:36 -06:00
Pierre-Yves David
3f5fbfb66a wireproto: handle other server output in pushkey
Remote side may add useful information alongside failure return code. For
example "ssl is required". This patch mirror what is done for the unbundle
command.
2011-12-12 15:16:58 +01:00
Pierre-Yves David
0d9927b223 phases: exchange phase boundaries on push
For now phase sync is tried even if push fails with some know pathological
case. The exact behavior is to be discussed and implemented later.
2011-12-15 11:45:01 +01:00
Pierre-Yves David
c8f1983f55 phases: exchange phase boundaries on pull
Add an extra argument to addchangegroup to all phase code to execute before the
lock is released.
2011-12-15 11:28:42 +01:00
Pierre-Yves David
28f802f934 phases: add a function to compute heads from root 2011-12-15 02:18:24 +01:00
Pierre-Yves David
a6373d74dc phases: add basic pushkey support 2011-12-15 11:24:26 +01:00
Pierre-Yves David
ca1e55e405 phases: add a phases.publish option
What is a "publishing repository"?
==================================

Setting a repository as "publishing" alter its behavior **when used as a
server**: all changesets are **seen** as public changesets by clients.

So, pushing to a "publishing" repository is the most common way to make
changesets public: pushed changesets are seen as public on the remote side and
marked as such on local side.

Note: the "publishing" property have no effects for local operations.

Old repository are publishing
=============================

Phase is the first step of a series of features aiming at handling mutable
history within mercurial. Old client do not support such feature and are unable
to hold phase data. The safest solution is to consider as public any changeset
going through an old client.

Moreover, most hosting solution will not support phase from the beginning.
Having old clients seen as public repositories will not change their usage:
public repositories where you push *immutable* public changesets *shared* with
others.

Why is "publishing" the default?
================================

We discussed above that any changeset from a non-phase aware repository should
be seen as public.  This means that in the following scenario, X is pulled as
public::

  ~/A$ old-hg init
  ~/A$ echo 'babar' > jungle
  ~/A$ old-hg commit -mA 'X'
  ~/A$ cd ../B
  ~/B$ new-hg pull ../A # let's pretend A is served by old-hg
  ~/B$ new-hg log -r tip
     summary:     X
     phase:       public

We want to keep this behavior while creating/serving the A repository with
``new-hg``. Although committing with any ``new-hg`` creates a draft changeset.
To stay backward compatible, the pull must see the new commit as public.
Non-publishing server will advertise them as draft. Having publishing repository
the default is thus necessary to ensure this backward compatibility.

This default value can also be expressed with the following sentence: "By
default, without any configuration, everything you exchange with the outside is
immutable.". This behaviour seems sane.

Why allow draft changeset in publishing repository
=====================================================

Note: The publish option is aimed at controlling the behavior of *server*.
Changeset in any state on a publishing server will **always*** be seen as public
by other client. "Passive" repository which are only used as server for pull and
push operation are not "affected" by this section.

As in the choice for default, the main reason to allow draft changeset in
publishing server is backward compatibility. With an old client, the following
scenario is valid::

  ~/A$ old-hg init
  ~/A$ echo 'babar' > jungle
  ~/A$ old-hg commit -mA 'X'
  ~/A$ old-hg qimport -r . # or any other mutable operation on X

If the default is publishing and new commits in such repository are "public" The
following operation will be denied as X will be an **immutable** public
changeset. However as other clients see X as public, any pull//push (or event
pull//pull) will mark X as public in repo A.

Allowing enforcement of public changeset only repository through config is
probably something to do. This could be done with another "strict" option or a
third value config for phase related option (mode=public, publishing(default),
mutable)
2011-12-15 11:57:33 +01:00
Matt Mackall
31beaa1cd1 merge with crew 2011-12-15 14:24:38 -06:00
Martin Geisler
d6b9b24fa1 merge with stable 2011-12-15 16:26:33 +01:00
Martin Geisler
237daccf1b dispatch: remove extra newline
The return statement belongs to the lines above.
2011-12-10 18:40:05 +01:00
Ion Savin
b96d2a90cd annotate: show full changeset hash when invoked with --debug and -c 2011-12-09 14:14:30 +02:00
Martin Geisler
ae8ca6aff5 merge: make debug output easier to read
I always found it hard to figure out what the debug code meant without
the separators.
2011-12-09 17:34:53 +01:00
Thomas Arendsen Hein
8337fb5549 sshrepo: add more safe characters (issue2983)
Extended the list of safe characters introduced in c3194121de6c to include
everything from pipes._safechars, which is only available on Unix platforms.
Place "-" at the end of the range to avoid backslash-escape.
New characters: @%+=:,
2011-12-09 15:50:33 +01:00
Matt Mackall
a968007692 merge with stable 2011-12-08 16:01:44 -06:00
Mads Kiilerich
2ee0e99705 sshrepo: don't quote obviously safe strings (issue2983)
This restores compatibility with hg-over-ssh servers that don't parse
commandlines as sh does but works ok in the most common cases.
2011-12-08 16:39:00 +01:00
Kevin Bullock
487ddecbc0 bookmarks: update and updatecurrentbookmark return status
This makes bookmarks.update() and bookmarks.updatecurrentbookmark() return
True or False to indicate whether the bookmark was updated or not. This allows
callers to e.g. abort if the update failed.
2011-11-16 15:29:57 -06:00
Kevin Bullock
49b349ede1 bookmarks: clarify help for use of merge and update 2011-12-07 11:23:13 -06:00
Kevin Bullock
4b1f198355 merge: make 'nothing to merge' aborts consistent
Makes the 'nothing to merge' abort messages in commands.py consistent with
those in merge.py. Also makes commands.merge() and merge.update() use hints.
The tests show the changes.
2011-12-07 11:23:01 -06:00
Kevin Bullock
d434bb6e1a merge: remove excess creation of changectx 2011-12-07 11:22:57 -06:00
Matt Mackall
239b73ab8c bookmarks: mark divergent bookmarks with book@pathalias when source in [paths] 2011-12-07 16:19:39 -06:00
Matt Mackall
395e8d3f93 bookmarks: shadow divergent bookmarks of foo with foo@n 2011-12-06 14:17:33 -06:00
Christian Ebert
d589940139 help: properly underline annotate config heading 2011-12-06 13:21:45 +01:00
Matt Mackall
e82c2e671f merge with stable 2011-12-05 17:48:40 -06:00
Matt Mackall
9e27ec8fc4 merge with stable 2011-12-01 15:57:10 -06:00
Matt Mackall
a224af5d42 merge with stable 2011-12-01 01:42:03 -06:00
Matt Mackall
3d60dfdd1c merge with stable 2011-11-30 17:15:39 -06:00
Arne Babenhauserheide
eaac554b05 clone: get all bookmarks before updating 2011-11-04 10:18:40 +01:00
Matt Mackall
2e8aaf75f9 lock: change name of release chain 2011-11-30 16:53:44 -06:00
Matt Mackall
0a7c1f46a7 localrepo: remove asserts in _afterlock 2011-11-30 16:20:07 -06:00
Matt Mackall
9606772122 localrepo: rename _postrelease to _afterlock 2011-11-30 15:36:55 -06:00
Matt Mackall
5fbe95bf65 addchangegroup: ony queue hooks when we have changesets 2011-11-30 15:33:44 -06:00
Pierre-Yves David
5ac8c7b10a addchangegroup: remove the lock argument on the addchangegroup methods
This argument is no longer require. post lock release code is now handled with
dedicated post release callback code in lock itself.
2011-11-28 01:32:13 +01:00
Pierre-Yves David
3e4593fedf addchangegroup: use a postrelease callback to call changegroup hook
This is will allow addchangegroup to drop lock related code.
2011-11-28 01:18:15 +01:00
Pierre-Yves David
a72322069e lock: add mechanism to register post release callback 2011-11-28 15:05:26 +01:00
Mads Kiilerich
c4feda7dd3 ssh: quote remote paths (issue2983) 2011-11-26 00:10:31 +01:00
Mads Kiilerich
498fe2dc88 id: add command line options for handling ssh and https urls 2011-11-26 00:10:12 +01:00
Patrick Mezard
a50918f3cf status: support revsets with --change 2011-11-24 11:38:16 +01:00
Matt Mackall
bd2719486e merge with stable 2011-11-23 16:35:17 -06:00
Mads Kiilerich
1961772a73 mail: use quoted-printable for mime encoding to avoid too long lines (issue3075)
Quoted-printable was already used for the more critical patch mails, so it
should be fine for everything else as well.
2011-11-23 02:44:11 +01:00
Mads Kiilerich
ae4bd7a809 notify: add option for writing to mbox
This makes it possible to test how the mails that are sent _really_ look like.
2011-11-23 02:36:33 +01:00
Mads Kiilerich
c30004d07d mail: mbox handling as a part of mail handling, refactored from patchbomb 2011-11-23 02:11:24 +01:00
Matt Mackall
5bbf1ec751 merge with stable 2011-11-22 17:34:22 -06:00
Matt Mackall
d3ba23d77e merge with stable 2011-11-21 13:11:17 -06:00
Matt Mackall
6c076151bb merge with stable 2011-11-20 16:06:18 -06:00
Patrick Mezard
c4cef76e25 mdiff: replace wscleanup() regexps with C loops
On my system it reduces:

  hg annotate -w mercurial/commands.py

from 36s to less than 8s, to be compared with 6.3s when run without whitespace
options.
2011-11-18 14:23:03 +01:00
Patrick Mezard
252fc23b56 mdiff: split lines in allblocks() only when necessary
These are only required to handle the --ignore-blank-lines case
2011-11-18 14:16:47 +01:00
Patrick Mezard
cc3315778f annotate: support diff whitespace filtering flags (issue3030)
splitblock() was added to handle blocks returned by bdiff.blocks() which differ
only by blank lines but are not made only of blank lines. I do not know exactly
how it could happen but mdiff.blocks() threshold behaviour makes me think it
can if those blocks are made of very popular lines mixed with popular blank
lines. If it is proven to be wrong, the function can be dropped.

The first implementation made annotate share diff configuration entries. But it
looks like users will user -w/b for annotate but not for diff, on both the
command line and hgweb. Since the latter cannot use command line entries, we
introduce a new [annotate] section duplicating the diff whitespace options.
2011-11-18 12:04:31 +01:00
Patrick Mezard
4772aafb85 mdiff: make diffblocks() return all blocks, matching and changed
Annotate uses matching blocks not changed ones.
2011-11-18 12:01:04 +01:00
Patrick Mezard
ddbd229fe3 mdiff: extract blocks whitespace normalization in diffblocks()
We want to reuse it in annotate for whitespace normalization.
2011-11-18 11:53:38 +01:00
Matt Mackall
75db0d196a merge with stable 2011-11-17 16:53:17 -06:00
Patrick Mezard
31705153e3 patch: simplify hunk extents parsing
Do not capture unwanted groups in regexps
2011-11-14 18:16:01 +01:00
Marc-Antoine Ruel
803348c87d posix: fix findexe() to check for file type and access 2011-11-17 15:44:37 -06:00
Mads Kiilerich
82bc04a832 forget: use forward slashes for internal paths
forget into a subrepo failed on windows because pathes were joined with \.
2011-11-15 02:44:55 +01:00
Matt Mackall
66de5cde16 merge: give a special message for internal:merge failure (issue3105) 2011-11-16 18:04:19 -06:00
Kevin Bullock
8db1185fdd bookmark: remove excess creation of changectx's 2011-08-17 08:55:01 -05:00
Kevin Bullock
9fce7fc5a8 bookmark: same order for options and code 2011-08-17 08:49:40 -05:00
Matt Mackall
3a9838cebc merge with stable 2011-11-15 14:33:06 -06:00
Pierre-Yves David
e719727169 phases: set common changeset to public on pull 2011-11-11 00:22:02 +01:00
Pierre-Yves David
bf6f3ef1a7 phases: mark content pushed as public in local repo on push 2011-11-11 00:21:17 +01:00
Pierre-Yves David
493771f789 phases: marked content of a changegroup as published 2011-11-11 00:19:00 +01:00
Pierre-Yves David
0f1186823a phases: set new commit in 1-phase 2011-11-11 00:15:22 +01:00
Pierre-Yves David
c97518dfab phases: add retractboundary function to move boundary backward
The advanceboundary documentation is updated to highlight the difference.
2011-11-11 00:16:53 +01:00
Pierre-Yves David
241fc82f4e phases: rename moveboundary into advance boundary
This rename prepare the creation of retract boundaru that move boundary backward
2011-11-10 01:09:15 +01:00
Pierre-Yves David
1401cbb897 phases: remove underbar into target_phase argument 2011-11-10 01:08:08 +01:00
David M. Carr
f9ef6cf73b forget: support forgetting explicit paths in subrepos
Change the behavior of the forget command such that explicit paths in
subrepos are handled by forgetting the file in the subrepo. This eliminates the
previous behavior where if you called "hg forget" for an explicit path in a
subrepo, it would state that the file is already untracked.
2011-11-09 19:46:51 -05:00
Matt Mackall
8f2b7260c4 merge with stable 2011-11-10 11:00:27 -06:00
Pierre-Yves David
e62e01ae47 phases: handle unknown nodes in boundary
We filter unknown node out of the boundary. No data is lost. A
filtering is explicitly done after strip too
2011-11-07 13:20:22 +01:00
Pierre-Yves David
75d76cce5b phases: add rollback support 2011-11-07 12:27:25 +01:00
Pierre-Yves David
7ab6d68a9a phases: add a moveboundary function to move phases boundaries
Also include logic to detect when to write phases data.
2011-11-07 14:11:01 +01:00
Pierre-Yves David
aa9ca9ca1c phases: improve context.phase()
* force recompute of outdated cache
* handle nullrev case
2011-11-07 18:37:58 +01:00
Mads Kiilerich
6485196281 util: don't encode ':' in url paths
':' has no special meaning in paths, so there is no need for encoding it.

Not encoding ':' makes it easier to test on windows.
2011-11-07 03:25:10 +01:00
Mads Kiilerich
58e471712f windows: use umask 022 in debugstate output
debugstate would always report files as mode 666 or 777 on Windows.

umask is not used on Windows, but faking and using a defalt value of 022
matches what the test suite uses on Unix.
2011-11-07 03:14:54 +01:00
Mads Kiilerich
06a1eb11e4 dispatch: exit with 8-bit exit code
The exit code returned from a program to the shell is unsigned 8-bit, but
Mercurial would sometimes try to exit with negative numbers or None. sys.exit
on Unix will convert that to 8-bit exit codes, but on Windows negative values
showed up as 0.

The exit code is now explicitly converted to unsigned 8-bit.
2011-11-07 03:14:53 +01:00
Mads Kiilerich
dcf70e02fc diff: always use / in paths in diff
Subrepo diffs would sometimes use backslash on windows.
2011-11-07 02:49:00 +01:00
Mads Kiilerich
782d103c42 cmdutil: don't use repr on paths in pathauditor - it looks strange on windows 2011-11-07 02:49:00 +01:00
Matt Mackall
e2a7ec8c71 merge with crew 2011-11-07 13:46:39 -06:00
Matt Mackall
5fdb728e0d log: hide hidden option until it actually does something 2011-11-06 14:40:31 -06:00
Martin Geisler
cc14f68b49 merge with stable 2011-11-04 10:39:04 +01:00
Matt Mackall
c735985351 merge with stable 2011-11-03 12:58:30 -05:00
David M. Carr
296a0c6305 add: support adding explicit files in subrepos
Change the behavior of the add command such that explicit paths in
subrepos are always added.  This eliminates the previous behavior
where if you called "hg add" for an explicit path in a subrepo
without specifying the -S option, it would be silently ignored.
If you specify patterns, or no arguments at all, the -S option
will still be needed to activate recursion into subrepos.
2011-11-02 01:17:11 -04:00
Yann E. MORIN
cb4376f349 bisect: remove superfluous parameter in label()
The argument is not used.  This is a left-over of non-published
iterations, and it passed through.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-20 00:37:34 +02:00
Matt Mackall
44b7e0d151 log: hide some low-utility options 2011-11-02 15:06:40 -05:00
Matt Mackall
fe45fca7d5 localrepo: convert various repo.set() users to repo.revs() 2011-11-02 13:51:16 -05:00
Matt Mackall
e8067d2be1 localrepo: add revs helper method 2011-11-02 13:37:34 -05:00
Pierre-Yves David
ef7ba6c6d0 phases: add a phase template keyword 2011-10-09 14:25:04 +02:00
Pierre-Yves David
cbc7e13374 phases: add a phase method to context 2011-10-18 18:25:53 +02:00
Pierre-Yves David
abd6a568e7 phases: add a cache allowing to know in which phase a changeset is 2011-11-04 00:20:20 +01:00
Matt Mackall
b887acee5d phases: handle errors other than ENOENT appropriately 2011-11-06 11:57:24 -06:00
Pierre-Yves David
ff2323c4af phases: basic I/O logic
Add function to read and write phase roots. Add a _phaseroots filecache on
localrepo class to access the phaseroots data.
2011-11-04 00:16:24 +01:00
Pierre-Yves David
8b33094602 phases: Minimal first add. 2011-11-03 23:49:14 +01:00
Mads Kiilerich
c91fb0e17c httprepo: make __del__ more stable in error situations
Some errors could leave self.urlopener uninitialized and thus cause strange
crashes in __del__.

This member variable is now "declared statically" and checked for assignment
before use.
2011-10-13 04:27:49 +02:00
Matt Mackall
3c9792e3dc graft: add examples and information about copied metadata 2011-10-12 18:59:59 -05:00
Matt Mackall
1841aff181 graft: add --continue support 2011-10-12 18:48:57 -05:00
Matt Mackall
d5e94e6c90 graft: add user, date, and tool options 2011-10-12 18:46:23 -05:00
Matt Mackall
0069040fa2 graft: add --edit 2011-10-12 18:46:03 -05:00
Matt Mackall
06ac7c8606 graft: add initial implementation 2011-10-12 18:45:36 -05:00
Augie Fackler
6d4a8aa3a9 bookmarks: delegate writing to the repo just like reading
This makes it easier for alternate storage backends to not use flat
files for bookmarks storage.
2011-10-12 11:09:57 -05:00
Eric Roshan Eisner
070c37b77f subrepo: fix git branch tracking logic (issue2920) 2011-10-11 21:34:55 -07:00
Augie Fackler
b0cd40af6a alias: don't shadow commands that we only partially matched (issue2993) (BC)
Previously, if you set an alias for "ci", it'd also shadow "commit"
even though you didn't specify that. This occurred for all commands
with explicit short variations.
2011-10-11 17:20:03 -05:00
Pierre-Yves David
ad8f123b6d resolve: update documentation to mention the .orig backup 2011-10-11 18:48:45 +02:00
Eric Roshan Eisner
a6f358182b cmdutil.bailifchanged: abort for dirty subrepos 2011-10-11 18:18:15 -07:00
Matt Mackall
944b7f7b5c pyflakes: clean up some import noise 2011-10-11 23:16:05 -05:00