Commit Graph

441 Commits

Author SHA1 Message Date
Dirkjan Ochtman
78e70cd53d cmdutil: fix bug in finddate() implementation 2009-10-30 09:54:39 +01:00
Dirkjan Ochtman
c47d609475 merge changes from mpm 2009-10-30 09:53:39 +01:00
Matt Mackall
4d8e4508a9 walkchangerevs: drop ui arg 2009-10-29 19:03:16 -05:00
Matt Mackall
caf5c5ecca walkchangerevs: reset cache between windows 2009-10-29 19:03:13 -05:00
Matt Mackall
de712b58f9 walkchangerevs: move 'add' to callback
Now walkchangerevs is a simple iterator over contexts
2009-10-29 17:07:51 -05:00
Steve Borho
ab6b033d40 cmdutil: update finddate()
walkchangerevs() now returns contexts, does not take a cache func.
2009-10-28 22:47:46 -05:00
Matt Mackall
74ca11743b Merge with crew 2009-10-27 17:14:19 -05:00
Matt Mackall
0366236cf5 walkchangerevs: internalize ctx caching 2009-10-27 17:01:32 -05:00
Matt Mackall
67e7c0b434 walkchangerevs: yield contexts 2009-10-25 18:43:59 -05:00
Matt Mackall
201d81ac28 walkchangerevs: kill window step of iterator 2009-10-25 18:43:58 -05:00
Matt Mackall
69f8478d8c walkchangerevs: pull out matchfn
* * *
imported patch mercurial/commands.py
2009-10-25 18:43:56 -05:00
Adrian Buehlmann
c0985715f7 cmdutil: minor refactoring of changeset_printer._show
- use ctx.branch() instead of directly accessing the extra field "branch"
- move definitions of locals ('extra' and 'branch') down to where they
  are used
2009-10-24 19:01:40 +02:00
Greg Ward
889a9ffb8d cmdutil: changeset_printer: use methods of filectx/changectx.
This allows extensions that modify changeset metadata (e.g.
description) by overriding methods of changectx to get consistent
behavior from all log-like commands, regardless of whether templates
or styles are used. Without this, overriding changectx methods works
if you use styles or templates, but not with default log format.

This meant adding filectx.extra() for consistency with changectx.
2009-10-05 18:17:13 -04:00
Mads Kiilerich
8ff24147fd cmdutil: templating keywords latesttag and latesttagdistance
This can be used for referring to revisions in a reasonable
meaningful, stable and monotonically increasing way, suitable for
releases or builds directly from a repository.

The latest tag is found by searching through untagged ancestors and
finding the latest tagged ancestor based on tag date. The distance is
found from the length of the longest path to the tagged revision.

For example:
  hg log -l1 --template '{latesttag}+{latesttagdistance}\n'
can return
  1.3.1+197

This is mostly work by Gilles Moris <gilles.moris@free.fr>
2009-10-03 18:31:20 +02:00
Nicolas Dumazet
9c19061a7e cmdutil: service: add an optional runargs argument to pass the command to run
This would be necessary for inotify launching its server: the initial command
is a standard 'hg st'/'hg ci'/... but the daemon to run is 'hg inserve'
2009-08-16 11:30:24 +09:00
Dirkjan Ochtman
e00109f7e7 cmdutil: use context objects for walkchangerevs() 2009-08-20 08:34:22 +02:00
Steve Borho
afad34fc2e cmdutil: fall back to filename if glob expand has errors
On Windows, Mercurial tries to glob expand provided filenames as a
convenience to the user. Unfortunately, there are valid filenames
which are not valid glob patterns.  In those cases, we should fallback
to the original provided filename.
2009-07-12 00:46:43 -05:00
Matt Mackall
540c02c8d3 commit: report modified subrepos in commit editor 2009-07-01 01:05:24 -05:00
Matt Mackall
0210a48141 addremove: build lists of already added and removed files too (issue1696) 2009-06-30 23:25:53 -05:00
Matt Mackall
bc08ba2edf addremove: pass unknown and deleted to findrenames directly again 2009-06-30 16:11:42 -05:00
Matt Mackall
6b9bed125a addremove: normalize some variable names 2009-06-30 15:56:08 -05:00
Matt Mackall
242e029aa1 findrenames: drop unused argument defaults 2009-06-29 15:34:17 -05:00
Matt Mackall
34cb6b5080 addremove: drop some silly variable assignments 2009-06-23 17:51:51 -05:00
Matt Mackall
7253321c4e remoteui: properly create dst with copy() 2009-06-12 02:19:51 -05:00
Nicolas Dumazet
448395f76a cmdutil: service: logfile option to redirect stdout & stderr in a file 2009-05-25 18:14:32 +09:00
Benoit Boissinot
125a85ec87 use new style classes 2009-06-10 15:10:21 +02:00
timeless
fb33de67af Generally replace "file name" with "filename" in help and comments. 2009-06-09 09:25:17 -04:00
Henri Wiechers
4269cb82b8 cleanup: removed unused imports 2009-06-07 21:16:05 +02:00
Matt Mackall
fcb44e87db commit: move explicit file checking into repo.commit 2009-06-01 21:51:00 -05:00
Matt Mackall
7c83f8b030 commit: editor reads file lists from provided context 2009-06-01 14:51:47 -05:00
Matt Mackall
37eaadf540 match: ignore return of match.bad
All users returned false, return can now be dropped
2009-05-31 17:54:18 -05:00
Matt Mackall
a30eb02911 cmdutils: Take over glob expansion duties from util 2009-05-24 16:38:29 -05:00
Matt Mackall
b287cf72fe match: refactor patkind
add patkind(pat) to match
change external users
change util.patkind to _patsplit
2009-05-24 02:56:14 -05:00
Patrick Mezard
e8790c2140 serve: add and use portable spawnvp replacement
There is no standard python command to really detach a process under Windows.
Instead we use the low level API wrapped by subprocess module with all
necessary options to avoid any kind of context inheritance. Unfortunately, this
version still opens a new window for the child process.

The following have been tried:
- os.spawnv(os.P_NOWAIT): works but the child process is killed when parent
  console terminates.
- os.spawnv(os.P_DETACH): works on python25, hang on python26 when writing to
  the hgweb output socket.
- subprocess.CreateProcess() hack without shell mode: similar to
  os.spawnv(os.P_DETACH).

Fix 1/3 for issue421
2009-04-10 21:20:25 +02:00
Robert Bachmann
ef03cfb55c Bugfix and test for hg log XML output 2009-12-30 02:41:19 +01:00
Robert Bachmann
93bde9a865 Added support for templatevar "footer" to cmdutil.py 2009-12-28 17:55:52 +01:00
Nicolas Dumazet
4c31093b61 cmdutil: replace sys.maxint with None as default value in loglimit
Semantically, it is better to use None over any other value when there is
"no value". Using maxint in this context is quite hackish, and is not forward
compatible.
2009-12-14 00:32:29 +09:00
Patrick Mezard
f32df1c921 Make {file_copies} usable as a --template key
Before this, to display file copies in templates, you had to write something
like {file_copies%filecopy}. For some reason, the {file_copy} subtemplate was
used by default but not defined by default in changeset_templater, while styles
were already using it. Here we define {file_copy} in changeset_templater, and
change the templater to handle formatting strings like {file_copies%filecopy}
with already expanded keys (in this case {file_copies}), for backward
compatibility.
2009-12-13 18:06:24 +01:00
Patrick Mezard
46b592cdfa templatekw: change {file_copies} behaviour, add {file_copies_switch}
{file_copies} template now displays file copies with or without the --copies
switch being set. A new {file_copies_switch} template implements the former
behaviour.
2009-12-13 18:06:24 +01:00
Patrick Mezard
f11c571560 cmdutil: extract file copies closure into templatekw 2009-12-13 18:06:24 +01:00
Patrick Mezard
a8e64bad12 cmdutil: extract latest tags closures in templatekw 2009-12-13 18:06:24 +01:00
Patrick Mezard
0ea61cf043 cmdutil: extract file changes closures into templatekw 2009-12-13 18:06:24 +01:00
Patrick Mezard
da27222189 cmdutil: extract repo dependent closures in templatekw 2009-12-13 18:06:23 +01:00
Patrick Mezard
434744ad77 cmdutil: extract ctx dependent closures into templatekw 2009-12-13 18:06:23 +01:00
Patrick Mezard
9de17a2612 cmdutil: replace showlist() closure with a function 2009-12-13 18:06:23 +01:00
Dirkjan Ochtman
9aac0ec2b7 merge with the stable branch 2009-12-10 12:31:57 +01:00
Benoit Boissinot
2c87a7558e log --follow: use a set instead of a list
benchmarked with hg log -qf on the linux kernel:

before:
Time: real 39.010 secs (user 38.840+0.000 sys 0.060+0.000)
after:
Time: real 8.560 secs (user 8.440+0.000 sys 0.080+0.000)
2009-12-10 00:14:22 +01:00
Nicolas Dumazet
414130944c cmdutil: service: add appendpid parameter to append pids to pid file 2009-12-01 11:28:31 +09:00
Benoit Boissinot
da51217b4d backout experimental change from 67851ac42937 2009-12-01 01:43:46 +01:00
Matt Mackall
184d53a4f9 Merge with crew 2009-11-30 15:31:14 -06:00
Patrick Mezard
dee4f69d0f cmdutil: fix missing default 'extra' template 2009-11-30 22:23:09 +01:00
Nicolas Dumazet
668d6309cd run-tests: add --inotify option to test runner
Activate inotify extension when running tests.
2009-11-17 18:50:39 +09:00
Benoit Boissinot
f181483f31 findrenames: improve coding-style 2009-11-24 20:40:04 +01:00
Benoit Boissinot
22b5fe48a3 findrenames: speedup exact match
benchmarked on crew repo with:
rm -rf * ; hg up -C ; for i in `find . -name "*.py"` ; do mv $i $i.new;done

followed by:
hg addremove -s 100

before: Time: real 28.890 secs (user 26.920+0.000 sys 1.450+0.000)
after : Time: real 6.790 secs (user 5.310+0.000 sys 1.350+0.000)
2009-11-24 18:21:47 +01:00
Benoit Boissinot
c6fb6e4c64 findrenames: refactor the score computation 2009-11-24 17:39:42 +01:00
Benoit Boissinot
ee278104a8 findrenames: first loop over the removed files, it's faster
Getting the file from the working dir is less expensive than getting it from
the repo history, hence the speedup.

benchmarked on crew repo with:
rm -rf * ; hg up -C ; for i in `find . -name "*.py"` ; do mv $i $i.new;done

followed by:
hg addremove -s 100

before: Time: real 68.760 secs (user 65.760+0.000 sys 2.490+0.000)
after : Time: real 28.890 secs (user 26.920+0.000 sys 1.450+0.000)
2009-11-24 17:26:42 +01:00
Martin Geisler
6355b4950b cmdutil: mark string for translation 2009-05-20 12:20:27 +02:00
Matt Mackall
16d4ef56bc commit: explain how to abort commit in editor 2009-05-18 17:36:24 -05:00
Benoit Boissinot
bee6cb3d55 addremove/findrenames: find renames according to the match object (issue1527)
Instead of only finding similarities in the added/removed files found
by the addremove step, follow the match object:

hg addremove -s80 foo -> add and removes files in foo
                         + find similarities between files in foo
hg addremove -s80 -> add and removes files in the whole repo
                     + find similarities between files in the whole repo

hg import --similarity will still work correctly (only find similarities
between files found in the patch).
2009-05-17 22:51:17 +02:00
Benoit Boissinot
6f0577d081 addremove: mapping isn't really needed, simplify 2009-05-17 22:40:04 +02:00
Matt Mackall
5534a9c3e3 editor: move HG: filtering from ui to commiteditor 2009-05-14 13:21:17 -05:00
Matt Mackall
ebe3b0ebc3 commit: move commit editor to cmdutil, pass as function 2009-05-14 13:20:40 -05:00
Peter Arrenbrecht
a75765cf7f drop unused imports 2009-05-14 15:35:46 +02:00
Martin Geisler
4d0bbe44ba cmdutil: replace pseudo-set by real set 2009-05-12 01:08:28 +02:00
Dirkjan Ochtman
5c6c43b746 templater: provide the standard template filters by default 2009-05-12 12:04:05 +02:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
f6c8930392 replace various uses of list.reverse() 2009-04-26 16:50:44 -05:00
Matt Mackall
2f9b02c62d replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Matt Mackall
88b13fecec ui: replace parentui mechanism with repo.baseui 2009-04-26 16:50:43 -05:00
Matt Mackall
6708d0e299 add cmdutil.remoteui
remoteui sorts out the issues of getting ssh config options from the
local repo into the remote one while not copying other options like hooks.
2009-04-26 16:50:43 -05:00
Martin Geisler
e2222d3c43 replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
2009-04-22 00:57:28 +02:00
Martin Geisler
85e0e5f5fa cmdutil: return boolean result directly in want function 2009-04-22 17:15:59 +02:00
Martin Geisler
80dd126e92 remove unnecessary outer parenthesis in if-statements 2009-04-22 01:39:47 +02:00
Dirkjan Ochtman
10e214223e cmdutil: prevent code repetition by abstraction in changeset_templater 2009-04-06 10:51:27 +02:00
Dirkjan Ochtman
7856ee8225 cmdutil: refactor handling of templating in show_changeset() 2009-04-04 17:55:52 +02:00
Matt Mackall
642f4d7151 move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.
2009-04-03 14:51:48 -05:00
Martin Geisler
05b3dfb2cf cmdutil: fix untranslatable string in copy 2009-03-27 17:35:00 +01:00
Alexander Solovyov
475ce753d3 templater: ability to display diffstat for log-like commands 2009-03-23 10:41:42 +01:00
Alexander Solovyov
7ea3611901 templater: use contexts consistently throughout changeset_templater 2009-03-23 13:15:57 +01:00
timeless
26d95caa99 help: miscellaneous language fixes 2009-02-28 12:38:45 +01:00
Matt Mackall
ca1b896eac log: ignore --removed if no files specified (issue1166)
Otherwise we filter out merge changesets with no changed files
2009-02-16 17:37:23 -06:00
Jim Correia
78e5b53d7d add --git option to commands supporting --patch (log, incoming, history, tip)
No short -g form, since it would conflict with -g from the graphlog extension.
2009-02-14 22:40:39 +01:00
Alexander Solovyov
18946af340 cmdutil.logmessage: options should be optional 2009-01-19 12:38:54 +02:00
Matt Mackall
e61d364b61 error: move UnknownCommand and AmbiguousCommand 2009-01-12 11:39:38 -06:00
Brendan Cully
99c25ba716 Improved error message for log --follow
Mads Kiilerich notes that the existing message was unclear
when a nonexistent file was supplied.
2008-11-24 17:16:39 -08:00
Dirkjan Ochtman
9ef9b3e5db cmdutil: use change contexts for cset-printer and cset-templater 2008-11-14 13:59:25 +01:00
Matt Mackall
b2807810c6 linkrev: take a revision number rather than a hash 2008-11-12 15:19:14 -06:00
Ronny Pfannschmidt
599e773be7 export: fixed silent output file overwriting
hg export -o outfile 1 2 3 4 had the same effect as hg -o outfile 4

This was caused by opening with 'w' instead of 'a'. This only occurs when
the filename pattern resulted in ambiguous patch filenames.
2008-11-06 11:17:38 +01:00
Dirkjan Ochtman
2f6d26d640 patch: turn patch.diff() into a generator
This should even be a little faster than passing in an fp argument.
2008-11-03 16:48:23 +01:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Matt Mackall
bebeb261d5 findcmd: have dispatch look up strict flag 2008-10-22 17:34:08 -05:00
Matt Mackall
d06459495e rename: handle renaming to a target marked removed 2008-10-18 04:26:09 -05:00
Benoit Boissinot
20fc9c8d79 allow committing a removed directory
fix issue1089
2008-09-03 02:27:25 +02:00
Martin Geisler
28fb695e9a i18n: mark strings for translation in Mercurial 2008-08-31 16:12:02 +02:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
d4ab55a92b status: clean up all users for unknown files 2008-06-27 13:43:29 -05:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Matt Mackall
9d556277c8 context: avoid using None for working parent 2008-06-25 17:35:20 -05:00
Patrick Mezard
a19a271534 Merge with crew-stable 2008-06-07 11:43:16 +02:00
Maxim Dounin
1ce305a01e addremove: correctly handle intermediate symlinks
This fixes problems mentioned in issue660 comments (unrelated to original
issue) where directory was renamed, and symlink was added instead.
In such situation addremove wasn't able to correctly detect that old files
no longer here, but tried to add symlink (and failed due collision with
old files).
2008-05-07 14:32:00 +04:00
Matt Mackall
fb88571d19 match: remove files arg from repo.status and friends 2008-05-12 11:37:08 -05:00
Matt Mackall
6f8150b03d match: stop passing files through commitfunc 2008-05-12 11:37:08 -05:00
Matt Mackall
643bf14a33 match: use helpers for cmdutil 2008-05-12 11:37:08 -05:00
Matt Mackall
7a52386b9e walk: return a single value 2008-05-12 11:37:08 -05:00
Matt Mackall
aa95163304 walk: remove cmdutil.walk 2008-05-12 11:37:08 -05:00
Matt Mackall
5768074e71 walk: remove rel and exact returns 2008-05-12 11:37:08 -05:00
Matt Mackall
e02d6f5a75 walk: remove remaining users of cmdutils.matchpats 2008-05-12 11:37:07 -05:00
Matt Mackall
7e3e676e09 cmdutil: switch commit to match 2008-05-12 11:37:07 -05:00
Matt Mackall
9adaad6c57 walkchangerev: use new match objects 2008-05-12 11:37:07 -05:00
Matt Mackall
fb724552a5 walk: pass match object to cmdutil.walk
- introduce cmdutil.match
- change args to cmdutil.walk
- create match objects for walk calls
2008-05-12 11:37:07 -05:00
Matt Mackall
1897262320 walk: begin refactoring badmatch handling 2008-05-12 11:37:07 -05:00
Matt Mackall
15d8da57c1 walk: remove files arg from repo.walk and dirstate.walk 2008-05-12 11:37:07 -05:00
Matt Mackall
20f7afebf8 walk: introduce match objects 2008-05-12 11:37:07 -05:00
Matt Mackall
fd009cd512 walk: kill util.cmdmatcher and _matcher 2008-05-12 11:37:07 -05:00
Alexis S. L. Carvalho
56a207a5a7 rename --after: do not unlink source file (issue910)
"rename --after a.txt A.txt" on case mangling systems (e.g. Windows)
erroneously deleted A.txt (even if modified).
2008-04-19 10:42:30 +02:00
Dirkjan Ochtman
06d8e99e57 remove trailing spaces 2008-04-16 12:09:16 +02:00
Patrick Mezard
e6d132922b cmdutil: handle and warn about missing copy revisions 2008-04-14 22:31:33 +02:00
Alexis S. L. Carvalho
6f8858904c Fix issue995 (copy --after and symlinks pointing to a directory)
I haven't looked at other places that call os.path.isdir to make
sure they're OK.
2008-03-14 10:32:19 -03:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Thomas Arendsen Hein
5727413b6a Move finding/checking the log limit to cmdutil 2008-02-29 01:51:23 +01:00
Alexis S. L. Carvalho
26b304926b cmdutil.walkchangerevs: use '-1:0' instead ot 'tip:0'
This avoids a possibly expensive tag lookup.
2008-02-19 19:20:10 -03:00
Thomas Arendsen Hein
a1c1677af4 Fix bad behaviour when specifying an invalid date (issue700)
commit (aborts _after_ typing in a commit message)
backout (aborted after the initial revert)
tag (edited .hgtags and couldn't commit)
import (patch applied, then commit fails)
qnew (aborts on bad dates, but writes any valid date into the # Date header)
qrefresh (like qnew)
sign (like tag)
fetch (merge, merge, merge, merge, abort)
2008-02-17 21:34:28 +01:00
Alexis S. L. Carvalho
d3f4694609 cmdutil.commit: use relative paths in the error messages
This is more consistent with other error messages and requires
less makeup in test-commit and test-symlink-basic.
2008-02-15 10:38:37 -02:00
Matt Mackall
41e5c79455 templates: move filters to their own module
This eliminates just about all Mercurial dependencies in templater.py
2008-01-31 14:44:19 -06:00
Christian Ebert
5c18a69d2e Prefer i in d over d.has_key(i) 2008-01-20 14:39:25 +01:00
Shun-ichi GOTO
188e44cf4b Add endswithsep() and use it instead of using os.sep and os.altsep directly.
This change is intended to allow hooking endswithsep() by win32mbcs
extension for MBCS support.
2008-01-09 21:30:35 +09:00
mark.williamson@cl.cam.ac.uk
75ee62ea88 Tweak finddate to pass date directly.
Previous implementation was passing (date + "to" + date), which fails
when "<" and friends are prepended to the date specifier.

Signed-off-by: Mark Williamson <mark.williamson@cl.cam.ac.uk>
2008-01-11 01:36:20 +00:00
Kirill Smelkov
c35576c935 cmdutil.commit: extract 'addremove' from opts carefully
we are going to use cmdutil.commit for qrecord, and it's brother
qrefresh does not support addremove.
2008-01-10 12:07:18 +03:00
Bryan O'Sullivan
a3e3ece3f7 serve: Don't change directory in the child if invoked with -d and --cwd 2008-01-04 11:52:24 -08:00
Thomas Arendsen Hein
347da85c36 Removed tabs and trailing whitespace in python files 2007-12-29 19:49:48 +01:00
Matt Mackall
c205c57746 cmdutil: make bail_if_changed bail on uncommitted merge 2007-12-27 23:55:39 -06:00
Matt Mackall
06d5fbf2a5 copy: handle rename internally
- add rename parameter
- don't collect copied list
- report "moving" rather than "copying"
- remove renamed files
- don't return copied list
- simplify callers
2007-12-07 02:29:55 -06:00
Matt Mackall
9c9f979f96 copy: move rename logic 2007-12-07 02:03:42 -06:00
Matt Mackall
e777df13c0 copy: simplify inner copy
- save dirstate lookup and exists check
- do all fs work inside a single dryrun clause
- move unlinking into inner copy section
- move target dir creation
- eliminate undelete mess
- fix a bug on mv a -> b -> a after merge
2007-12-07 02:01:13 -06:00
Matt Mackall
7ccba02a77 copy: minor cleanups
- add after and dryrun variables
- add some comments
2007-12-07 02:01:10 -06:00
Matt Mackall
5078c44417 copy: propagate errors properly 2007-12-06 15:15:47 -06:00
Matt Mackall
6d83b8c76f copy: refactor okaytocopy into walkpat
- rename core copy function to copyfile
- move origsrc details into copyfile
- turn okaytocopy loop into walkpat
2007-12-06 14:58:57 -06:00
Matt Mackall
60b67b58aa copy: fix copying back with -A (issue836) 2007-12-02 18:41:22 -06:00
Matt Mackall
87c040230a move commands.docopy to cmdutil.copy 2007-12-02 18:11:59 -06:00
Patrick Mezard
cbf322b12c cmdutil: make "files" list all files, add "file_mods" for modified files 2007-11-24 20:16:59 +01:00
Patrick Mezard
8f3f01adea cmdutil: always expose "files_add", "files_del" and "manifest" templater properties 2007-11-24 17:56:15 +01:00
Maxim Dounin
8561d688a1 Fix file-changed-to-dir and dir-to-file commits (issue660).
Allow adding to dirstate files that clash with previously existing
but marked for removal. Protect from reintroducing clashes by revert.

This change doesn't address related issues with update. Current
workaround is to do "clean" update by manually removing conflicting
files/dirs from working directory.
2007-11-05 20:05:44 +03:00
Matt Mackall
c08427e0e8 dispatch: move command dispatching into its own module
- move command dispatching functions from commands and cmdutil to dispatch
- change findcmd to take a table argument
- remove circular import of commands in cmdutil
- privatize helper functions in dispatch
2007-08-15 16:55:13 -05:00
Matt Mackall
1d9daf6473 move parseurl from cmdutil to hg 2007-08-15 16:10:36 -05:00
Thomas Arendsen Hein
325c8db06b merge with crew-stable 2007-08-04 22:27:52 +02:00
Thomas Arendsen Hein
ae0d60a260 Simplify/correct finding the hg executable (fixes issue644)
Simply use find_exe('hg') as the default value for $HG and require to manually
set it if you have special requirements.

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

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

Additionally util.hgexecutable() is now available so extensions can access
the value with a public interface, too.
2007-08-04 22:25:12 +02:00
Bryan O'Sullivan
3bcee4b94e commands: move commit to cmdutil as wrapper for commit-like functions 2007-07-31 16:28:05 -07:00
Matt Mackall
cd72dc7f1b Merge with crew 2007-07-21 16:44:38 -05:00
Matt Mackall
3a3bd8ec5b Make repo locks recursive, eliminate all passing of lock/wlock 2007-07-21 16:02:10 -05:00
Matt Mackall
c2967290a5 dirstate: add __contains__ and make __getitem__ more useful
dirstate.state(f) == '?' -> f not in dirstate
dirstate.state(f) -> dirstate[f]
2007-07-21 16:02:09 -05:00
Thomas Arendsen Hein
dbdc09ab03 Make [defaults] in .hg/hgrc work. 2007-07-21 17:36:45 +02:00
Alexis S. L. Carvalho
e4f786c463 archive: make the %r escape work. 2007-07-11 19:56:16 -03:00
Thomas Arendsen Hein
898f48cc24 hg log: Move filtering implicit parents to own method and use it in templater.
Extended test repo in test-command-template to contain changeset to test this.
2007-07-08 12:52:08 +02:00
Thomas Arendsen Hein
a0ef6536ad Strip whitespace from changeset description in changeset_templater.
changeset_printer already does this, too.
2007-07-08 10:43:57 +02:00
Thomas Arendsen Hein
4784c1900b Abort if earlygetopt fails to detect an option.
Otherwise it could happen that a command is used on the wrong repository,
because abbreviations of --cwd or --repository were ignored.
2007-06-28 16:03:45 +02:00
Thomas Arendsen Hein
780c8f7779 Simplified earlygetopt and made it remove parsed options and values.
The order of aliases is no longer important, too.
2007-06-28 15:56:25 +02:00
Thomas Arendsen Hein
e10fcd1450 Disallow short earlygetop option combined with other short options
While "hg commit -qRfoo" can be read as "--quiet --repository foo",
"hg commit -mRfoo" should be "--message Rfoo".
2007-06-27 20:37:33 +02:00
Thomas Arendsen Hein
1dcdb0a53a Fix earlygetop for short options with unnecessary spaces removed
Examples:
 hg log -qR foo
 hg log -Rfoo
 hg log -qRfoo
2007-06-26 18:35:31 +02:00
Thomas Arendsen Hein
61d51838df New config option: ui.report_untrusted (defaults to True) 2007-06-25 22:41:15 +02:00
Thomas Arendsen Hein
05fbf9e284 Make earlygetopt return a list of all option values, use the last value.
This fixes:
"hg -R" showing a useful error instead of traceback
"hg -R foo --repository bar" using bar instead of foo

And provides a way for other users of earlygetopt to accept more than
one value.
2007-06-25 22:08:10 +02:00
Benoit Boissinot
4fdb840ede Make changeset_printer respect ui diffopts 2007-06-25 11:29:17 -07:00
Thomas Arendsen Hein
2e76adae49 Remember path to 'hg' executable and pass to external tools and hooks as $HG. 2007-06-23 20:21:10 +02:00
Matt Mackall
613a7dfcea identify: take a path to a remote repo
Rather than using -R, we take a path as an argument. This lets us use
url#branch syntaxes that may be in hgrc.
2007-06-21 13:09:01 -05:00
Matt Mackall
f0400ad7b9 dispatch: parse local hgrc for paths 2007-06-21 13:09:00 -05:00
Matt Mackall
b5a98f60fd identify: work with remote repos 2007-06-21 11:54:16 -05:00
Brendan Cully
f7e826dad3 Fix dispatch error message when not in a repo 2007-06-20 20:13:31 -07:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Thomas Arendsen Hein
483231d996 Cleanup of whitespace, indentation and line continuation. 2007-06-19 08:06:37 +02:00
Matt Mackall
30a1419154 dispatch: report failed imports nicely 2007-06-18 21:30:27 -05:00
Matt Mackall
c61bc27ccc dispatch: add generic pre- and post-command hooks 2007-06-18 17:49:56 -05:00
Matt Mackall
5ecb0cb232 dispatch: fix handling of incorrect number of arguments 2007-06-18 13:24:34 -05:00
Matt Mackall
579d9e3b44 encoding: pull fallbackencoding out of localrepo into early parsing 2007-06-18 13:24:34 -05:00
Matt Mackall
cdeb6ec2da extensions: kill ui readhooks
Move .hgrc extension loading into localrepo
2007-06-18 13:24:34 -05:00
Patrick Mezard
d37b2026d5 cmdutil: add missing "time" import. 2007-06-17 20:35:32 +02:00
Alexis S. L. Carvalho
8b373440d8 addremove: use util.lexists 2007-06-13 19:15:58 -03:00
Brendan Cully
37671e0260 dispatch: restore a dropped shlex import
Add test-dispatch as a place for command parsing and dispatch tests.
2007-06-12 13:21:42 -07:00
Matt Mackall
7092619ffc dispatch: accept an abbreviation of --repository 2007-06-11 21:09:24 -05:00
Matt Mackall
ca982cdfb5 dispatch: move findrepo to cmdutil 2007-06-11 21:09:24 -05:00
Matt Mackall
dc4befe753 localrepo: don't search from path
All current callers already pass in the repo root.

This normalizes things a bit. Now all repo types take a direct path to
repo root and only the command line interface (or the dispatcher)
searches from the current directory.
2007-06-11 21:09:24 -05:00
Matt Mackall
1621c30af5 dispatch: use the repo path found by early parsing
This lets us simplify things a bit.
2007-06-11 21:09:24 -05:00
Matt Mackall
b37003d1a6 dispatch: parse and apply -R early
This allows us to use extensions specified in .hg/hgrc. Unfortunately,
this requires us to parse that file twice, but performance impact on
the version command appears to be less than 1%.
2007-06-11 21:09:24 -05:00
Matt Mackall
a0218b2be7 dispatch: parse and apply cwd opt early 2007-06-11 21:09:24 -05:00
Matt Mackall
eec35bbc8f dispatch: rename variables after code motion 2007-06-11 21:09:24 -05:00
Matt Mackall
671f8a455f dispatch: hoist debugging hook to runcatch 2007-06-11 21:09:24 -05:00
Matt Mackall
7daba33088 dispatch: move dispatching code to cmdutil 2007-06-11 21:09:24 -05:00
Matt Mackall
fc13f3eb60 dispatch: move runcommand to cmdutil 2007-06-11 21:09:24 -05:00
Alexis S. L. Carvalho
e1bf8e80c5 Add dirstate.pathto and localrepo.pathto.
Every time util.pathto is called, we have to pass the repo root and the
repo cwd.

dirstate.pathto is a simple convenience function that knows about the
root and the cwd arguments.  It's still possible to pass the cwd as an
optimization.

localrepo.pathto is a convenience function that just calls
dirstate.pathto, just like localrepo.getcwd.

dirstate.pathto becomes a single point that converts most (all?) paths
from the internal representation to some OS-specific relative path for
display purposes.
2007-06-08 23:49:12 -03:00
Alexis S. L. Carvalho
4949bc9033 Use absolute paths in addremove.
This is more consistent with other places in the code, which only use
the "relpath" returned by cmdutil.walk for display purposes.
2007-06-08 23:49:12 -03:00
Matt Mackall
41d9aaebb8 Add support for url#id syntax
This allows you to do:

 hg clone http://server/repo#stable

which is equivalent to:

 hg clone -r stable http://server/repo

Future incoming, outgoing, and push commands will default to using
this id because it's recorded in the default path.

Other commands that accept URLs (push, pull, bundle, incoming, and
outgoing) also accept this syntax.
2007-06-01 18:40:14 -05:00
Thomas Arendsen Hein
128193f3e9 addremove: comparing two empty files caused ZeroDivisionError
(found by Giorgos Keramidas)
2007-06-01 16:00:40 +02:00
Bryan O'Sullivan
7b6d636f19 Refactor commands.serve to allow other commands to run as services.
This introduces a new function, cmdutil.service.
2007-04-27 21:30:55 -07:00
Matt Mackall
e2dfe968ea Merge with stable 2007-04-16 12:37:30 -05:00
Alexis S. L. Carvalho
62e2a7bfb7 command line templates: add formatnode filter
This will print a full hash node with --debug and a short one otherwise.

Use it with some default templates and in map-cmdline.default to print
the parents.  This should fix issue538.
2007-04-16 13:00:23 -03:00
Alexis S. L. Carvalho
4b47aae3d4 fix 'hg <not-log> -v --template foo' with revisions without copies 2007-04-16 13:00:23 -03:00
Alexis S. L. Carvalho
47cb22b5a2 Merge with crew-stable 2007-03-16 00:45:18 -03:00
Alexis S. L. Carvalho
fcb39243b1 pass repo.root to util.pathto() in preparation for the next patch 2007-03-16 00:22:57 -03:00
Matt Mackall
e896adead6 Merge with -stable, fix small test failure 2007-03-14 01:26:09 -05:00
Alexis S. L. Carvalho
fd69fe8d91 "default" is the default branch name 2007-03-13 15:02:33 -03:00
Alexis S. L. Carvalho
641d95a966 Merge a bunch of matcher and locate fixes. 2007-03-10 23:21:33 -03:00
Alexis S. L. Carvalho
c3d6308137 remove unused "head" hack from util._matcher 2007-03-10 23:00:59 -03:00
Alexis S. L. Carvalho
b53e6f3897 change locate to use relglobs by default
This makes its default behaviour useful again (issue108), and
changes it search the entire repository by default (instead
of just the cwd), just like all other commands.

It also hides issue204 by default, but you'll still see the
same behaviour if you give it a relpath: pattern.
2007-03-10 23:00:57 -03:00
Alexis S. L. Carvalho
c576480d83 Leave normalization of patterns to util._matcher
Passing [] to util.cmdmatcher accidentally fixes walking of files
with "\n" in the name.
2007-03-10 23:00:46 -03:00
Alexis S. L. Carvalho
5b836109d8 docopy: deal with globs on windows in a better way 2007-01-30 18:32:20 -02:00
Giorgos Keramidas
671dc70240 Fix addremove for symlinks to non-existent files 2007-01-05 21:28:49 +02:00
Erling Ellingsen
77c63b0f24 Avoid some false positives for addremove -s
The original code uses the similary score

  1 - len(diff(after, before)) / len(after)

The diff can at most be the size of the 'before' file, so any small
'before' file would be considered very similar. Removing an empty file
would cause all files added in the same revision to be considered
copies of the removed file.

This changes the metric to

  bytes_overlap(before, after) / len(before + after)

i.e. the actual percentage of bytes shared between the two files.
2007-02-18 20:39:25 +01:00
Alexis S. L. Carvalho
fff454d591 Merge with crew-stable 2007-01-30 19:36:56 -02:00
Benoit Boissinot
2f422472c6 cmdutil.py: use contexts in findrenames 2006-12-26 03:12:51 +01:00
Matt Mackall
296d6a7cb8 Simplify i18n imports 2006-12-14 20:25:19 -06:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Matt Mackall
2623870448 Remove deprecated old-style branch support 2006-12-12 18:16:23 -06:00
Thomas Arendsen Hein
0729b92012 Use util.always instead of creating a new lambda function in show_changeset
and simplify the expression.
2006-12-09 09:30:29 +01:00
Matt Mackall
daf6a67d1c Fix log regression where log -p file showed diffs for other files 2006-12-08 20:44:58 -06:00
Alexis S. L. Carvalho
2b3be537b8 log: convert branch names to the local encoding 2006-12-08 01:36:50 -02:00
Alexis S. L. Carvalho
8e669882ac fix hg diff -r '' 2006-12-07 14:15:11 -02:00
Matt Mackall
2c751c4197 Add --date support to update and revert
Add finddate to find the tipmost revision that matches a date spec
Add --date option to update
Add --date option to revert
Don't pass backout's -d option to revert
2006-12-06 17:58:09 -06:00
Matt Mackall
4674f1ed5e use ui buffering in changeset printer
delete old uibuffer class
delete old stringio class
move show to _show
add new show that uses ui.pushbuffer to buffer
add new flush that writes buffered data
add props arg to changeset_printer to match _templater
2006-12-01 01:28:19 -06:00
Alexis S. L. Carvalho
3ef2e9ed94 fix hg log -r '' 2006-11-27 22:56:26 -02:00
Thomas Arendsen Hein
ea20cdf3f7 Removed unused ui parameter from revpair/revrange and fix its users. 2006-11-22 23:02:28 +01:00
Thomas Arendsen Hein
411d64ce3e white space and line break cleanups 2006-11-17 08:06:54 +01:00
Matt Mackall
a43442fa8e add log --removed 2006-11-15 15:51:58 -06:00
Matt Mackall
8e5a9075b7 move walkchangerevs to cmdutils 2006-11-15 15:51:58 -06:00
Matt Mackall
c8bc764d1e Consolidate brinfo handling 2006-11-15 15:51:58 -06:00
Matt Mackall
40946417bd changeset templater: convert some unnecessary yields to returns 2006-11-15 15:51:58 -06:00
Matt Mackall
f40fcaac75 Refactor log ui buffering and patch display 2006-11-13 13:26:57 -06:00
Matt Mackall
c50c09da0a templates: move changeset templating bits to cmdutils 2006-11-13 13:26:57 -06:00
Matt Mackall
9297d4db5f convert dict(zip(x,x)) to dict.fromkeys(x) 2006-10-27 00:38:42 -05:00
Matt Mackall
16cbfeb13b kill makewalk function 2006-10-26 18:43:57 -05:00
Matt Mackall
6ff42f7ea8 Make revrange return a list of ints so that callers don't have to convert 2006-10-26 17:27:07 -05:00
Matt Mackall
9062f155f7 simplify revrange and revpair 2006-10-26 17:15:55 -05:00
Matt Mackall
89015daf47 lookup(str(x)) -> lookup(x) 2006-10-26 14:09:15 -05:00
Brendan Cully
24756bd157 Move revision parsing into cmdutil. 2006-09-14 11:19:35 -07:00
Thomas Arendsen Hein
d2082f10fc Never apply string formatting to generated errors with util.Abort.
Otherwise error messages containing % chars yield errors or worse.
Fixed (hopefully) all users of util.Abort.
2006-09-08 09:36:18 +02:00
Vadim Gelfer
f72ee79e69 addremove: add -s/--similarity option
progress on issue 295.
2006-08-18 22:13:58 -07:00
Vadim Gelfer
e72a2729a5 fix comment. 2006-08-18 21:18:01 -07:00
Vadim Gelfer
453f16d1d7 cmdutil.matchpats: allow include/exclude to be optional. 2006-08-13 17:03:33 -07:00
Vadim Gelfer
15c30eaff6 add default values to arguments of walk etc. 2006-08-13 17:03:03 -07:00
Vadim Gelfer
92dd5b8dc0 move commands.addremove_lock to cmdutil.addremove 2006-08-13 16:57:45 -07:00
Vadim Gelfer
f3ad0810cd move walk and matchpats from commands to cmdutil. 2006-08-13 16:11:22 -07:00
Vadim Gelfer
13d751feaf refactor text diff/patch code.
rename commands.dodiff to patch.diff.
rename commands.doexport to patch.export.
move some functions from commands to new mercurial.cmdutil module.
turn list of diff options into mdiff.diffopts class.

patch.diff and patch.export now has clean api for call from 3rd party
python code.
2006-08-12 16:13:27 -07:00