Commit Graph

9081 Commits

Author SHA1 Message Date
Bryan O'Sullivan
47b1cf0c50 store: sort filenames in place 2012-06-25 15:14:05 -07:00
Adrian Buehlmann
bc646a116e win32: remove uneeded usage of _STARTF_USESHOWWINDOW
spawndetached() was the only user of _STARTF_USESHOWWINDOW and it creates the
process with _CREATE_NO_WINDOW anyway. If the process has no window, then
there is nothing to hide.
2012-06-25 19:26:29 +02:00
Adrian Buehlmann
d8571d886c win32: specify _CREATE_NO_WINDOW on spawndetached()
Before this change, a console window briefly popped up on "hg serve -d" and
disappeared again, stealing the focus window (which was very annyoing when
running tests).

Specifying _CREATE_NO_WINDOW instead of _DETACHED_PROCESS fixes this (as tested
on Windows 7 x64).
2012-06-25 19:11:29 +02:00
Sune Foldager
77ac86c2b5 fix push of moved bookmark when creating new branch heads
The problem occured when pushing a changeset that at the same time creates a
new named branch head and moves a bookmark. The code invoked methods that only
exist on localrepo instances, so it failed for any other type of remote. The
test suite only tested against local remotes.
2012-06-26 23:05:25 +02:00
Bryan O'Sullivan
4bb35317bc scmutil: speed up new-style range extension
This improves perfrevset performance by 10% for 2222::33333 on a
kernel repo.
2012-06-22 12:00:41 -07:00
Thomas Arendsen Hein
bbd22fd92b merge with crew-stable 2012-06-26 14:32:20 +02:00
Matt Mackall
36aa7282e4 merge with crew 2012-06-21 17:37:02 -05:00
Martin Geisler
d22efb8f52 merge with stable 2012-06-21 15:10:01 +02:00
Thomas Arendsen Hein
ad3dbec4ae graft: allow -r to specify revisions 2012-06-20 17:02:43 +02:00
Thomas Arendsen Hein
0e93bb1709 consistency: use REV instead of REVISION 2012-06-20 16:49:04 +02:00
Thomas Arendsen Hein
64a2699762 export: add optional -r to synopsis
It is not already covered by [OPTION]..., because in this case REV... would
need to be marked optional.
2012-06-20 16:46:10 +02:00
Matt Mackall
601be58425 merge with crew 2012-06-12 16:20:20 -05:00
Thomas Arendsen Hein
0c30f8dca5 archive: make progress only show files that are actually archived
Before this, files that are excluded (or not included) were shown when
using progress bar or --debug.

Reported by Andrew Shadura.
2012-06-12 12:05:52 +02:00
Alexander Boyd
dbb21eba13 statichttprepo: don't send Range header when requesting entire file
When requesting files using statichttprepo.httprangereader, a request for the
entire file is sent with a Range: bytes=0- header. This causes problems with
web servers such as Cherokee that return an HTTP 416 when an empty file is
requested in this way, which in turn cause some repository clone attempts to
fail. This patch omits the Range header when the entire file is being
requested, which fixes the problem.
2012-06-09 19:13:24 -06:00
Kevin Bullock
926372b575 update: fix help regarding update to ancestor
As pointed out on the user mailing list, hg will update just as happily
to an ancestor if there are uncommitted changes as to a descendant.
2012-06-05 13:33:52 -05:00
Matt Mackall
49a9d0006f help: drop -a from heads syntax summary (issue3483) 2012-06-04 17:22:09 -05:00
Idan Kamara
897b2d782b graft: restore config option on correct ui 2012-06-04 15:43:16 +03:00
wujek srujek
a4762c56c6 hgweb: fixes linebreak location in gitweb filediff.tmpl view
It is consistent with other templates now and doesn't cause the help link to
(incorrectly) appear on the next line.
2012-06-04 18:03:23 +02:00
Bryan O'Sullivan
ca79cf4afa scmutil: seen.union should be seen.update (issue3476) 2012-05-31 20:55:30 -07:00
Patrick Mezard
5315858d38 patch: keep patching after missing copy source (issue3480)
When applying a patch renaming/copying 'a' to 'b' on a revision where
'a' does not exist, the patching process would abort immediately,
without processing the remaining hunks and without reporting it. This
patch makes the patching no longer abort and possible hunks applied on
the copied/renamed file be written in reject files.
2012-06-01 17:37:56 +02:00
Idan Kamara
6259990e39 localrepo: clear _filecache earlier to really force reloading (issue3462)
b67b333b0d8a attempted to force the filecaches in localrepo to reload
everything after a rollback. But simply clearing _filecache isn't enough,
invalidate() needs to be called before/after. localrepo._rollback calls
invalidate() already, so we clear the map right afterwards which ensures
everything will be reread.
2012-05-29 18:27:12 +03:00
Matt Mackall
d4e4a5b5be revpair: handle odd ranges (issue3474) 2012-05-30 14:13:57 -05:00
Bryan O'Sullivan
ce2a30609e parsers: add a C function to pack the dirstate
This is about 9 times faster than the Python dirstate packing code.
The relatively small speedup is due to the poor locality and memory
access patterns caused by traversing dicts and other boxed Python
values.
2012-05-30 12:55:33 -07:00
Adrian Buehlmann
53aa68cb2c debugwalk: observe ui.slash config option 2012-06-11 11:15:14 +02:00
Mads Kiilerich
8a58b3e3c1 help: sort results from keyword search 2012-06-13 02:44:46 +02:00
Matt Mackall
4860c2a926 merge with stable 2012-06-12 16:20:38 -05:00
Bryan O'Sullivan
229aceade4 config: use util.compilere to compile regexps 2012-06-01 15:26:46 -07:00
Bryan O'Sullivan
3f45806d34 matcher: use re2 bindings if available
There are two sets of Python re2 bindings available on the internet;
this code works with both.

Using re2 can greatly improve "hg status" performance when a .hgignore
file becomes even modestly complex.

Example: "hg status" on a clean tree with 134K files, where "hg
debugignore" reports a regexp 4256 bytes in size.

  no .hgignore: 1.76 sec
  Python re:    2.79
  re2:          1.82

The overhead of regexp matching drops from 1.03 seconds with stock
re to 0.06 with re2.

(For comparison, a git repo with the same contents and .gitignore
file runs "git status -s" in 1.71 seconds, i.e. only slightly faster
than hg with re2.)
2012-06-01 15:26:20 -07:00
Olav Reinert
7c9defd0db help: fix extension commands help in keyword search
This patch fixes the synopsis shown for extension commands in keyword search
results. A previous patch erroneously caused the extension synopsis to be shown
instead.

Test cases for keyword search are missing, so I added a one.
2012-06-07 01:42:50 +02:00
Martin Geisler
9b2274c69f localrepo: lowercase "unexpected response" message 2012-06-12 14:18:18 +02:00
Martin Geisler
2fb6d24292 ui: lowercase "no username" warning 2012-06-12 14:18:18 +02:00
Martin Geisler
85338c4193 ui: lowercase "not trusting file" warning message 2012-06-12 14:18:18 +02:00
Martin Geisler
d599cd6742 ui: lowercase ConfigError warning message 2012-06-12 14:18:18 +02:00
Martin Geisler
50cde07b26 cmdutil: lowercase finddate status message
This message is output by 'hg revert -d DATE' and 'hg update -d DATE'.
2012-06-12 14:18:18 +02:00
Martin Geisler
1b024d518a bisect: lowercase status message 2012-06-12 14:18:18 +02:00
Martin Geisler
a06bcd028f serve: lowercase "no repo here" message 2012-06-12 14:18:18 +02:00
Martin Geisler
7b0a61680f debuginstall: lowercase status messages 2012-06-12 14:18:18 +02:00
Martin Geisler
65ea7aa7d4 dispatch: lowercase --time message 2012-06-12 14:18:18 +02:00
Thomas Arendsen Hein
00da630fc2 merge with stable 2012-06-12 12:10:47 +02:00
Thomas Arendsen Hein
01adf7776d merge heads 2012-06-07 15:55:12 +02:00
Thomas Arendsen Hein
b3cb4187dd help: fix 'hg help -k' matching an extension without docs
getattr is not needed, __doc__ always exists and defaults to None
2012-06-07 15:54:40 +02:00
Matt Mackall
cb4824284b merge with stable 2012-06-06 21:17:33 -05:00
Bryan O'Sullivan
1de6d211c8 util: simplify queue management in chunkbuffer
This also fixes a small wire protocol performance regression.
2012-06-05 16:52:20 -07:00
Brad Hall
f20c06750f revlog: zlib.error sent to the user (issue3424)
Give the user the zlib error message instead of a backtrace when decompression
fails.
2012-06-04 14:46:42 -07:00
Matt Mackall
b536e9c850 merge with stable 2012-06-04 17:57:57 -05:00
Olav Reinert
514c0b4725 help: fix keyword search result formatting
This patch fixes the broken formatting of keyword search results. Some blank
lines were missing from the RST markup, which caused markup to be printed.
2012-06-05 00:32:18 +02:00
Joshua Redstone
e38b770424 revlog: add optional stoprev arg to revlog.ancestors()
This will be used as a step in removing reachable() in a future diff.
Doing it now because bryano is in the process of rewriting ancestors in
C.  This depends on bryano's patch to replace *revs with revs in the
declaration of revlog.ancestors.
2012-06-01 15:44:13 -07:00
Bryan O'Sullivan
141bd09daa revlog: descendants(*revs) becomes descendants(revs) (API)
Once again making the API more rational, as with ancestors.
2012-06-01 12:45:16 -07:00
Bryan O'Sullivan
6ba97b40c1 revlog: ancestors(*revs) becomes ancestors(revs) (API)
Accepting a variable number of arguments as the old API did is
deeply ugly, particularly as it means the API can't be extended
with new arguments.  Partly as a result, we have at least three
different implementations of the same ancestors algorithm (!?).

Most callers were forced to call ancestors(*somelist), adding to
both inefficiency and ugliness.
2012-06-01 12:37:18 -07:00
Angel Ezquerra
d0a81b6fbd config: make sortdict keys() and iterkeys() methods respect the item order
The config.sortdict class is a simple "sorted dictionary" container
class, based on python's regular dict container. The main difference
compared to regular dicts is that sortdicts remember the order in
which items have been added to it.

Without this patch the items() method returns the sortdict elements in
the right order. However, getting the list of keys by using the keys()
or iterkeys() methods, and consequencly, looping through the container
elements in a for loop does not respect that order. This patch fixes
this problem.
2012-05-29 23:26:55 +02:00
Matt Mackall
ea8120ba7b merge with stable 2012-06-04 16:59:57 -05:00
Bryan O'Sullivan
7edc7069a5 parsers: replace magic number 64 with symbolic constant 2012-06-01 15:19:08 -07:00
Bryan O'Sullivan
8585634f4d revset: introduce and use _revsbetween
This is similar in spirit to revlog.nodesbetween, but less ambitious,
much simpler, and ~2x faster.
2012-06-01 15:50:22 -07:00
Bryan O'Sullivan
609ea1623d revset: implement dagrange directly
This is much faster than the older implementation (~8x).
2012-06-01 15:50:22 -07:00
Bryan O'Sullivan
a5d8345282 revset: turn dagrange into a function 2012-06-01 15:50:22 -07:00
Bryan O'Sullivan
4fbcddec79 revset: drop unreachable code 2012-06-01 15:50:22 -07:00
Olav Reinert
f234123b57 help: fix keyword search output for extension commands
This patch fixes the help keyword search "hg help -k" to show correct results
in the section listing extension commands.
2012-06-03 17:49:04 +02:00
Olav Reinert
c77c77574f help: format all output using RST
This change is the last patch needed to implement help text generation based
only on formatting a single text object marked up with RST.
2012-06-02 11:28:43 +02:00
Olav Reinert
54cafa029d help: format command and option list help using RST
This patch changes the function which generates help text about commands and
options to use RST formatting. Tables describing options have been formatted
using RST table markup for some time already, so their appearance does not
change. Command lists, however, change appearance.

To format non-verbose command lists, RST field list markup was chosen, because
it resembles the old format:

<http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists>

In the old (hand-coded) format of non-verbose command lists, the left column is
12 characters wide. Our minirst implementation formats field lists with a left
column 14 characters wide, so this patch changes the appearance of help output
correspondingly:

<http://markmail.org/message/krl4cxopsnii7s6z?q=mercurial+reinert+from:%22Olav+Reinert%22&page=2>

The minirst markup most closely resembling the old verbose command lists is
definition lists. But using it would cause a blank line to be inserted between
each command definition, making the output excessively long, and no more
useful than before. To avoid this, I chose to use field lists also for verbose
command help, resulting in output like this example:

 add           add the specified files on the next commit
 annotate, blame
               show changeset information by line for each file
 clone         make a copy of an existing repository
 commit, ci    commit the specified files or all outstanding changes
 diff          diff repository (or selected files)
 export        dump the header and diffs for one or more changesets
 forget        forget the specified files on the next commit
 init          create a new repository in the given directory
 log, history  show revision history of entire repository or files
 merge         merge working directory with another revision
 phase         set or show the current phase name
 pull          pull changes from the specified source
 push          push changes to the specified destination
 qdiff         diff of the current patch and subsequent modifications
 qinit         init a new queue repository (DEPRECATED)
 qnew          create a new patch
 qpop          pop the current patch off the stack
 qpush         push the next patch onto the stack
 qrefresh      update the current patch
 remove, rm    remove the specified files on the next commit
 serve         start stand-alone webserver
 status, st    show changed files in the working directory
 summary, sum  summarize working directory state
 update, up, checkout, co
               update working directory (or switch revisions)

This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 11:25:40 +02:00
Olav Reinert
8cf6a50897 help: format extension lists using RST
This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 11:22:33 +02:00
Adrian Buehlmann
996ab163f9 base85: cast Py_ssize_t values to int (issue3481)
If it outputs a nonsense value, no harm done, it was nonsense to start with.
2012-06-04 16:59:34 +02:00
Nikolaj Sjujskij
a32492fbe8 help: fix search with -k option in non-ASCII locales
Keyword search in help (introduced in d455a324f54f and ff267c569bea by Augie
Fackler) tries to translate already translated strings, which results in
Unicode errors in gettext when non-ASCII locale is used. Also command
descriptions should be translated before searching there (thanks to FUJIWARA
Katsunori for pointing this out and actual fix), (issue3482).
2012-06-04 10:45:56 +04:00
Adrian Buehlmann
cf5a074e7d dispatch: tolerate non-standard version strings in tuplever() (issue3470)
When developing, we may see non-standard version strings of the form

  5d64306f39bb+20120525

which caused tuplever() to raise

  ValueError: invalid literal for int() with base 10: '5d64306f39bb'

and shadowing the real traceback.
2012-05-25 14:24:07 +02:00
Patrick Mezard
8870ba9d24 revset: cache alias expansions
Caching has no performance effect on the revset aliases which triggered
the recent recursive evaluation bug. I wrote it not to feel bad about
expanding several times the same complicated expression.
2012-05-24 13:05:06 +02:00
Adrian Buehlmann
0583e3c14c base85: use Py_ssize_t for string lengths 2012-05-24 01:30:12 +02:00
FUJIWARA Katsunori
abfb6c35d4 match: make 'match.files()' return list object always
'exact' match objects are sometimes created with a non-list 'pattern'
argument:

  - using 'set' in queue.refresh():hgext/mq.py
        match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs))

  - using 'dict' in revert():mercurial/cmdutil.py (names = {})
        m = scmutil.matchfiles(repo, names)

'exact' match objects return specified 'pattern' to callers of
'match.files()' as it is, so it is a non-list object.

but almost all implementations expect 'match.files()' to return a list
object, so this may causes problems: e.g. exception for "+" with
another list object.

this patch ensures that '_files' of 'exact' match objects is a list
object.

for non 'exact' match objects, parsing specified 'pattern' already
ensures that it it a list one.
2012-05-23 00:25:29 +09:00
Patrick Mezard
139c15da66 revset: fix infinite alias expansion detection
The alias expansion code it changed from:
1- Get replacement tree
2- Substitute arguments in the replacement tree
3- Expand the replacement tree again

into:

1- Get the replacement tree
2- Expand the replacement tree
3- Expand the arguments
4- Substitute the expanded arguments in the replacement tree

and fixes cases like:

  [revsetalias]
  level1($1, $2) = $1 or $2
  level2($1, $2) = level1($2, $1)

  $ hg log -r "level2(level1(1, 2), 3)"

where the original version incorrectly aborted on infinite expansion
error, because it was confusing the expanded aliases with their
arguments.
2012-05-19 17:19:55 +02:00
Patrick Mezard
c7a80dee31 revset: explicitely tag alias arguments for expansion
The current revset alias expansion code works like:
1- Get the replacement tree
2- Substitute the variables in the replacement tree
3- Expand the replacement tree

It makes it easy to substitute alias arguments because the placeholders
are always replaced before the updated replacement tree is expanded
again. Unfortunately, to fix other alias expansion issues, we need to
reorder the sequence and delay the argument substitution. To solve this,
a new "virtual" construct called _aliasarg() is introduced and injected
when parsing the aliases definitions. Only _aliasarg() will be
substituted in the argument expansion phase instead of all regular
matching string. We also check user inputs do not contain unexpected
_aliasarg() instances to avoid argument injections.
2012-05-19 17:18:29 +02:00
Augie Fackler
3dc5160169 util: fix bad variable use in bytecount introduced by ad5e3bec298e 2012-05-21 14:24:24 -05:00
Matt Mackall
ca006af287 context: grudging accept longs in constructor 2012-05-21 16:32:50 -05:00
Matt Mackall
c082b3d973 win32: fix encoding handling for registry strings (issue3467)
This stopped handling non-ASCII strings in 1.8
2012-05-21 16:32:49 -05:00
Joshua Redstone
fe77ca6b46 strip: incrementally update the branchheads cache after a strip
This function augments strip to incrementally update the branchheads cache
rather than recompute it from scratch.  This speeds up the performance of strip
and rebase on repos with long history.  The performance optimization only
happens if the revisions stripped are all on the same branch and the parents of
the stripped revisions are also on that same branch.

This adds a few test cases, particularly one that reproduces the extra heads
that mpm observed.
2012-05-18 12:45:47 -07:00
Joshua Redstone
8395f62c2f localrepo: convert _updatebranchcache from nodespace to revspace
_updatebranchcache used to use revlog.reachable.  After the switch to
revlog.ancestors, we can now clean it up a bit and switch the algorithm from
nodes to revs.
2012-06-01 08:56:17 -07:00
Joshua Redstone
497a81eb26 discovery: convert legacy part of checkheads to revs from nodes
After a recent switch from revlog.reachable to revlog.ancestors,
clean up this old call site, switching it from nodes to revs.
2012-06-08 14:23:31 -07:00
Joshua Redstone
09130c5cf2 revlog: remove reachable and switch call sites to ancestors
This change does a trivial conversion of callsites to ancestors.
Followon diffs will switch the callsites over to revs.
2012-06-08 08:39:44 -07:00
Joshua Redstone
70aeee0070 revlog: add incancestors, a version of ancestors that includes revs listed
ancestors() returns the ancestors of revs provided. This func is like
that except it also includes the revs themselves in the total set of
revs generated.
2012-06-08 07:59:37 -07:00
Adrian Buehlmann
9a9882a6d8 scmutil: change canonpath to use util.samefile (issue2167)
Fixes (on Windows in cmd.exe):

  $ hg -R v:\x\a status V:\x\a\bar
  abort: V:\x\a\bar not under root

where v:\x\a is a valid repository with a checked-out file "bar"
(Note the difference in casing: "v:\" versus "V:\")
2012-06-14 11:43:48 +02:00
Adrian Buehlmann
aea748445b win32.py: let samefile and samedevice work on directories too 2012-06-14 11:03:20 +02:00
Matt Harbison
524542016e revset: add a utility for obtaining the source of a given rev
graft, transplant and rebase all embed a different type of source marker in
extra, and each with a different name.  The current implementation of each is
such that there will never be more than one of these markers on a node.

Note that the rebase marker can only be resolved if the source is
still present, which excludes the typical rebase usage (without
--keep) from consideration (unless the resulting bundle in
strip-backup is overlayed). There probably isn't any reason to use
rebase --keep as a substitute for transplant or graft at this point,
but maybe there was at one point and there are even a few rebases in
the hg repo, so it may be of historical interest.
2012-06-05 20:35:34 -04:00
FUJIWARA Katsunori
db8047a1c0 doc: add detail explanation for 'present()' predicate of revsets 2012-05-16 17:02:30 +09:00
Matt Mackall
1af38adeb7 osutil: handle deletion race with readdir/stat (issue3463) 2012-05-18 14:34:33 -05:00
Levi Bard
c4e66ba62d bookmarks: allow existing remote bookmarks to become heads when pushing 2012-05-13 10:21:27 +02:00
Bryan O'Sullivan
abdf4a8227 util: subclass deque for Python 2.4 backwards compatibility
It turns out that Python 2.4's deque type is lacking a remove method.
We can't implement remove in terms of find, because it doesn't have
find either.
2012-06-01 17:05:31 -07:00
Matt Mackall
6c79e00693 localrepo: move filecache clearing into invalidate
Moving from self.destroy to _rollback fixed rollback fixed rollback
but broke mq. Move it lower rather than sideways.
2012-06-01 23:44:10 -05:00
Matt Mackall
da90115a02 merge with stable 2012-06-01 15:14:29 -05:00
Matt Mackall
acd12b376b revset: avoid validating all tag nodes for tag(x)
This generally causes the entire node->rev table to get built when
we're only interested in one node.
2012-06-01 15:13:05 -05:00
Simon King
099a5c925c revset: add pattern matching to 'extra' revset expression 2012-05-30 23:14:04 +01:00
Simon King
93954249b9 revset: add pattern matching to the 'user' revset expression 2012-05-30 23:13:58 +01:00
Simon King
e5e759a651 revset: add pattern matching to 'bookmarks' revset expression 2012-05-30 23:13:33 +01:00
Simon King
85110850a9 revset: add pattern matching to 'branch' revset expression 2012-05-30 23:13:33 +01:00
Simon King
9ecf845d55 revset: add pattern matching to 'tag' revset expression
If the string provided to the 'tag' predicate starts with 're:', the rest
of the string will be treated as a regular expression and matched against
all tags in the repository.

There is a slight backwards-compatibility problem for people who actually
have tags that start with 're:'. As a workaround, these tags can be matched
using a 'literal:' prefix.

If no tags match the pattern, an error is raised. This matches the behaviour
of the previous exact-match code.
2012-05-30 23:13:33 +01:00
Simon King
12ea13934c revset: add helper function for matching strings to patterns 2012-05-30 23:13:33 +01:00
Olav Reinert
df3544e597 help: format command help using RST 2012-06-01 12:35:30 +02:00
Olav Reinert
6303dbc23d help: format topic help using RST 2012-06-01 12:15:45 +02:00
Olav Reinert
243a5a590a help: inline helper function used once only 2012-06-01 12:01:33 +02:00
Olav Reinert
70c42374e2 minirst: generate tables as a list of joined lines 2012-06-01 11:58:23 +02:00
Adrian Buehlmann
19b92fcf59 scmutil: use _winreg.HKEY_LOCAL_MACHINE 2012-05-27 11:30:03 +02:00
Adrian Buehlmann
9ecfd4a916 win32: move lookupreg() to windows.py
lookupreg() doesn't use the win32 API directly any more, it uses the Python
standard library module _winreg.
2012-05-27 11:29:52 +02:00
Adrian Buehlmann
dae9e15d0a win32: use Python's _winreg again
This is a partial backout of 7efea3b5db4c.

7efea3b5db4c switched win32.py to using ctypes with the intention to get rid
of the dependency on the pywin32 package.

But 7efea3b5db4c replaced the usage of the Python standard module _winreg in
lookup_reg as well, which was uneeded (note that lookup_reg was later renamed
into lookupreg).

Basically, we're switching back to the previous _winreg-based implementation,
which uses _winreg.QueryValueEx(). QueryValueEx returns a unicode code string.

See also: issue3467
2012-05-27 11:29:45 +02:00
Bryan O'Sullivan
509438662e lsprof: report units correctly 2012-05-30 13:57:41 -07:00
Bryan O'Sullivan
bef5b61512 cleanup: use the deque type where appropriate
There have been quite a few places where we pop elements off the
front of a list.  This can turn O(n) algorithms into something more
like O(n**2).  Python has provided a deque type that can do this
efficiently since at least 2.4.

As an example of the difference a deque can make, it improves
perfancestors performance on a Linux repo from 0.50 seconds to 0.36.
2012-05-15 10:46:23 -07:00
Matt Mackall
b49b66c0f2 merge with crew 2012-05-30 14:31:39 -05:00
Matt Mackall
bfe92722a0 merge with stable 2012-05-30 14:21:58 -05:00
Thomas Arendsen Hein
6c60809dcc merge: show renamed on one and deleted on the other side in debug output 2012-05-23 21:34:29 +02:00
Thomas Arendsen Hein
91a8201c52 merge: warn about file deleted in one branch and renamed in other (issue3074)
For divergent renames the following message is printed during merge:
note: possible conflict - file was renamed multiple times to:
 newfile
 file2

When a file is renamed in one branch and deleted in the other, the file still
exists after a merge. With this change a similar message is printed for mv+rm:

note: possible conflict - file was deleted and renamed to:
 newfile
2012-05-23 20:50:16 +02:00
Thomas Arendsen Hein
4735ff24c9 merge: do not warn about copy and rename in the same transaction (issue2113) 2012-05-23 17:25:48 +02:00
Matt Mackall
8c3c80ff37 merge with stable 2012-05-22 14:37:20 -05:00
Bryan O'Sullivan
1e9deb3b01 parsers: cache the result of index_headrevs
Although index_headrevs is much faster than its Python counterpart,
it's still somewhat expensive when history is large. Since headrevs
is called several times when the tag cache is stale or missing (e.g.
after a strip or rebase), there's a win to be gained from caching
the result, which we do here.
2012-05-19 20:21:48 -07:00
Bryan O'Sullivan
a49ea963d7 revlog: switch to a C version of headrevs
The C implementation is more than 100 times faster than the Python
version (which is still available as a fallback).

In a repo with 330,000 revs and a stale .hg/cache/tags file, this
patch improves the performance of "hg tip" from 2.2 to 1.6 seconds.
2012-05-19 19:44:58 -07:00
Bryan O'Sullivan
f9c29929d4 parsers: reduce raw_length when truncating
When stripping revs, we now update raw_length to correctly reflect
the new end of the index.
2012-05-19 19:44:18 -07:00
Olav Reinert
39ea6b3464 help: inline helper function used once only 2012-05-22 22:08:41 +02:00
Olav Reinert
a1155c64ad help: remove redundant parameter 2012-05-22 22:08:41 +02:00
Olav Reinert
b372d3da28 help: move some helper functions to help.py 2012-05-22 22:08:41 +02:00
Olav Reinert
2dabd3c23f help: remove dependency on ui from some helper functions 2012-05-22 22:08:41 +02:00
Matt Harbison
5c29c87aee revset: add a predicate for finding converted changesets
This selects changesets added because of repo conversions.  For example

    hg log -r "converted()"      # all csets created by a convertion
    hg log -r "converted(rev)"   # the cset converted from rev in the src repo

The converted(rev) form is analogous to remote(id), where the remote repo is
the source of the conversion.  This can be useful for cross referencing an old
repository into the current one.

The source revision may be the short changeset hash or the full hash from the
source repository.  The local identifier isn't useful.  An interesting
ramification of this is if a short revision is specified, it may cause more
than one changeset to be selected.  (e.g. converted(6) matches changesets with
a convert_revision field of 6e..e and 67..0)

The convert.hg.saverev option must have been specified when converting the hg
source repository for this to work.  The other sources automatically embed the
converted marker.
2012-05-13 01:12:26 -04:00
Sune Foldager
aea3159eaa bundle: make bundles more portable (isue3441)
This is achieved by acting as if the user had given -r<rev> for each head rev
of outgoing changesets on the command line, as well as appropriate
--base <rev>.

The discovery information is computed as normal, and then adjusted as above.
2012-05-12 19:38:20 +02:00
Matt Harbison
353d5deeb2 revset: fix traceback for bogus revisions in id(rev)
hg log -r "id(1234567)" now returns an empty list like rev() does.
2012-05-14 19:25:13 -04:00
Mark Round
7b5857715d posix: workaround lack of TIOCGWINSZ on Irix (issue3449)
On an Irix 6.5.24 system, TIOCGWINSZ is not available. This means that
any usage of the "hg" tool that looks up the terminal size (e.g. "hg
help") will fail with an AttributeError.

A simple work-around is just to wrap this block in mercurial/posix.py
with a try/except so that it ends up using the default 80 characters
width.
2012-05-14 13:25:42 +01:00
Matt Mackall
dbfb64e582 hgweb: fix filediff base calculation
Previously, we were finding the most recent version of a file in a
changeset and comparing it against its first file parent. This was
wrong on three counts:

- it would show a diff in revisions where there was no change to a file
- it would show a diff when only the exec bit changed
- it would potentially compare against a much older changeset, which
  could be very expensive if git-style rename detection was enabled

This compares the file in the current context with that context's
parent, which may result in an empty diff when looking at a file not
touched by the current changeset.
2012-05-14 12:56:43 +02:00
Patrick Mezard
eb2318522a cmdutil: extract increasing_windows() from walkchangerevs()
It will be reused in the revset-based version.
2012-05-08 22:43:44 +02:00
Augie Fackler
c0cf243849 httpclient: omit tests for the client since we don't run them anyway 2012-05-19 09:34:25 -05:00
Augie Fackler
ad6bc369b7 httpclient: update to c5abd358e543 of httpplus 2012-05-18 17:05:17 -05:00
Paul Boddie
5b2a1dc5f5 hgweb: make graph data suitable for template usage
Previously, graph data has been encoded for processing done by
JavaScript code run in the browser, employing simple structures
with implicit member positions. This patch modifies the graph
command to also produce data employing a dictionary-based
structure suitable for use with the templating mechanism, thus
permitting other ways of presenting repository graphs using that
mechanism.

In order to test these changes, the raw theme has been modified
to include templates for graph nodes and edges. In a similar
fashion, themes could employ technologies such as SVG that lend
themselves to templating to produce the graph display. This patch
makes use of a much simpler output representation than SVG in
order to maintain clarity.
2012-05-21 00:20:05 +02:00
Augie Fackler
e8eca68a89 clone: add progress calls to uncompressed code path 2012-05-21 14:25:46 -05:00
Matt Mackall
f4a789ba4d merge with stable 2012-05-21 17:35:28 -05:00
Matt Mackall
42c30757a2 revlog: don't handle long for revision matching
The underlying C code doesn't support indexing by longs, there are no
legitimate reasons to use a long, and longs should generally be
converted to ints at a higher level by context's constructor.
2012-05-21 16:36:09 -05:00
Matt Mackall
d53510c6a2 merge with stable 2012-05-21 16:35:27 -05:00
Adrian Buehlmann
3a26ebacab mpatch: use Py_ssize_t for string length 2012-05-20 01:28:31 +02:00
Adrian Buehlmann
96bc6f8416 mpatch: use Py_ssize_t
Eliminates

  mpatch.c(73) : warning C4244: 'return' : conversion from '__int64' to 'int',
  possible loss of data
  mpatch.c(299) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data
  mpatch.c(321) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int',
  possible loss of data
  mpatch.c(335) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data
  mpatch.c(346) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-20 00:08:18 +02:00
Dov Feldstern
bc4eac4b26 subrepo: make subrepo.subrepo(<not a subrepo path>) fail
Until now, when calling subrepo.subrepo with a path at which there is no
subrepo, a "nullstate" tuple would be returned. However, this is not very
useful (the tuple can't really be used for creating a subrepo), so we'd just as
soon have the function just fail, and leave it up to the caller to decide what
to do.

The motivation for doing this now is to simplify the solution for (issue3056).
2012-05-20 21:11:34 +03:00
Matt Mackall
e0b2cc783f merge with stable 2012-05-20 14:40:36 -05:00
Matt Mackall
764c110123 hgweb: use ui.nontty to disable all cooked I/O 2012-05-20 14:37:22 -05:00
Matt Mackall
b267442ddb ui: add _isatty method to easily disable cooked I/O 2012-05-20 14:31:56 -05:00
Adrian Buehlmann
e54da6574b bdiff: check and cast first parameter value on putbe32() calls
Eliminates

  mercurial/bdiff.c(383) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(384) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(385) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'uint32_t', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-15 22:36:47 +02:00
Adrian Buehlmann
933c7c3ffa bdiff: use Py_ssize_t instead of int
Reduces the conversion warnings

  mercurial/bdiff.c(61) : warning C4244: '=' : conversion from '__int64' to
  'int', possible loss of data
  mercurial/bdiff.c(307) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/bdiff.c(308) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/bdiff.c(362) : warning C4244: '+=' : conversion from '__int64' to
  'int', possible loss of data
  mercurial/bdiff.c(380) : warning C4244: '=' : conversion from '__int64' to
  'int', possible loss of data
  mercurial/bdiff.c(381) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(382) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(416) : warning C4244: '=' : conversion from 'Py_ssize_t' to
  'int', possible loss of data

to

  mercurial/bdiff.c(383) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(384) : warning C4244: 'function' : conversion from '__int64'
  to 'uint32_t', possible loss of data
  mercurial/bdiff.c(385) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'uint32_t', possible loss of data

on the three putbe32() calls in the function bdiff

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-15 22:36:27 +02:00
Matt Mackall
67c0680caa merge with stable 2012-05-17 15:52:14 -05:00
Matt Mackall
7e8d9b6e6f branchcache: backout 29529231e17d 2012-05-17 15:34:59 -05:00
Augie Fackler
1d813c0d7e dispatch: try and identify third-party extensions as sources of tracebacks
Extension authors should explicitly declare their supported hg
versions and include a buglink attribute in their extension. In the
event that a traceback occurs, we'll identify the
least-recently-tested extensionas the most likely source of the defect
and suggest the user disable that extension.

Packagers should make every effort to ship hg versions from exact
tags, or with as few modifications as possible so that the versioning
can work appropriately.
2012-05-16 16:18:07 -05:00
Kevin Bullock
b4041f99fa help: include bookmarks in 'help revisions' and simplify wording 2012-05-16 10:29:11 -05:00
Bryan O'Sullivan
226bc14024 parsers: use Py_CLEAR where appropriate 2012-05-13 11:56:50 +02:00
Bryan O'Sullivan
b0afd19075 tags: short-circuit if no tags have ever been committed 2012-05-13 12:01:52 +02:00
Matt Mackall
52baed62da merge with crew 2012-05-15 07:01:35 +02:00
Matt Mackall
264c1fb976 merge with stable 2012-05-15 07:00:55 +02:00
Brodie Rao
74e79a93a2 branches: improve performance by removing redundant operations
This refactors the branches command so it collects all the information it needs
about a branch in one pass over the branch map.

In particular, it fixes an issue where the command called repo.branchtags() to
get branch tips, and then used repo.branchheads() to get the closed/open
status. Both repo methods read the changelog to determine if the branch is
closed, resulting in extra, redundant I/O.

For the PyPy repo with 744 branches and 843 branch heads, this brings
hg branches over NFS from:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
        2427            0      0.9057      0.9057   <open>
        2424            0      0.4096      0.4096   <method 'close' of 'file' objects>
        2424            0      0.0476      0.0476   <method 'read' of 'file' objects>
           1            0      0.0468      0.0468   mercurial.revlog:637(headrevs)
          +1            0      0.0000      0.0000   +<len>
        2422            0      0.0443      0.0443   <method 'seek' of 'file' objects>
        2962            0      0.0337      0.0337   <zlib.decompress>
        2491            0      1.8008      0.0322   mercurial.changelog:182(read)
       +2491            0      1.6982      0.0315   +mercurial.revlog:881(revision)
       +2488            0      0.0269      0.0134   +mercurial.changelog:28(decodeextra)
       +4982            0      0.0085      0.0085   +<method 'split' of 'str' objects>
       +4982            0      0.0274      0.0049   +mercurial.encoding:61(tolocal)
       +2491            0      0.0039      0.0039   +<method 'index' of 'str' objects>
        2491            0      1.6982      0.0315   mercurial.revlog:881(revision)
       +2413            0      0.0112      0.0112   +mercurial.revlog:305(rev)
       +2491            0      1.5315      0.0068   +mercurial.revlog:847(_chunkraw)
       +2491            0      0.0414      0.0058   +mercurial.revlog:945(_checkhash)
       +2491            0      0.0028      0.0028   +mercurial.revlog:349(flags)
       +2491            0      0.0025      0.0025   +<mercurial.mpatch.patches>
        2422            0      1.5089      0.0286   mercurial.revlog:818(_loadchunk)
       +2422            0      0.4093      0.4093   +<method 'close' of 'file' objects>
       +2422            0      0.0451      0.0451   +<method 'read' of 'file' objects>
       +2422            0      0.0443      0.0443   +<method 'seek' of 'file' objects>
       +2422            0      0.9703      0.0096   +mercurial.store:374(__call__)
       +2422            0      0.0079      0.0069   +mercurial.revlog:810(_addchunk)
        5804            0      0.0204      0.0204   mercurial.revlog:305(rev)
        2426            0      0.9552      0.0177   mercurial.scmutil:218(__call__)
       +2426            0      0.9057      0.9057   +<open>
       +2426            0      0.0120      0.0083   +os.path:80(split)
       +2426            0      0.0061      0.0049   +mercurial.scmutil:92(__call__)
Time: real 1.950 secs (user 0.560+0.000 sys 0.220+0.000)

down to:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
        1545            0      0.6035      0.6035   <open>
        1542            0      0.2697      0.2697   <method 'close' of 'file' objects>
           1            0      0.0547      0.0547   mercurial.revlog:637(headrevs)
          +1            0      0.0000      0.0000   +<len>
        1542            0      0.0389      0.0389   <method 'read' of 'file' objects>
        1540            0      0.0316      0.0316   <method 'seek' of 'file' objects>
        1853            0      0.0227      0.0227   <zlib.decompress>
        1557            0      1.2131      0.0226   mercurial.changelog:182(read)
       +1557            0      1.1398      0.0221   +mercurial.revlog:881(revision)
       +1555            0      0.0199      0.0094   +mercurial.changelog:28(decodeextra)
       +3114            0      0.0058      0.0058   +<method 'split' of 'str' objects>
       +3114            0      0.0196      0.0035   +mercurial.encoding:61(tolocal)
       +1557            0      0.0026      0.0026   +<method 'index' of 'str' objects>
        1557            0      1.1398      0.0221   mercurial.revlog:881(revision)
       +1557            0      1.0307      0.0047   +mercurial.revlog:847(_chunkraw)
       +1557            0      0.0287      0.0040   +mercurial.revlog:945(_checkhash)
       +1557            0      0.0018      0.0018   +<mercurial.mpatch.patches>
       +1557            0      0.0018      0.0018   +mercurial.revlog:326(node)
       +1557            0      0.0417      0.0013   +mercurial.revlog:857(_chunkbase)
        1540            0      1.0147      0.0210   mercurial.revlog:818(_loadchunk)
       +1540            0      0.2693      0.2693   +<method 'close' of 'file' objects>
       +1540            0      0.0360      0.0360   +<method 'read' of 'file' objects>
       +1540            0      0.0316      0.0316   +<method 'seek' of 'file' objects>
       +1540            0      0.6487      0.0070   +mercurial.store:374(__call__)
       +1540            0      0.0059      0.0052   +mercurial.revlog:810(_addchunk)
        3192            0      0.0173      0.0173   mercurial.revlog:305(rev)
        8184            0      0.0300      0.0147   <method 'decode' of 'str' objects>
       +5204            0      0.0149      0.0048   +encodings.utf_8:15(decode)
          +1            0      0.0004      0.0000   +encodings:71(search_function)
          43           26      0.0147      0.0129   <__import__>
Time: real 1.390 secs (user 0.450+0.000 sys 0.170+0.000)
2012-05-13 14:04:07 +02:00
Brodie Rao
ab32f1721d context: add changectx.closesbranch() method
This removes the duplicated code for inspecting the 'close' extra field in
a changeset.
2012-05-13 14:04:06 +02:00
Brodie Rao
d36ae7f264 localrepo: add branchtip() method for faster single-branch lookups
For the PyPy repo with 744 branches and 843 branch heads, this brings
hg log -r default over NFS from:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
        3249            0      1.3222      1.3222   <open>
        3244            0      0.6211      0.6211   <method 'close' of 'file' objects>
        3243            0      0.0800      0.0800   <method 'read' of 'file' objects>
        3241            0      0.0660      0.0660   <method 'seek' of 'file' objects>
        3905            0      0.0476      0.0476   <zlib.decompress>
        3281            0      2.6756      0.0472   mercurial.changelog:182(read)
       +3281            0      2.5256      0.0453   +mercurial.revlog:881(revision)
       +3276            0      0.0389      0.0196   +mercurial.changelog:28(decodeextra)
       +6562            0      0.0123      0.0123   +<method 'split' of 'str' objects>
       +6562            0      0.0408      0.0073   +mercurial.encoding:61(tolocal)
       +3281            0      0.0054      0.0054   +<method 'index' of 'str' objects>
        3241            0      2.2464      0.0456   mercurial.revlog:818(_loadchunk)
       +3241            0      0.6205      0.6205   +<method 'close' of 'file' objects>
       +3241            0      0.0765      0.0765   +<method 'read' of 'file' objects>
       +3241            0      0.0660      0.0660   +<method 'seek' of 'file' objects>
       +3241            0      1.4209      0.0135   +mercurial.store:374(__call__)
       +3241            0      0.0122      0.0107   +mercurial.revlog:810(_addchunk)
        3281            0      2.5256      0.0453   mercurial.revlog:881(revision)
       +3280            0      0.0175      0.0175   +mercurial.revlog:305(rev)
       +3281            0      2.2819      0.0119   +mercurial.revlog:847(_chunkraw)
       +3281            0      0.0603      0.0083   +mercurial.revlog:945(_checkhash)
       +3281            0      0.0051      0.0051   +mercurial.revlog:349(flags)
       +3281            0      0.0040      0.0040   +<mercurial.mpatch.patches>
       13682            0      0.0479      0.0248   <method 'decode' of 'str' objects>
       +7418            0      0.0228      0.0076   +encodings.utf_8:15(decode)
          +1            0      0.0003      0.0000   +encodings:71(search_function)
        3248            0      1.3995      0.0246   mercurial.scmutil:218(__call__)
       +3248            0      1.3222      1.3222   +<open>
       +3248            0      0.0235      0.0184   +os.path:80(split)
       +3248            0      0.0084      0.0068   +mercurial.scmutil:92(__call__)
Time: real 2.750 secs (user 0.680+0.000 sys 0.360+0.000)

down to:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
          55           31      0.0197      0.0163   <__import__>
          +1            0      0.0006      0.0002   +mercurial.context:8(<module>)
          +1            0      0.0042      0.0001   +mercurial.revlog:12(<module>)
          +1            0      0.0002      0.0001   +mercurial.match:8(<module>)
          +1            0      0.0003      0.0001   +mercurial.dirstate:7(<module>)
          +1            0      0.0057      0.0001   +mercurial.changelog:8(<module>)
           1            0      0.0117      0.0032   mercurial.localrepo:525(_readbranchcache)
        +844            0      0.0015      0.0015   +<binascii.unhexlify>
        +845            0      0.0010      0.0010   +<method 'split' of 'str' objects>
        +843            0      0.0045      0.0009   +mercurial.encoding:61(tolocal)
        +843            0      0.0004      0.0004   +<method 'setdefault' of 'dict' objects>
          +1            0      0.0003      0.0003   +<method 'close' of 'file' objects>
           3            0      0.0029      0.0029   <method 'read' of 'file' objects>
           9            0      0.0018      0.0018   <open>
         990            0      0.0017      0.0017   <binascii.unhexlify>
          53            0      0.0016      0.0016   mercurial.demandimport:43(__init__)
         862            0      0.0015      0.0015   <_codecs.utf_8_decode>
         862            0      0.0037      0.0014   <method 'decode' of 'str' objects>
        +862            0      0.0023      0.0008   +encodings.utf_8:15(decode)
         981            0      0.0011      0.0011   <method 'split' of 'str' objects>
         861            0      0.0046      0.0009   mercurial.encoding:61(tolocal)
        +861            0      0.0037      0.0014   +<method 'decode' of 'str' objects>
         862            0      0.0023      0.0008   encodings.utf_8:15(decode)
        +862            0      0.0015      0.0015   +<_codecs.utf_8_decode>
           4            0      0.0008      0.0008   <method 'close' of 'file' objects>
         179          154      0.0202      0.0004   mercurial.demandimport:83(__getattribute__)
         +36           11      0.0199      0.0003   +mercurial.demandimport:55(_load)
         +72            0      0.0001      0.0001   +mercurial.demandimport:83(__getattribute__)
         +36            0      0.0000      0.0000   +<getattr>
           1            0      0.0015      0.0004   mercurial.tags:148(_readtagcache)
Time: real 0.060 secs (user 0.030+0.000 sys 0.010+0.000)
2012-05-13 14:04:04 +02:00
Martin Geisler
e0d9047429 phases: wrap docstrings at 70 characters 2012-05-13 12:07:49 +02:00
Martin Geisler
79a3fc20d2 phases: fix typos in docstrings 2012-05-13 12:06:12 +02:00
Matt Mackall
c1a3a77a6b help: tweak keyword format output 2012-05-13 15:26:06 +02:00
Augie Fackler
1fb19c8f86 help: link back to the help topics page from a specific topic page 2012-05-13 05:22:23 -05:00
Augie Fackler
c94e6f7b05 help: add --keyword (-k) for searching help 2012-05-13 06:03:11 -05:00
Augie Fackler
a21ee7f93d help: introduce topicmatch for finding topics matching a keyword 2012-05-13 04:27:08 -05:00
Augie Fackler
52177e47bf extensions.disabled: return {} instead of None no extensions are disabled 2012-05-13 04:06:07 -05:00
David Soria Parra
7d0d5a5a60 merge: respect bookmarks during merge
Bookmarks will behave more like named branches when merge tries to pick
a revision to merge.

Bookmarks now to respect the current bookmarks.  Bookmarks will not
accidentally merged with unnamed heads or other bookmarks. However merge
can pick heads with diverging bookmarks and pick those automatically.

We end up with two cases for picking a revision to merge:
 (1) In case of an current bookmark, merge can pick a branch head that has a
     diverged bookmark
 (2) In case of no current bookmark, merge can pick a branch head that does not
     have a bookmark.
2012-05-13 11:55:42 +02:00
David Soria Parra
2ce902d434 localrepo: introduce bookmarkheads
Similar to branch heads we introduce the notion of bookmarkheads.
Bookmarkheads are changests that are bookmarked with the given bookmark
or a diverged version
2012-05-13 11:54:58 +02:00
David Soria Parra
7ffe2b2eb4 bookmarks: delete divergent bookmarks on merge 2012-05-12 21:28:10 +02:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Brodie Rao
46ce54af4d cleanup: replace more naked excepts with more specific ones 2012-05-13 13:17:31 +02:00
Patrick Mezard
2cddd7a828 cmdutil: use filectx.cmp() in amend() 2012-05-13 13:19:46 +02:00
Matt Mackall
05e48d4041 merge with stable 2012-05-13 12:52:24 +02:00
Levi Bard
ff2ee52b29 bookmarks: pull new bookmarks from remote by default (BC) 2012-05-12 17:00:01 +02:00
Joshua Redstone
d70249edef localrepo: strip now incrementally updates the branchheads cache
Destroying history via strip used to invalidate the branchheads cache,
causing it to be regenerated the next time it is read. This is
expensive in large repos. This change converts strip to pass info to
localrepo.destroyed() to enable to it to incrementally update the
cache, improving the performance of strip and other operations that
depend on it (e.g., rebase).

This change also strengthens a bit the integrity checking of the
branchheads cache when it is read, by rejecting the cache if it has
nodes in it that no longer exist.
2012-05-11 10:35:54 -07:00
Patrick Mezard
abc8f672ec phase: remove useless test, olddata is never None 2012-05-12 16:53:36 +02:00
Patrick Mezard
d99bfab018 rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.

I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.

The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.

The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.

And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 15:14:58 +02:00
Adrian Buehlmann
65a9a97e69 diffhelpers: use Py_ssize_t in testhunk()
Eliminates

  mercurial/diffhelpers.c(143) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(144) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 14:00:51 +02:00
Adrian Buehlmann
0a73f19992 diffhelpers: use Py_ssize_t in addlines()
Eliminates

  mercurial/diffhelpers.c(81) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(82) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 13:21:08 +02:00
Adrian Buehlmann
930b763535 diffhelpers: use Py_ssize_t in _fix_newline()
Eliminates

  mercurial/diffhelpers.c(23) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(26) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(27) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(30) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 12:07:18 +02:00
Mads Kiilerich
803e845d28 unbundle: move bookmark update outside the lock
abf413aa5fdc introduced updatecurrentbookmark after unbundle, but that path
might end up taking a wlock after lock when writing the bookmarks.
2012-05-12 20:06:04 +02:00
Brodie Rao
a706d64a2c cleanup: replace naked excepts with except Exception: ... 2012-05-12 16:02:46 +02:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
92158e04de cleanup: "raise SomeException()" -> "raise SomeException" 2012-05-12 16:00:58 +02:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Matt Mackall
4d12f82b66 merge with stable 2012-05-12 13:20:26 +02:00
Bryan O'Sullivan
058dfb801d revlog: speed up prefix matching against nodes
The radix tree already contains all the information we need to
determine whether a short string is an unambiguous node identifier.
We now make use of this information.

In a kernel tree, this improves the performance of
"hg log -q -r24bf01de75" from 0.27 seconds to 0.06.
2012-05-12 10:55:08 +02:00
Bryan O'Sullivan
f29187cd15 parsers: ensure that nullid is always present in the radix tree 2012-05-12 10:55:08 +02:00
Bryan O'Sullivan
4fe1bcbdb1 parsers: allow hex keys 2012-05-12 10:55:07 +02:00
Matt Mackall
8420ca3aee merge with stable 2012-05-12 12:23:49 +02:00
Henrik Stuart
97ebbbffd1 revset: add function for matching extra data (issue2767) 2012-05-12 10:20:57 +02:00
Matt Mackall
360a8e9fb8 diffhelpers: harden testhunk 2012-05-12 10:02:47 +02:00
Yuya Nishihara
9228db24a3 patch: fix segfault against unified diffs which start line is zero
Since f7e538c3b7ba, if a chunk starts with "@@ -0,1", oldstart turns into
a negative value. Because diffhelpers.testhunk() doesn't expect negative bstart,
it bypasses "alen > blen - bstart" condition and segfaults at
"PyList_GET_ITEM(b, i + bstart)".
2012-05-12 16:10:01 +09:00
Levi Bard
4d4fd8dd61 graft: implement --log (issue3438) 2012-05-11 18:51:35 +02:00
Patrick Mezard
aa6e824ce1 phase: make if abort on nullid for the good reason
The good reason being you cannot call retractboundary() on nullid, not
revset.set() cannot resolve '-1'.
2012-05-12 00:24:07 +02:00
Patrick Mezard
ed5fc49c44 phases: make advance/retractboundary() atomic
Before this, if advanceboundary() failed after updating some roots but
before calling retractboundary(), the phase cache would be left in an
invalid state, marked dirty, and written as such. This patch approach is
to turn advance/retractboundary() into phasecache methods, then operate
on copies and merge them back on success.

With the same technique, we can ensure the atomicity of combinations of
advance/retractboundary() calls, like those performed in changegroup
handling code.
2012-05-12 00:24:07 +02:00
Patrick Mezard
641ee7d3ba phases: introduce phasecache
The original motivation was changectx.phase() had special logic to
correctly lookup in repo._phaserev, including invalidating it when
necessary. And at other places, repo._phaserev was accessed directly.

This led to the discovery that phases state including _phaseroots,
_phaserev and _dirtyphase was manipulated in localrepository.py,
phases.py, repair.py, etc. phasecache helps encapsulating that.

This patch replaces all phase state in localrepo with phasecache and
adjust related code except for advance/retractboundary() in phases.
These still access to phasecache internals directly. This will be
addressed in a followup.
2012-05-12 00:24:07 +02:00
Bryan O'Sullivan
2493c7a8d1 bisect: set HG_NODE when runing a command
When running a command, set the environment variable HG_NODE to
tell the command which changeset is being visited.
2012-05-08 15:31:00 -07:00
Bryan O'Sullivan
01cb9841ca bisect: track the current changeset (issue3382)
Introduce a new revset feature, bisect(current), that identifies
the changeset currently being bisected.
2012-05-08 15:29:09 -07:00
Bryan O'Sullivan
6f88d16cf2 parsers: use the correct maximum radix tree depth
Previously, we would not use more than half of a SHA-1 hash when
constructing and searching the tree.
2012-05-08 14:46:04 -07:00
Patrick Mezard
1ecfe35e64 revset: make matching() preserve input revision order 2012-05-09 18:45:14 +02:00
Jesse Glick
33aa2b5c45 revset: documentation typo "metatadata" 2012-05-10 14:17:05 -04:00
Levi Bard
56db29ce72 addremove: document default similarity behavior (issue3429) 2012-05-11 15:15:50 +02:00
Idan Kamara
c69934e20c amend: preserve extra dict (issue3430) 2012-05-11 18:33:45 +03:00
Bryan O'Sullivan
ab8ba40835 changelog: ensure that nodecache is valid (issue3428)
This ensures that an out-of-process hook can see an incoming changegroup.
2012-05-11 01:55:33 -07:00
Patrick Mezard
9c5568246f alias: inherit command optionalrepo flag (issue3298)
Commands working without a repository, like "init", are listed in
commands.norepo. Commands optionally using a repository, like "showconfig", are
listed in commands.optionalrepo. Command aliases were inheriting the former but
not the latter.
2012-05-05 12:21:22 +02:00
Adrian Buehlmann
4482ec8070 parsers: statically initializing tp_new to PyType_GenericNew is not portable
As detailed on http://docs.python.org/extending/newtypes.html (quote):

  "In this case, we can just use the default implementation provided by the API
  function PyType_GenericNew(). We’d like to just assign this to the
  tp_new slot, but we can’t, for portability sake. On some platforms or
  compilers, we can’t statically initialize a structure member with a function
  defined in another C module, so, instead, we’ll assign the tp_new slot in the
  module initialization function just before calling PyType_Ready()."

Fixes "gcc (GCC) 3.4.5 (mingw-vista special r3)" complaining with:

  mercurial/parsers.c:1096: error: initializer element is not constant
  mercurial/parsers.c:1096: error: (near initialization for `indexType.tp_new')
2012-05-08 11:20:07 +02:00
Patrick Mezard
742f6b3850 pure/base85: align exception type/msg on base85.c
brendan mentioned on IRC that b64decode raises a TypeError too, but while the
previous exception type may be better in general, it is much easier to make it
behave like the related C code and changes nothing for mercurial itself.
2012-05-07 21:49:45 +02:00
Matt Mackall
d8dfd80d76 parsers: fix refcount bug on corrupt index
When we encounter a corrupt index, we "fail" the init but our
destructor still gets called. On some systems, this was causing us to
attempt to decref a dangling to self->data.
2012-05-07 15:40:50 -05:00
Jesse Glick
a1ec63bdbc localrepo: optimize internode status calls using withflags
Introduce manifestdict.withflags() to get a set of all files which have any
flags set, since these are likely to be a minority. Otherwise checking .flags()
for every file is a lot of dictionary lookups and is quite slow.
2012-05-04 15:56:45 -04:00
Jesse Glick
17675847fa localrepo: optimize internode status calls using match.always
Introduce match.always() to check if a match object always says yes, i.e.
None was passed in. If so, mfmatches should not bother iterating every file in
the repository.
2012-05-04 15:54:55 -04:00
Augie Fackler
68b99d0585 httpclient: update to revision 892730fe7f46 of httpplus 2012-05-04 16:00:33 -05:00
Matt Mackall
48471fd098 merge with stable 2012-05-12 00:06:11 +02:00
Adrian Buehlmann
f5ca6da4d6 parser: use PyInt_FromSsize_t in index_stats
Eliminates

  mercurial/parsers.c(515) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data
  mercurial/parsers.c(520) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data
  mercurial/parsers.c(521) : warning C4244: 'function' : conversion from
  'Py_ssize_t' to 'long', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.

PyInt_FromSsize_t does not exist for Python 2.4 and earlier, so we define a
fallback in util.h to use PyInt_FromLong when compiling for Python 2.4.
2012-05-09 09:58:50 +02:00
redstone
7ea2f3b663 localrepo: cleanup var names and comments
Cosmetic cleanups.  Fix comment typo referring to the notion of multiple tips.
Make variable describing a generator end in 'gen'.
Fix another var containing a node not to end with 'rev'.
2012-05-11 10:53:12 -07:00
Patrick Mezard
352ebc2cec phases: stop modifying localrepo in writeroots()
Also pass the phaseroots being written for clarity. repo._dirtyphases
was already reset to False at call site.
2012-05-10 18:52:07 +02:00
Patrick Mezard
f8945add9d phases: stop modifying localrepo in readroots()
phasedefaults is also passed explicitely to help the casual reader
understand where it is used without grepping all the sources.
2012-05-10 18:52:04 +02:00
Patrick Mezard
e918020a6f phases: call filterunknown() in readroots()
One less function manipulating localrepo state.
2012-05-10 18:21:15 +02:00
Patrick Mezard
2940b01bad repair: no need to call filterunknown() in strip()
Calling strip() will eventually trigger localrepo.destroyed() which will
invalidate _parseroots. It will call filterunknown() upon reload.

Changes to test-keyword.t are related to commit --debug running after
either qpop or rollback.
2012-05-10 18:21:15 +02:00
Matt Mackall
6d78ec67ed merge with stable 2012-05-11 14:48:24 +02:00
Bryan O'Sullivan
9daeaf8600 parsers: change the type of nt_level
We should generally prefer Py_ssize_t whenever we are talking about
lengths.
2012-05-08 14:48:50 -07:00
Bryan O'Sullivan
2d6b967125 parsers: change the type signature of hexdigit
An upcoming change will make use of this.
2012-05-08 14:48:48 -07:00
Bryan O'Sullivan
98bb617e51 parsers: allow nt_find to signal an ambiguous match 2012-05-08 14:48:44 -07:00
Bryan O'Sullivan
2b933f4aaf parsers: factor out radix tree initialization 2012-05-08 14:48:39 -07:00
Bryan O'Sullivan
7434efb91b parsers: update ntrev when we stop scanning
This prevents us from inserting some nodes twice, wasting work.
2012-05-08 14:46:06 -07:00
Travis Herrick
c8cb411c3a branches: quiet option observes other parameters 2012-05-06 17:12:22 -07:00
Idan Kamara
6360e96576 context: fix call to util.safehasattr 2012-05-09 02:46:58 +03:00
Matt Mackall
d7cd292c1a merge with stable 2012-05-08 12:05:45 -05:00
Matt Mackall
4d062ed81e context: add copies method with caching 2012-05-06 14:37:51 -05:00
Matt Mackall
e38c9f282e filectx: handle some other simple cases for finding merge ancestor 2012-05-06 14:20:53 -05:00
Matt Mackall
a7305a2b09 graft: remark on empty graft 2012-05-06 14:15:17 -05:00
Matt Mackall
da4217097f filectx: make ancestor require actx
When grafting or rebasing, we need to know the target ancestor.
2012-05-04 17:27:14 -05:00
Martin Geisler
db0acd4d7e merge with stable 2012-05-07 13:40:58 +02:00
Yuya Nishihara
8284425c7d commands: parse ui.strict config item as bool 2012-05-06 23:58:04 +09:00
Adrian Buehlmann
ac14489dc7 help/config: remove outdated false claim about pywin32
Since version 1.8 (released on 2011-03-01), Mercurial doesn't use pywin32 any
more. The old fallback mechanism to use C:\Mercurial\Mercurial.ini if pywin32 is
not installed was removed in 1fa0a833f143.
2012-05-06 10:36:32 +02:00
Martin Geisler
84d98e014b tags: line.rstrip().split() can be replaced with line.split()
The line looks like "123 <node> <node>" and does not start with
whitespace: it was therefore not significant that rstrip was used
instead of strip. Furthermore, the first part is fed to int, which
will itself strip away whitespace before converting the string to an
integer.
2012-05-04 15:29:07 +02:00
Martin Geisler
f8393191de phases: line.strip().split() == line.split() 2012-05-04 15:24:00 +02:00
Martin Geisler
4640718d42 merge with stable 2012-05-06 14:36:42 +02:00
Kevin Bullock
cce50f4d35 revert: don't re-create changeset context 2012-05-04 09:20:28 -05:00
Patrick Mezard
f49c9eec1a subrepo: do not traceback on .hgsubstate parsing errors
Note that aborting in subrepo.state() prevents "repairing" commands like revert
to be issued. The user will have to edit the .hgsubstate manually (but he
probably had already otherwise this would not be failing). The same behaviour
already happens with invalid .hgsub entries.
2012-05-04 14:19:55 +02:00
Patrick Mezard
a124dced40 subrepo: ignore blank lines in .hgsubstate (issue3424)
Reported by Sebastian Krysmanski <infomail@lordb.de>
2012-05-04 14:19:52 +02:00
Martin Geisler
82b328e84d merge with stable 2012-05-04 12:21:56 +02:00
Martin Geisler
da730824fe paper, monoblue: link correctly to lines in annotate view
The links were to "foo#123" instead of "foo#l123". The gitweb and
spartan templates were already producing the correct links.
2012-05-04 12:04:07 +02:00
Matt Mackall
a1bde95990 merge with stable 2012-05-03 16:12:52 -05:00
Matt Mackall
ed0ae26f56 bookmarks: catch the proper exception for missing revisions
This fixes a regression from 1.7
2012-05-03 16:03:08 -05:00
Bryan O'Sullivan
130a47d385 bisect: save current state before running a command
This prevents an external command being run during a bisect from
querying stale data.
2012-05-02 17:15:11 -07:00
Bryan O'Sullivan
1eb25dc7ef parsers: fix refcount leak, simplify init of index (issue3417)
This is most easily verified using valgrind on a long-running
process, as the leak has no visible consequences during normal
one-shot command usage.

In one window:

  valgrind --leak-check=full --suppressions=valgrind-python.supp \
    python ./hg serve

In another:

  for ((i=0;i<100;i++)); do
    curl -s http://localhost:8000/file/tip/README >/dev/null
  done

valgrind should report no leaks.
2012-05-02 14:37:44 -07:00
Paul Boddie
2b32ff611e help: added description for the web.collapse setting
The collapse configuration setting for hgweb was recently
introduced, but the help text was unfortunately omitted from the
patch concerned. This patch provides a suitable help text.
2012-05-03 01:07:22 +02:00
Martin Geisler
dca4ceb4f4 merge with stable 2012-05-02 13:20:06 +02:00
A. S. Budden
95a9277375 help: add reference to template help (issue3413)
There is currently no clear link between the help for log
and the help on templates.  The log option is --template
but the template help is 'help templating' or 'help templates'.
This patch makes 'hg help template' work and also adds a
note into the log help explaining where to find more info.
2012-05-01 22:14:51 +01:00
Michael Tjørnemark
e68243ee04 changegroup: decompress GZ algorithm in larger chunks for better performance 2012-04-29 20:58:50 +02:00
Patrick Mezard
601035e58a patch: clarify binary hunk parsing loop 2012-04-29 11:19:51 +02:00
Patrick Mezard
ac389a393c subrepo/svn: cache _wcrev() value in merge() 2012-04-30 17:05:19 +02:00
Patrick Mezard
5e78cfbfbb subrepo/svn: fix checked out rev number retrieval (issue2968)
The initial version was to take the "Revision" field from svn info. It works
but produces false positive when parent paths are being moved or unrelated
changes are being committed, causing it to change while the svn checkout itself
remains the same. To avoid spurious commit, we took "Revision" and "Last
Changed Rev" for general comparison and kept the latter to answer "what is your
revision?" question. This is better but fails when the subrepo path exists at
"Revision" but not at "Last Changed Rev". This patch adds a check for this, and
returns "Revision" if the path does not exist. We try to avoid doing this as
much as possible at it implies an extra, *remote* call.
2012-04-30 17:03:15 +02:00
Patrick Mezard
bf0d75c9d1 amend: fix copy records handling (issue3410)
Messing with the dirstate before the intermediate commit seems error prone.
Instead, commit and recompute the copies with copies.pathcopies(), then use
that with commitctx().

Since copies.pathcopies() does not support file replacement very well, the
whole .renamed() condition in samefile() is removed and the "file replacement
caused by differing copy source" effect is discarded.

Test shamelessly stolen from Idan Kamara <idankk86@gmail.com>
2012-04-30 20:45:45 +02:00
Patrick Mezard
2c65c226cf localrepo: add setparents() to adjust dirstate copies (issue3407)
The fix introduced in 3509b9cf8f86 was only partially successful. It is correct
to turn dirstate 'm' merge records into normal/dirty ones but copy records are
lost in the process. To adjust them as well, we need to look in the first
parent manifest to know which files were added and preserve only related
records. But the dirstate does not have access to changesets, the logic has to
moved at another level, in localrepo.
2012-04-29 22:25:55 +02:00
Martin Geisler
a6c8a11cca help/config: expand [subpaths] help
Brifly explain why rewriting subrepository paths can be necessary.
Explain that relative subrepository paths are made absolute before
rewrite rules are applied.
2012-04-30 12:45:44 +02:00
Martin Geisler
63259931d2 help: consistently use title capitalization for help topics 2012-04-30 11:51:24 +02:00
Patrick Mezard
68ff0fa6cf dirstate: preserve path components case on renames (issue3402)
The original issue was something like:

  $ hg init repo
  $ cd repo
  $ mkdir D
  $ echo a > D/a
  $ hg ci -Am adda
  adding D/a
  $ mv D temp
  $ mv temp d
  $ echo b > d/b
  $ hg add d/b
  adding D/b
  $ hg ci -m addb
  $ hg mv d/b d/c
  moving D/b to d/c
  $ hg st
  A d/c
  R D/b

Here we expected:

  A D/c
  R D/b

the logic being we try to preserve case of path components already known in the
dirstate. This is fixed by the current patch.

Note the following stories are not still not supported:

Changing directory case
  $ hg mv D d
  moving D/a to D/D/a
  moving D/b to D/D/b
  $ hg st
  A D/D/a
  A D/D/b
  R D/a
  R D/b

or:

  $ hg mv D/* d
  D/a: not overwriting - file exists
  D/b: not overwriting - file exists

And if they were, there are probably similar issues with diffing/patching.
2012-04-28 20:29:21 +02:00
Patrick Mezard
cc838630b9 commit: abort on merge with missing files
Here is a script illustrating the previous behaviour:

The merge brings a new file 'b' from remote
  $ hg merge 1 --debug
    searching for copies back to rev 1
    unmatched files in other:
     b
  resolving manifests
   overwrite: False, partial: False
   ancestor: 07f494440405, local: 540395c44225+, remote: 102a90ea7b4a
   b: remote created -> g
  updating: b 1/1 files (100.00%)
  getting b
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

Delete but do not remove b
  $ rm b
  $ hg st
  ! b

The commit succeeds
  $ hg commit -m merge
  $ hg parents --template "{rev} {desc|firstline} files: {files}\n"
  3 merge files:
  $ hg st
  ! b

b changes were ignored, but even b existence was ignored
  $ hg manifest
  a

This happens because localrepo.commitctx() checks the input ctx.files(), which
is empty for workingctx.files() only returns added, modified or removed
entries, and bypass files/manifest updates completely. So the committed
revision manifest is the same as its first parent one, not containing the 'b'
file.

This patch forces the commit to abort in presence of a merge and missing files.
test-merge4.t is modified accordingly as it was introduced to check hg was not
just terminating with a traceback (5cc0d3ba11f9).
2012-04-28 15:01:57 +02:00
Martin Geisler
efd8c0f868 merge with main 2012-05-11 15:09:06 +02:00
Martin Geisler
7724ee63b3 extensions: don't suggest commands from deprecated extensions 2012-05-11 14:00:51 +02:00