Show More
@@ -0,0 +1,36 | |||
|
1 | Some commands allow the user to specify a date, e.g.: | |
|
2 | ||
|
3 | - backout, commit, import, tag: Specify the commit date. | |
|
4 | - log, revert, update: Select revision(s) by date. | |
|
5 | ||
|
6 | Many date formats are valid. Here are some examples:: | |
|
7 | ||
|
8 | "Wed Dec 6 13:18:29 2006" (local timezone assumed) | |
|
9 | "Dec 6 13:18 -0600" (year assumed, time offset provided) | |
|
10 | "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) | |
|
11 | "Dec 6" (midnight) | |
|
12 | "13:18" (today assumed) | |
|
13 | "3:39" (3:39AM assumed) | |
|
14 | "3:39pm" (15:39) | |
|
15 | "2006-12-06 13:18:29" (ISO 8601 format) | |
|
16 | "2006-12-6 13:18" | |
|
17 | "2006-12-6" | |
|
18 | "12-6" | |
|
19 | "12/6" | |
|
20 | "12/6/6" (Dec 6 2006) | |
|
21 | ||
|
22 | Lastly, there is Mercurial's internal format:: | |
|
23 | ||
|
24 | "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC) | |
|
25 | ||
|
26 | This is the internal representation format for dates. unixtime is | |
|
27 | the number of seconds since the epoch (1970-01-01 00:00 UTC). | |
|
28 | offset is the offset of the local timezone, in seconds west of UTC | |
|
29 | (negative if the timezone is east of UTC). | |
|
30 | ||
|
31 | The log command also accepts date ranges:: | |
|
32 | ||
|
33 | "<{datetime}" - at or before a given date/time | |
|
34 | ">{datetime}" - on or after a given date/time | |
|
35 | "{datetime} to {datetime}" - a date range, inclusive | |
|
36 | "-{days}" - within a given number of days of today |
@@ -0,0 +1,31 | |||
|
1 | Mercurial's default format for showing changes between two | |
|
2 | versions of a file is compatible with the unified format of GNU | |
|
3 | diff, which can be used by GNU patch and many other standard | |
|
4 | tools. | |
|
5 | ||
|
6 | While this standard format is often enough, it does not encode the | |
|
7 | following information: | |
|
8 | ||
|
9 | - executable status and other permission bits | |
|
10 | - copy or rename information | |
|
11 | - changes in binary files | |
|
12 | - creation or deletion of empty files | |
|
13 | ||
|
14 | Mercurial also supports the extended diff format from the git VCS | |
|
15 | which addresses these limitations. The git diff format is not | |
|
16 | produced by default because a few widespread tools still do not | |
|
17 | understand this format. | |
|
18 | ||
|
19 | This means that when generating diffs from a Mercurial repository | |
|
20 | (e.g. with "hg export"), you should be careful about things like | |
|
21 | file copies and renames or other things mentioned above, because | |
|
22 | when applying a standard diff to a different repository, this | |
|
23 | extra information is lost. Mercurial's internal operations (like | |
|
24 | push and pull) are not affected by this, because they use an | |
|
25 | internal binary format for communicating changes. | |
|
26 | ||
|
27 | To make Mercurial produce the git extended diff format, use the | |
|
28 | --git option available for many commands, or set 'git = True' in | |
|
29 | the [diff] section of your hgrc. You do not need to set this | |
|
30 | option when importing diffs in this format or using them in the mq | |
|
31 | extension. |
@@ -0,0 +1,76 | |||
|
1 | HG | |
|
2 | Path to the 'hg' executable, automatically passed when running | |
|
3 | hooks, extensions or external tools. If unset or empty, this is | |
|
4 | the hg executable's name if it's frozen, or an executable named | |
|
5 | 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on | |
|
6 | Windows) is searched. | |
|
7 | ||
|
8 | HGEDITOR | |
|
9 | This is the name of the editor to run when committing. See EDITOR. | |
|
10 | ||
|
11 | (deprecated, use .hgrc) | |
|
12 | ||
|
13 | HGENCODING | |
|
14 | This overrides the default locale setting detected by Mercurial. | |
|
15 | This setting is used to convert data including usernames, | |
|
16 | changeset descriptions, tag names, and branches. This setting can | |
|
17 | be overridden with the --encoding command-line option. | |
|
18 | ||
|
19 | HGENCODINGMODE | |
|
20 | This sets Mercurial's behavior for handling unknown characters | |
|
21 | while transcoding user input. The default is "strict", which | |
|
22 | causes Mercurial to abort if it can't map a character. Other | |
|
23 | settings include "replace", which replaces unknown characters, and | |
|
24 | "ignore", which drops them. This setting can be overridden with | |
|
25 | the --encodingmode command-line option. | |
|
26 | ||
|
27 | HGMERGE | |
|
28 | An executable to use for resolving merge conflicts. The program | |
|
29 | will be executed with three arguments: local file, remote file, | |
|
30 | ancestor file. | |
|
31 | ||
|
32 | (deprecated, use .hgrc) | |
|
33 | ||
|
34 | HGRCPATH | |
|
35 | A list of files or directories to search for hgrc files. Item | |
|
36 | separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set, | |
|
37 | platform default search path is used. If empty, only the .hg/hgrc | |
|
38 | from the current repository is read. | |
|
39 | ||
|
40 | For each element in HGRCPATH: | |
|
41 | ||
|
42 | - if it's a directory, all files ending with .rc are added | |
|
43 | - otherwise, the file itself will be added | |
|
44 | ||
|
45 | HGUSER | |
|
46 | This is the string used as the author of a commit. If not set, | |
|
47 | available values will be considered in this order: | |
|
48 | ||
|
49 | - HGUSER (deprecated) | |
|
50 | - hgrc files from the HGRCPATH | |
|
51 | ||
|
52 | - interactive prompt | |
|
53 | - LOGNAME (with '@hostname' appended) | |
|
54 | ||
|
55 | (deprecated, use .hgrc) | |
|
56 | ||
|
57 | ||
|
58 | May be used as the author of a commit; see HGUSER. | |
|
59 | ||
|
60 | LOGNAME | |
|
61 | May be used as the author of a commit; see HGUSER. | |
|
62 | ||
|
63 | VISUAL | |
|
64 | This is the name of the editor to use when committing. See EDITOR. | |
|
65 | ||
|
66 | EDITOR | |
|
67 | Sometimes Mercurial needs to open a text file in an editor for a | |
|
68 | user to modify, for example when writing commit messages. The | |
|
69 | editor it uses is determined by looking at the environment | |
|
70 | variables HGEDITOR, VISUAL and EDITOR, in that order. The first | |
|
71 | non-empty one is chosen. If all of them are empty, the editor | |
|
72 | defaults to 'vi'. | |
|
73 | ||
|
74 | PYTHONPATH | |
|
75 | This is used by Python to find imported modules and may need to be | |
|
76 | set appropriately if this Mercurial is not installed system-wide. |
@@ -0,0 +1,33 | |||
|
1 | Mercurial has the ability to add new features through the use of | |
|
2 | extensions. Extensions may add new commands, add options to | |
|
3 | existing commands, change the default behavior of commands, or | |
|
4 | implement hooks. | |
|
5 | ||
|
6 | Extensions are not loaded by default for a variety of reasons: | |
|
7 | they can increase startup overhead; they may be meant for advanced | |
|
8 | usage only; they may provide potentially dangerous abilities (such | |
|
9 | as letting you destroy or modify history); they might not be ready | |
|
10 | for prime time; or they may alter some usual behaviors of stock | |
|
11 | Mercurial. It is thus up to the user to activate extensions as | |
|
12 | needed. | |
|
13 | ||
|
14 | To enable the "foo" extension, either shipped with Mercurial or in | |
|
15 | the Python search path, create an entry for it in your hgrc, like | |
|
16 | this:: | |
|
17 | ||
|
18 | [extensions] | |
|
19 | foo = | |
|
20 | ||
|
21 | You may also specify the full path to an extension:: | |
|
22 | ||
|
23 | [extensions] | |
|
24 | myfeature = ~/.hgext/myfeature.py | |
|
25 | ||
|
26 | To explicitly disable an extension enabled in an hgrc of broader | |
|
27 | scope, prepend its path with !:: | |
|
28 | ||
|
29 | [extensions] | |
|
30 | # disabling extension bar residing in /path/to/extension/bar.py | |
|
31 | hgext.bar = !/path/to/extension/bar.py | |
|
32 | # ditto, but no path was supplied for extension baz | |
|
33 | hgext.baz = ! |
@@ -0,0 +1,15 | |||
|
1 | When Mercurial accepts more than one revision, they may be | |
|
2 | specified individually, or provided as a topologically continuous | |
|
3 | range, separated by the ":" character. | |
|
4 | ||
|
5 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END | |
|
6 | are revision identifiers. Both BEGIN and END are optional. If | |
|
7 | BEGIN is not specified, it defaults to revision number 0. If END | |
|
8 | is not specified, it defaults to the tip. The range ":" thus means | |
|
9 | "all revisions". | |
|
10 | ||
|
11 | If BEGIN is greater than END, revisions are treated in reverse | |
|
12 | order. | |
|
13 | ||
|
14 | A range acts as a closed interval. This means that a range of 3:5 | |
|
15 | gives 3, 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. |
@@ -0,0 +1,41 | |||
|
1 | Mercurial accepts several notations for identifying one or more | |
|
2 | files at a time. | |
|
3 | ||
|
4 | By default, Mercurial treats filenames as shell-style extended | |
|
5 | glob patterns. | |
|
6 | ||
|
7 | Alternate pattern notations must be specified explicitly. | |
|
8 | ||
|
9 | To use a plain path name without any pattern matching, start it | |
|
10 | with "path:". These path names must completely match starting at | |
|
11 | the current repository root. | |
|
12 | ||
|
13 | To use an extended glob, start a name with "glob:". Globs are | |
|
14 | rooted at the current directory; a glob such as "``*.c``" will | |
|
15 | only match files in the current directory ending with ".c". | |
|
16 | ||
|
17 | The supported glob syntax extensions are "``**``" to match any | |
|
18 | string across path separators and "{a,b}" to mean "a or b". | |
|
19 | ||
|
20 | To use a Perl/Python regular expression, start a name with "re:". | |
|
21 | Regexp pattern matching is anchored at the root of the repository. | |
|
22 | ||
|
23 | Plain examples:: | |
|
24 | ||
|
25 | path:foo/bar a name bar in a directory named foo in the root | |
|
26 | of the repository | |
|
27 | path:path:name a file or directory named "path:name" | |
|
28 | ||
|
29 | Glob examples:: | |
|
30 | ||
|
31 | glob:*.c any name ending in ".c" in the current directory | |
|
32 | *.c any name ending in ".c" in the current directory | |
|
33 | **.c any name ending in ".c" in any subdirectory of the | |
|
34 | current directory including itself. | |
|
35 | foo/*.c any name ending in ".c" in the directory foo | |
|
36 | foo/**.c any name ending in ".c" in any subdirectory of foo | |
|
37 | including itself. | |
|
38 | ||
|
39 | Regexp examples:: | |
|
40 | ||
|
41 | re:.*\.c$ any name ending in ".c", anywhere in the repository |
@@ -0,0 +1,29 | |||
|
1 | Mercurial supports several ways to specify individual revisions. | |
|
2 | ||
|
3 | A plain integer is treated as a revision number. Negative integers | |
|
4 | are treated as sequential offsets from the tip, with -1 denoting | |
|
5 | the tip, -2 denoting the revision prior to the tip, and so forth. | |
|
6 | ||
|
7 | A 40-digit hexadecimal string is treated as a unique revision | |
|
8 | identifier. | |
|
9 | ||
|
10 | A hexadecimal string less than 40 characters long is treated as a | |
|
11 | unique revision identifier and is referred to as a short-form | |
|
12 | identifier. A short-form identifier is only valid if it is the | |
|
13 | prefix of exactly one full-length identifier. | |
|
14 | ||
|
15 | Any other string is treated as a tag or branch name. A tag name is | |
|
16 | a symbolic name associated with a revision identifier. A branch | |
|
17 | name denotes the tipmost revision of that branch. Tag and branch | |
|
18 | names must not contain the ":" character. | |
|
19 | ||
|
20 | The reserved name "tip" is a special tag that always identifies | |
|
21 | the most recent revision. | |
|
22 | ||
|
23 | The reserved name "null" indicates the null revision. This is the | |
|
24 | revision of an empty repository, and the parent of revision 0. | |
|
25 | ||
|
26 | The reserved name "." indicates the working directory parent. If | |
|
27 | no working directory is checked out, it is equivalent to null. If | |
|
28 | an uncommitted merge is in progress, "." is the revision of the | |
|
29 | first parent. |
@@ -0,0 +1,113 | |||
|
1 | Mercurial allows you to customize output of commands through | |
|
2 | templates. You can either pass in a template from the command | |
|
3 | line, via the --template option, or select an existing | |
|
4 | template-style (--style). | |
|
5 | ||
|
6 | You can customize output for any "log-like" command: log, | |
|
7 | outgoing, incoming, tip, parents, heads and glog. | |
|
8 | ||
|
9 | Three styles are packaged with Mercurial: default (the style used | |
|
10 | when no explicit preference is passed), compact and changelog. | |
|
11 | Usage:: | |
|
12 | ||
|
13 | $ hg log -r1 --style changelog | |
|
14 | ||
|
15 | A template is a piece of text, with markup to invoke variable | |
|
16 | expansion:: | |
|
17 | ||
|
18 | $ hg log -r1 --template "{node}\n" | |
|
19 | b56ce7b07c52de7d5fd79fb89701ea538af65746 | |
|
20 | ||
|
21 | Strings in curly braces are called keywords. The availability of | |
|
22 | keywords depends on the exact context of the templater. These | |
|
23 | keywords are usually available for templating a log-like command: | |
|
24 | ||
|
25 | :author: String. The unmodified author of the changeset. | |
|
26 | :branches: String. The name of the branch on which the changeset | |
|
27 | was committed. Will be empty if the branch name was | |
|
28 | default. | |
|
29 | :date: Date information. The date when the changeset was | |
|
30 | committed. | |
|
31 | :desc: String. The text of the changeset description. | |
|
32 | :diffstat: String. Statistics of changes with the following | |
|
33 | format: "modified files: +added/-removed lines" | |
|
34 | :files: List of strings. All files modified, added, or removed | |
|
35 | by this changeset. | |
|
36 | :file_adds: List of strings. Files added by this changeset. | |
|
37 | :file_mods: List of strings. Files modified by this changeset. | |
|
38 | :file_dels: List of strings. Files removed by this changeset. | |
|
39 | :node: String. The changeset identification hash, as a | |
|
40 | 40-character hexadecimal string. | |
|
41 | :parents: List of strings. The parents of the changeset. | |
|
42 | :rev: Integer. The repository-local changeset revision | |
|
43 | number. | |
|
44 | :tags: List of strings. Any tags associated with the | |
|
45 | changeset. | |
|
46 | :latesttag: String. Most recent global tag in the ancestors of this | |
|
47 | changeset. | |
|
48 | :latesttagdistance: Integer. Longest path to the latest tag. | |
|
49 | ||
|
50 | The "date" keyword does not produce human-readable output. If you | |
|
51 | want to use a date in your output, you can use a filter to process | |
|
52 | it. Filters are functions which return a string based on the input | |
|
53 | variable. You can also use a chain of filters to get the desired | |
|
54 | output:: | |
|
55 | ||
|
56 | $ hg tip --template "{date|isodate}\n" | |
|
57 | 2008-08-21 18:22 +0000 | |
|
58 | ||
|
59 | List of filters: | |
|
60 | ||
|
61 | :addbreaks: Any text. Add an XHTML "<br />" tag before the end of | |
|
62 | every line except the last. | |
|
63 | :age: Date. Returns a human-readable date/time difference | |
|
64 | between the given date/time and the current | |
|
65 | date/time. | |
|
66 | :basename: Any text. Treats the text as a path, and returns the | |
|
67 | last component of the path after splitting by the | |
|
68 | path separator (ignoring trailing separators). For | |
|
69 | example, "foo/bar/baz" becomes "baz" and "foo/bar//" | |
|
70 | becomes "bar". | |
|
71 | :stripdir: Treat the text as path and strip a directory level, | |
|
72 | if possible. For example, "foo" and "foo/bar" becomes | |
|
73 | "foo". | |
|
74 | :date: Date. Returns a date in a Unix date format, including | |
|
75 | the timezone: "Mon Sep 04 15:13:13 2006 0700". | |
|
76 | :domain: Any text. Finds the first string that looks like an | |
|
77 | email address, and extracts just the domain | |
|
78 | component. Example: 'User <user@example.com>' becomes | |
|
79 | 'example.com'. | |
|
80 | :email: Any text. Extracts the first string that looks like | |
|
81 | an email address. Example: 'User <user@example.com>' | |
|
82 | becomes 'user@example.com'. | |
|
83 | :escape: Any text. Replaces the special XML/XHTML characters | |
|
84 | "&", "<" and ">" with XML entities. | |
|
85 | :fill68: Any text. Wraps the text to fit in 68 columns. | |
|
86 | :fill76: Any text. Wraps the text to fit in 76 columns. | |
|
87 | :firstline: Any text. Returns the first line of text. | |
|
88 | :nonempty: Any text. Returns '(none)' if the string is empty. | |
|
89 | :hgdate: Date. Returns the date as a pair of numbers: | |
|
90 | "1157407993 25200" (Unix timestamp, timezone offset). | |
|
91 | :isodate: Date. Returns the date in ISO 8601 format: | |
|
92 | "2009-08-18 13:00 +0200". | |
|
93 | :isodatesec: Date. Returns the date in ISO 8601 format, including | |
|
94 | seconds: "2009-08-18 13:00:13 +0200". See also the | |
|
95 | rfc3339date filter. | |
|
96 | :localdate: Date. Converts a date to local date. | |
|
97 | :obfuscate: Any text. Returns the input text rendered as a | |
|
98 | sequence of XML entities. | |
|
99 | :person: Any text. Returns the text before an email address. | |
|
100 | :rfc822date: Date. Returns a date using the same format used in | |
|
101 | email headers: "Tue, 18 Aug 2009 13:00:13 +0200". | |
|
102 | :rfc3339date: Date. Returns a date using the Internet date format | |
|
103 | specified in RFC 3339: "2009-08-18T13:00:13+02:00". | |
|
104 | :short: Changeset hash. Returns the short form of a changeset | |
|
105 | hash, i.e. a 12-byte hexadecimal string. | |
|
106 | :shortdate: Date. Returns a date like "2006-09-18". | |
|
107 | :strip: Any text. Strips all leading and trailing whitespace. | |
|
108 | :tabindent: Any text. Returns the text, with every line except | |
|
109 | the first starting with a tab character. | |
|
110 | :urlescape: Any text. Escapes all "special" characters. For | |
|
111 | example, "foo bar" becomes "foo%20bar". | |
|
112 | :user: Any text. Returns the user portion of an email | |
|
113 | address. |
@@ -0,0 +1,66 | |||
|
1 | Valid URLs are of the form:: | |
|
2 | ||
|
3 | local/filesystem/path[#revision] | |
|
4 | file://local/filesystem/path[#revision] | |
|
5 | http://[user[:pass]@]host[:port]/[path][#revision] | |
|
6 | https://[user[:pass]@]host[:port]/[path][#revision] | |
|
7 | ssh://[user[:pass]@]host[:port]/[path][#revision] | |
|
8 | ||
|
9 | Paths in the local filesystem can either point to Mercurial | |
|
10 | repositories or to bundle files (as created by 'hg bundle' or 'hg | |
|
11 | incoming --bundle'). | |
|
12 | ||
|
13 | An optional identifier after # indicates a particular branch, tag, | |
|
14 | or changeset to use from the remote repository. See also 'hg help | |
|
15 | revisions'. | |
|
16 | ||
|
17 | Some features, such as pushing to http:// and https:// URLs are | |
|
18 | only possible if the feature is explicitly enabled on the remote | |
|
19 | Mercurial server. | |
|
20 | ||
|
21 | Some notes about using SSH with Mercurial: | |
|
22 | ||
|
23 | - SSH requires an accessible shell account on the destination | |
|
24 | machine and a copy of hg in the remote path or specified with as | |
|
25 | remotecmd. | |
|
26 | - path is relative to the remote user's home directory by default. | |
|
27 | Use an extra slash at the start of a path to specify an absolute | |
|
28 | path:: | |
|
29 | ||
|
30 | ssh://example.com//tmp/repository | |
|
31 | ||
|
32 | - Mercurial doesn't use its own compression via SSH; the right | |
|
33 | thing to do is to configure it in your ~/.ssh/config, e.g.:: | |
|
34 | ||
|
35 | Host *.mylocalnetwork.example.com | |
|
36 | Compression no | |
|
37 | Host * | |
|
38 | Compression yes | |
|
39 | ||
|
40 | Alternatively specify "ssh -C" as your ssh command in your hgrc | |
|
41 | or with the --ssh command line option. | |
|
42 | ||
|
43 | These URLs can all be stored in your hgrc with path aliases under | |
|
44 | the [paths] section like so:: | |
|
45 | ||
|
46 | [paths] | |
|
47 | alias1 = URL1 | |
|
48 | alias2 = URL2 | |
|
49 | ... | |
|
50 | ||
|
51 | You can then use the alias for any command that uses a URL (for | |
|
52 | example 'hg pull alias1' would pull from the 'alias1' path). | |
|
53 | ||
|
54 | Two path aliases are special because they are used as defaults | |
|
55 | when you do not provide the URL to a command: | |
|
56 | ||
|
57 | default: | |
|
58 | When you create a repository with hg clone, the clone command | |
|
59 | saves the location of the source repository as the new | |
|
60 | repository's 'default' path. This is then used when you omit | |
|
61 | path from push- and pull-like commands (including incoming and | |
|
62 | outgoing). | |
|
63 | ||
|
64 | default-push: | |
|
65 | The push command will look for a path named 'default-push', and | |
|
66 | prefer it over 'default' if both are defined. |
@@ -1,103 +1,103 | |||
|
1 | 1 | PREFIX=/usr/local |
|
2 | 2 | export PREFIX |
|
3 | 3 | PYTHON=python |
|
4 | 4 | PURE= |
|
5 | 5 | PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py') |
|
6 | 6 | |
|
7 | 7 | help: |
|
8 | 8 | @echo 'Commonly used make targets:' |
|
9 | 9 | @echo ' all - build program and documentation' |
|
10 | 10 | @echo ' install - install program and man pages to PREFIX ($(PREFIX))' |
|
11 | 11 | @echo ' install-home - install with setup.py install --home=HOME ($(HOME))' |
|
12 | 12 | @echo ' local - build for inplace usage' |
|
13 | 13 | @echo ' tests - run all tests in the automatic test suite' |
|
14 | 14 | @echo ' test-foo - run only specified tests (e.g. test-merge1)' |
|
15 | 15 | @echo ' dist - run all tests and create a source tarball in dist/' |
|
16 | 16 | @echo ' clean - remove files created by other targets' |
|
17 | 17 | @echo ' (except installed files or dist source tarball)' |
|
18 | 18 | @echo ' update-pot - update i18n/hg.pot' |
|
19 | 19 | @echo |
|
20 | 20 | @echo 'Example for a system-wide installation under /usr/local:' |
|
21 | 21 | @echo ' make all && su -c "make install" && hg version' |
|
22 | 22 | @echo |
|
23 | 23 | @echo 'Example for a local installation (usable in this directory):' |
|
24 | 24 | @echo ' make local && ./hg version' |
|
25 | 25 | |
|
26 | 26 | all: build doc |
|
27 | 27 | |
|
28 | 28 | local: |
|
29 | 29 | $(PYTHON) setup.py $(PURE) build_py -c -d . build_ext -i build_mo |
|
30 | 30 | $(PYTHON) hg version |
|
31 | 31 | |
|
32 | 32 | build: |
|
33 | 33 | $(PYTHON) setup.py $(PURE) build |
|
34 | 34 | |
|
35 | 35 | doc: |
|
36 | 36 | $(MAKE) -C doc |
|
37 | 37 | |
|
38 | 38 | clean: |
|
39 | 39 | -$(PYTHON) setup.py clean --all # ignore errors from this command |
|
40 | 40 | find . -name '*.py[cdo]' -exec rm -f '{}' ';' |
|
41 | 41 | rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err |
|
42 | 42 | rm -rf locale |
|
43 | 43 | $(MAKE) -C doc clean |
|
44 | 44 | |
|
45 | 45 | install: install-bin install-doc |
|
46 | 46 | |
|
47 | 47 | install-bin: build |
|
48 | 48 | $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force |
|
49 | 49 | |
|
50 | 50 | install-doc: doc |
|
51 | 51 | cd doc && $(MAKE) $(MFLAGS) install |
|
52 | 52 | |
|
53 | 53 | install-home: install-home-bin install-home-doc |
|
54 | 54 | |
|
55 | 55 | install-home-bin: build |
|
56 | 56 | $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force |
|
57 | 57 | |
|
58 | 58 | install-home-doc: doc |
|
59 | 59 | cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install |
|
60 | 60 | |
|
61 | 61 | MANIFEST-doc: |
|
62 | 62 | $(MAKE) -C doc MANIFEST |
|
63 | 63 | |
|
64 | 64 | MANIFEST: MANIFEST-doc |
|
65 | 65 | hg manifest > MANIFEST |
|
66 | 66 | echo mercurial/__version__.py >> MANIFEST |
|
67 | 67 | cat doc/MANIFEST >> MANIFEST |
|
68 | 68 | |
|
69 | 69 | dist: tests dist-notests |
|
70 | 70 | |
|
71 | 71 | dist-notests: doc MANIFEST |
|
72 | 72 | TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist |
|
73 | 73 | |
|
74 | 74 | tests: |
|
75 | 75 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) |
|
76 | 76 | |
|
77 | 77 | test-%: |
|
78 | 78 | cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@ |
|
79 | 79 | |
|
80 | 80 | update-pot: i18n/hg.pot |
|
81 | 81 | |
|
82 | i18n/hg.pot: $(PYTHON_FILES) | |
|
82 | i18n/hg.pot: $(PYTHON_FILES) help/*.txt | |
|
83 | 83 | $(PYTHON) i18n/hggettext mercurial/commands.py \ |
|
84 | hgext/*.py hgext/*/__init__.py > i18n/hg.pot | |
|
84 | hgext/*.py hgext/*/__init__.py help/*.txt > i18n/hg.pot | |
|
85 | 85 | # All strings marked for translation in Mercurial contain |
|
86 | 86 | # ASCII characters only. But some files contain string |
|
87 | 87 | # literals like this '\037\213'. xgettext thinks it has to |
|
88 | 88 | # parse them even though they are not marked for translation. |
|
89 | 89 | # Extracting with an explicit encoding of ISO-8859-1 will make |
|
90 | 90 | # xgettext "parse" and ignore them. |
|
91 |
echo $ |
|
|
91 | echo $(PYTHON_FILES) | xargs \ | |
|
92 | 92 | xgettext --package-name "Mercurial" \ |
|
93 | 93 | --msgid-bugs-address "<mercurial-devel@selenic.com>" \ |
|
94 | 94 | --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \ |
|
95 | 95 | --from-code ISO-8859-1 --join --sort-by-file \ |
|
96 | 96 | -d hg -p i18n -o hg.pot |
|
97 | 97 | |
|
98 | 98 | %.po: i18n/hg.pot |
|
99 | 99 | msgmerge --no-location --update $@ $^ |
|
100 | 100 | |
|
101 | 101 | .PHONY: help all local build doc clean install install-bin install-doc \ |
|
102 | 102 | install-home install-home-bin install-home-doc dist dist-notests tests \ |
|
103 | 103 | update-pot |
@@ -1,123 +1,131 | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # |
|
3 | 3 | # hggettext - carefully extract docstrings for Mercurial |
|
4 | 4 | # |
|
5 | 5 | # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
|
6 | 6 | # |
|
7 | 7 | # This software may be used and distributed according to the terms of the |
|
8 | 8 | # GNU General Public License version 2, incorporated herein by reference. |
|
9 | 9 | |
|
10 | 10 | # The normalize function is taken from pygettext which is distributed |
|
11 | 11 | # with Python under the Python License, which is GPL compatible. |
|
12 | 12 | |
|
13 | 13 | """Extract docstrings from Mercurial commands. |
|
14 | 14 | |
|
15 | 15 | Compared to pygettext, this script knows about the cmdtable and table |
|
16 | 16 | dictionaries used by Mercurial, and will only extract docstrings from |
|
17 | 17 | functions mentioned therein. |
|
18 | 18 | |
|
19 | 19 | Use xgettext like normal to extract strings marked as translatable and |
|
20 | 20 | join the message cataloges to get the final catalog. |
|
21 | 21 | """ |
|
22 | 22 | |
|
23 | 23 | import os, sys, inspect |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | def escape(s): |
|
27 | 27 | # The order is important, the backslash must be escaped first |
|
28 | 28 | # since the other replacements introduce new backslashes |
|
29 | 29 | # themselves. |
|
30 | 30 | s = s.replace('\\', '\\\\') |
|
31 | 31 | s = s.replace('\n', '\\n') |
|
32 | 32 | s = s.replace('\r', '\\r') |
|
33 | 33 | s = s.replace('\t', '\\t') |
|
34 | 34 | s = s.replace('"', '\\"') |
|
35 | 35 | return s |
|
36 | 36 | |
|
37 | 37 | |
|
38 | 38 | def normalize(s): |
|
39 | 39 | # This converts the various Python string types into a format that |
|
40 | 40 | # is appropriate for .po files, namely much closer to C style. |
|
41 | 41 | lines = s.split('\n') |
|
42 | 42 | if len(lines) == 1: |
|
43 | 43 | s = '"' + escape(s) + '"' |
|
44 | 44 | else: |
|
45 | 45 | if not lines[-1]: |
|
46 | 46 | del lines[-1] |
|
47 | 47 | lines[-1] = lines[-1] + '\n' |
|
48 | 48 | lines = map(escape, lines) |
|
49 | 49 | lineterm = '\\n"\n"' |
|
50 | 50 | s = '""\n"' + lineterm.join(lines) + '"' |
|
51 | 51 | return s |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | def poentry(path, lineno, s): |
|
55 | 55 | return ('#: %s:%d\n' % (path, lineno) + |
|
56 | 56 | 'msgid %s\n' % normalize(s) + |
|
57 | 57 | 'msgstr ""\n') |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | def offset(src, doc, name, default): |
|
61 | 61 | """Compute offset or issue a warning on stdout.""" |
|
62 | 62 | # Backslashes in doc appear doubled in src. |
|
63 | 63 | end = src.find(doc.replace('\\', '\\\\')) |
|
64 | 64 | if end == -1: |
|
65 | 65 | # This can happen if the docstring contains unnecessary escape |
|
66 | 66 | # sequences such as \" in a triple-quoted string. The problem |
|
67 | 67 | # is that \" is turned into " and so doc wont appear in src. |
|
68 | 68 | sys.stderr.write("warning: unknown offset in %s, assuming %d lines\n" |
|
69 | 69 | % (name, default)) |
|
70 | 70 | return default |
|
71 | 71 | else: |
|
72 | 72 | return src.count('\n', 0, end) |
|
73 | 73 | |
|
74 | 74 | |
|
75 | 75 | def importpath(path): |
|
76 | 76 | """Import a path like foo/bar/baz.py and return the baz module.""" |
|
77 | 77 | if path.endswith('.py'): |
|
78 | 78 | path = path[:-3] |
|
79 | 79 | if path.endswith('/__init__'): |
|
80 | 80 | path = path[:-9] |
|
81 | 81 | path = path.replace('/', '.') |
|
82 | 82 | mod = __import__(path) |
|
83 | 83 | for comp in path.split('.')[1:]: |
|
84 | 84 | mod = getattr(mod, comp) |
|
85 | 85 | return mod |
|
86 | 86 | |
|
87 | 87 | |
|
88 | 88 | def docstrings(path): |
|
89 | 89 | """Extract docstrings from path. |
|
90 | 90 | |
|
91 | 91 | This respects the Mercurial cmdtable/table convention and will |
|
92 | 92 | only extract docstrings from functions mentioned in these tables. |
|
93 | 93 | """ |
|
94 | 94 | mod = importpath(path) |
|
95 | 95 | if mod.__doc__: |
|
96 | 96 | src = open(path).read() |
|
97 | 97 | lineno = 1 + offset(src, mod.__doc__, path, 7) |
|
98 | 98 | print poentry(path, lineno, mod.__doc__) |
|
99 | 99 | |
|
100 | 100 | cmdtable = getattr(mod, 'cmdtable', {}) |
|
101 | 101 | if not cmdtable: |
|
102 | 102 | # Maybe we are processing mercurial.commands? |
|
103 | 103 | cmdtable = getattr(mod, 'table', {}) |
|
104 | 104 | |
|
105 | 105 | for entry in cmdtable.itervalues(): |
|
106 | 106 | func = entry[0] |
|
107 | 107 | if func.__doc__: |
|
108 | 108 | src = inspect.getsource(func) |
|
109 | 109 | name = "%s.%s" % (path, func.__name__) |
|
110 | 110 | lineno = func.func_code.co_firstlineno |
|
111 | 111 | lineno += offset(src, func.__doc__, name, 1) |
|
112 | 112 | print poentry(path, lineno, func.__doc__) |
|
113 | 113 | |
|
114 | 114 | |
|
115 | def rawtext(path): | |
|
116 | src = open(path).read() | |
|
117 | print poentry(path, 1, src) | |
|
118 | ||
|
119 | ||
|
115 | 120 | if __name__ == "__main__": |
|
116 | 121 | # It is very important that we import the Mercurial modules from |
|
117 | 122 | # the source tree where hggettext is executed. Otherwise we might |
|
118 | 123 | # accidentally import and extract strings from a Mercurial |
|
119 | 124 | # installation mentioned in PYTHONPATH. |
|
120 | 125 | sys.path.insert(0, os.getcwd()) |
|
121 | 126 | from mercurial import demandimport; demandimport.enable() |
|
122 | 127 | for path in sys.argv[1:]: |
|
123 | docstrings(path) | |
|
128 | if path.endswith('.txt'): | |
|
129 | rawtext(path) | |
|
130 | else: | |
|
131 | docstrings(path) |
@@ -1,536 +1,92 | |||
|
1 | 1 | # help.py - help data for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2, incorporated herein by reference. |
|
7 | 7 | |
|
8 | from i18n import _ | |
|
8 | from i18n import gettext, _ | |
|
9 | import sys, os | |
|
9 | 10 | import extensions, util |
|
10 | 11 | |
|
11 | 12 | |
|
12 | 13 | def moduledoc(file): |
|
13 | 14 | '''return the top-level python documentation for the given file |
|
14 | 15 | |
|
15 | 16 | Loosely inspired by pydoc.source_synopsis(), but rewritten to handle \''' |
|
16 | 17 | as well as """ and to return the whole text instead of just the synopsis''' |
|
17 | 18 | result = [] |
|
18 | 19 | |
|
19 | 20 | line = file.readline() |
|
20 | 21 | while line[:1] == '#' or not line.strip(): |
|
21 | 22 | line = file.readline() |
|
22 | 23 | if not line: break |
|
23 | 24 | |
|
24 | 25 | start = line[:3] |
|
25 | 26 | if start == '"""' or start == "'''": |
|
26 | 27 | line = line[3:] |
|
27 | 28 | while line: |
|
28 | 29 | if line.rstrip().endswith(start): |
|
29 | 30 | line = line.split(start)[0] |
|
30 | 31 | if line: |
|
31 | 32 | result.append(line) |
|
32 | 33 | break |
|
33 | 34 | elif not line: |
|
34 | 35 | return None # unmatched delimiter |
|
35 | 36 | result.append(line) |
|
36 | 37 | line = file.readline() |
|
37 | 38 | else: |
|
38 | 39 | return None |
|
39 | 40 | |
|
40 | 41 | return ''.join(result) |
|
41 | 42 | |
|
42 | 43 | def listexts(header, exts, maxlength): |
|
43 | 44 | '''return a text listing of the given extensions''' |
|
44 | 45 | if not exts: |
|
45 | 46 | return '' |
|
46 | 47 | result = '\n%s\n\n' % header |
|
47 | 48 | for name, desc in sorted(exts.iteritems()): |
|
48 | 49 | result += ' %-*s %s\n' % (maxlength + 2, ':%s:' % name, desc) |
|
49 | 50 | return result |
|
50 | 51 | |
|
51 | 52 | def extshelp(): |
|
52 | doc = _(r''' | |
|
53 | Mercurial has the ability to add new features through the use of | |
|
54 | extensions. Extensions may add new commands, add options to | |
|
55 | existing commands, change the default behavior of commands, or | |
|
56 | implement hooks. | |
|
57 | ||
|
58 | Extensions are not loaded by default for a variety of reasons: | |
|
59 | they can increase startup overhead; they may be meant for advanced | |
|
60 | usage only; they may provide potentially dangerous abilities (such | |
|
61 | as letting you destroy or modify history); they might not be ready | |
|
62 | for prime time; or they may alter some usual behaviors of stock | |
|
63 | Mercurial. It is thus up to the user to activate extensions as | |
|
64 | needed. | |
|
65 | ||
|
66 | To enable the "foo" extension, either shipped with Mercurial or in | |
|
67 | the Python search path, create an entry for it in your hgrc, like | |
|
68 | this:: | |
|
69 | ||
|
70 | [extensions] | |
|
71 | foo = | |
|
72 | ||
|
73 | You may also specify the full path to an extension:: | |
|
74 | ||
|
75 | [extensions] | |
|
76 | myfeature = ~/.hgext/myfeature.py | |
|
77 | ||
|
78 | To explicitly disable an extension enabled in an hgrc of broader | |
|
79 | scope, prepend its path with !:: | |
|
80 | ||
|
81 | [extensions] | |
|
82 | # disabling extension bar residing in /path/to/extension/bar.py | |
|
83 | hgext.bar = !/path/to/extension/bar.py | |
|
84 | # ditto, but no path was supplied for extension baz | |
|
85 | hgext.baz = ! | |
|
86 | ''') | |
|
53 | doc = loaddoc('extensions')() | |
|
87 | 54 | |
|
88 | 55 | exts, maxlength = extensions.enabled() |
|
89 | 56 | doc += listexts(_('enabled extensions:'), exts, maxlength) |
|
90 | 57 | |
|
91 | 58 | exts, maxlength = extensions.disabled() |
|
92 | 59 | doc += listexts(_('disabled extensions:'), exts, maxlength) |
|
93 | 60 | |
|
94 | 61 | return doc |
|
95 | 62 | |
|
96 | helptable = ( | |
|
97 | (["dates"], _("Date Formats"), | |
|
98 | _(r''' | |
|
99 | Some commands allow the user to specify a date, e.g.: | |
|
100 | ||
|
101 | - backout, commit, import, tag: Specify the commit date. | |
|
102 | - log, revert, update: Select revision(s) by date. | |
|
103 | ||
|
104 | Many date formats are valid. Here are some examples:: | |
|
105 | ||
|
106 | "Wed Dec 6 13:18:29 2006" (local timezone assumed) | |
|
107 | "Dec 6 13:18 -0600" (year assumed, time offset provided) | |
|
108 | "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) | |
|
109 | "Dec 6" (midnight) | |
|
110 | "13:18" (today assumed) | |
|
111 | "3:39" (3:39AM assumed) | |
|
112 | "3:39pm" (15:39) | |
|
113 | "2006-12-06 13:18:29" (ISO 8601 format) | |
|
114 | "2006-12-6 13:18" | |
|
115 | "2006-12-6" | |
|
116 | "12-6" | |
|
117 | "12/6" | |
|
118 | "12/6/6" (Dec 6 2006) | |
|
119 | ||
|
120 | Lastly, there is Mercurial's internal format:: | |
|
121 | ||
|
122 | "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC) | |
|
123 | ||
|
124 | This is the internal representation format for dates. unixtime is | |
|
125 | the number of seconds since the epoch (1970-01-01 00:00 UTC). | |
|
126 | offset is the offset of the local timezone, in seconds west of UTC | |
|
127 | (negative if the timezone is east of UTC). | |
|
128 | ||
|
129 | The log command also accepts date ranges:: | |
|
130 | ||
|
131 | "<{datetime}" - at or before a given date/time | |
|
132 | ">{datetime}" - on or after a given date/time | |
|
133 | "{datetime} to {datetime}" - a date range, inclusive | |
|
134 | "-{days}" - within a given number of days of today | |
|
135 | ''')), | |
|
136 | ||
|
137 | (["patterns"], _("File Name Patterns"), | |
|
138 | _(r''' | |
|
139 | Mercurial accepts several notations for identifying one or more | |
|
140 | files at a time. | |
|
141 | ||
|
142 | By default, Mercurial treats filenames as shell-style extended | |
|
143 | glob patterns. | |
|
144 | ||
|
145 | Alternate pattern notations must be specified explicitly. | |
|
146 | ||
|
147 | To use a plain path name without any pattern matching, start it | |
|
148 | with "path:". These path names must completely match starting at | |
|
149 | the current repository root. | |
|
150 | ||
|
151 | To use an extended glob, start a name with "glob:". Globs are | |
|
152 | rooted at the current directory; a glob such as "``*.c``" will | |
|
153 | only match files in the current directory ending with ".c". | |
|
154 | ||
|
155 | The supported glob syntax extensions are "``**``" to match any | |
|
156 | string across path separators and "{a,b}" to mean "a or b". | |
|
157 | ||
|
158 | To use a Perl/Python regular expression, start a name with "re:". | |
|
159 | Regexp pattern matching is anchored at the root of the repository. | |
|
160 | ||
|
161 | Plain examples:: | |
|
162 | ||
|
163 | path:foo/bar a name bar in a directory named foo in the root | |
|
164 | of the repository | |
|
165 | path:path:name a file or directory named "path:name" | |
|
166 | ||
|
167 | Glob examples:: | |
|
168 | ||
|
169 | glob:*.c any name ending in ".c" in the current directory | |
|
170 | *.c any name ending in ".c" in the current directory | |
|
171 | **.c any name ending in ".c" in any subdirectory of the | |
|
172 | current directory including itself. | |
|
173 | foo/*.c any name ending in ".c" in the directory foo | |
|
174 | foo/**.c any name ending in ".c" in any subdirectory of foo | |
|
175 | including itself. | |
|
176 | ||
|
177 | Regexp examples:: | |
|
178 | ||
|
179 | re:.*\.c$ any name ending in ".c", anywhere in the repository | |
|
180 | ||
|
181 | ''')), | |
|
182 | ||
|
183 | (['environment', 'env'], _('Environment Variables'), | |
|
184 | _(r''' | |
|
185 | HG | |
|
186 | Path to the 'hg' executable, automatically passed when running | |
|
187 | hooks, extensions or external tools. If unset or empty, this is | |
|
188 | the hg executable's name if it's frozen, or an executable named | |
|
189 | 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on | |
|
190 | Windows) is searched. | |
|
191 | ||
|
192 | HGEDITOR | |
|
193 | This is the name of the editor to run when committing. See EDITOR. | |
|
194 | ||
|
195 | (deprecated, use .hgrc) | |
|
196 | ||
|
197 | HGENCODING | |
|
198 | This overrides the default locale setting detected by Mercurial. | |
|
199 | This setting is used to convert data including usernames, | |
|
200 | changeset descriptions, tag names, and branches. This setting can | |
|
201 | be overridden with the --encoding command-line option. | |
|
63 | def loaddoc(topic): | |
|
64 | """Return a delayed loader for help/topic.txt.""" | |
|
202 | 65 | |
|
203 | HGENCODINGMODE | |
|
204 | This sets Mercurial's behavior for handling unknown characters | |
|
205 | while transcoding user input. The default is "strict", which | |
|
206 | causes Mercurial to abort if it can't map a character. Other | |
|
207 | settings include "replace", which replaces unknown characters, and | |
|
208 | "ignore", which drops them. This setting can be overridden with | |
|
209 | the --encodingmode command-line option. | |
|
210 | ||
|
211 | HGMERGE | |
|
212 | An executable to use for resolving merge conflicts. The program | |
|
213 | will be executed with three arguments: local file, remote file, | |
|
214 | ancestor file. | |
|
215 | ||
|
216 | (deprecated, use .hgrc) | |
|
217 | ||
|
218 | HGRCPATH | |
|
219 | A list of files or directories to search for hgrc files. Item | |
|
220 | separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set, | |
|
221 | platform default search path is used. If empty, only the .hg/hgrc | |
|
222 | from the current repository is read. | |
|
223 | ||
|
224 | For each element in HGRCPATH: | |
|
225 | ||
|
226 | - if it's a directory, all files ending with .rc are added | |
|
227 | - otherwise, the file itself will be added | |
|
228 | ||
|
229 | HGUSER | |
|
230 | This is the string used as the author of a commit. If not set, | |
|
231 | available values will be considered in this order: | |
|
232 | ||
|
233 | - HGUSER (deprecated) | |
|
234 | - hgrc files from the HGRCPATH | |
|
235 | ||
|
236 | - interactive prompt | |
|
237 | - LOGNAME (with '@hostname' appended) | |
|
238 | ||
|
239 | (deprecated, use .hgrc) | |
|
240 | ||
|
241 | ||
|
242 | May be used as the author of a commit; see HGUSER. | |
|
243 | ||
|
244 | LOGNAME | |
|
245 | May be used as the author of a commit; see HGUSER. | |
|
246 | ||
|
247 | VISUAL | |
|
248 | This is the name of the editor to use when committing. See EDITOR. | |
|
249 | ||
|
250 | EDITOR | |
|
251 | Sometimes Mercurial needs to open a text file in an editor for a | |
|
252 | user to modify, for example when writing commit messages. The | |
|
253 | editor it uses is determined by looking at the environment | |
|
254 | variables HGEDITOR, VISUAL and EDITOR, in that order. The first | |
|
255 | non-empty one is chosen. If all of them are empty, the editor | |
|
256 | defaults to 'vi'. | |
|
257 | ||
|
258 | PYTHONPATH | |
|
259 | This is used by Python to find imported modules and may need to be | |
|
260 | set appropriately if this Mercurial is not installed system-wide. | |
|
261 | ''')), | |
|
262 | ||
|
263 | (['revs', 'revisions'], _('Specifying Single Revisions'), | |
|
264 | _(r''' | |
|
265 | Mercurial supports several ways to specify individual revisions. | |
|
266 | ||
|
267 | A plain integer is treated as a revision number. Negative integers | |
|
268 | are treated as sequential offsets from the tip, with -1 denoting | |
|
269 | the tip, -2 denoting the revision prior to the tip, and so forth. | |
|
270 | ||
|
271 | A 40-digit hexadecimal string is treated as a unique revision | |
|
272 | identifier. | |
|
273 | ||
|
274 | A hexadecimal string less than 40 characters long is treated as a | |
|
275 | unique revision identifier and is referred to as a short-form | |
|
276 | identifier. A short-form identifier is only valid if it is the | |
|
277 | prefix of exactly one full-length identifier. | |
|
278 | ||
|
279 | Any other string is treated as a tag or branch name. A tag name is | |
|
280 | a symbolic name associated with a revision identifier. A branch | |
|
281 | name denotes the tipmost revision of that branch. Tag and branch | |
|
282 | names must not contain the ":" character. | |
|
283 | ||
|
284 | The reserved name "tip" is a special tag that always identifies | |
|
285 | the most recent revision. | |
|
286 | ||
|
287 | The reserved name "null" indicates the null revision. This is the | |
|
288 | revision of an empty repository, and the parent of revision 0. | |
|
289 | ||
|
290 | The reserved name "." indicates the working directory parent. If | |
|
291 | no working directory is checked out, it is equivalent to null. If | |
|
292 | an uncommitted merge is in progress, "." is the revision of the | |
|
293 | first parent. | |
|
294 | ''')), | |
|
295 | ||
|
296 | (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'), | |
|
297 | _(r''' | |
|
298 | When Mercurial accepts more than one revision, they may be | |
|
299 | specified individually, or provided as a topologically continuous | |
|
300 | range, separated by the ":" character. | |
|
301 | ||
|
302 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END | |
|
303 | are revision identifiers. Both BEGIN and END are optional. If | |
|
304 | BEGIN is not specified, it defaults to revision number 0. If END | |
|
305 | is not specified, it defaults to the tip. The range ":" thus means | |
|
306 | "all revisions". | |
|
307 | ||
|
308 | If BEGIN is greater than END, revisions are treated in reverse | |
|
309 | order. | |
|
310 | ||
|
311 | A range acts as a closed interval. This means that a range of 3:5 | |
|
312 | gives 3, 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. | |
|
313 | ''')), | |
|
66 | def loader(): | |
|
67 | if hasattr(sys, 'frozen'): | |
|
68 | module = sys.executable | |
|
69 | else: | |
|
70 | module = __file__ | |
|
71 | base = os.path.dirname(module) | |
|
314 | 72 | |
|
315 | (['diffs'], _('Diff Formats'), | |
|
316 | _(r''' | |
|
317 | Mercurial's default format for showing changes between two | |
|
318 | versions of a file is compatible with the unified format of GNU | |
|
319 | diff, which can be used by GNU patch and many other standard | |
|
320 | tools. | |
|
321 | ||
|
322 | While this standard format is often enough, it does not encode the | |
|
323 | following information: | |
|
324 | ||
|
325 | - executable status and other permission bits | |
|
326 | - copy or rename information | |
|
327 | - changes in binary files | |
|
328 | - creation or deletion of empty files | |
|
329 | ||
|
330 | Mercurial also supports the extended diff format from the git VCS | |
|
331 | which addresses these limitations. The git diff format is not | |
|
332 | produced by default because a few widespread tools still do not | |
|
333 | understand this format. | |
|
334 | ||
|
335 | This means that when generating diffs from a Mercurial repository | |
|
336 | (e.g. with "hg export"), you should be careful about things like | |
|
337 | file copies and renames or other things mentioned above, because | |
|
338 | when applying a standard diff to a different repository, this | |
|
339 | extra information is lost. Mercurial's internal operations (like | |
|
340 | push and pull) are not affected by this, because they use an | |
|
341 | internal binary format for communicating changes. | |
|
342 | ||
|
343 | To make Mercurial produce the git extended diff format, use the | |
|
344 | --git option available for many commands, or set 'git = True' in | |
|
345 | the [diff] section of your hgrc. You do not need to set this | |
|
346 | option when importing diffs in this format or using them in the mq | |
|
347 | extension. | |
|
348 | ''')), | |
|
349 | (['templating', 'templates'], _('Template Usage'), | |
|
350 | _(r''' | |
|
351 | Mercurial allows you to customize output of commands through | |
|
352 | templates. You can either pass in a template from the command | |
|
353 | line, via the --template option, or select an existing | |
|
354 | template-style (--style). | |
|
355 | ||
|
356 | You can customize output for any "log-like" command: log, | |
|
357 | outgoing, incoming, tip, parents, heads and glog. | |
|
358 | ||
|
359 | Three styles are packaged with Mercurial: default (the style used | |
|
360 | when no explicit preference is passed), compact and changelog. | |
|
361 | Usage:: | |
|
73 | for dir in ('.', '..'): | |
|
74 | docdir = os.path.join(base, dir, 'help') | |
|
75 | if os.path.isdir(docdir): | |
|
76 | break | |
|
362 | 77 | |
|
363 | $ hg log -r1 --style changelog | |
|
364 | ||
|
365 | A template is a piece of text, with markup to invoke variable | |
|
366 | expansion:: | |
|
367 | ||
|
368 | $ hg log -r1 --template "{node}\n" | |
|
369 | b56ce7b07c52de7d5fd79fb89701ea538af65746 | |
|
370 | ||
|
371 | Strings in curly braces are called keywords. The availability of | |
|
372 | keywords depends on the exact context of the templater. These | |
|
373 | keywords are usually available for templating a log-like command: | |
|
374 | ||
|
375 | :author: String. The unmodified author of the changeset. | |
|
376 | :branches: String. The name of the branch on which the changeset | |
|
377 | was committed. Will be empty if the branch name was | |
|
378 | default. | |
|
379 | :date: Date information. The date when the changeset was | |
|
380 | committed. | |
|
381 | :desc: String. The text of the changeset description. | |
|
382 | :diffstat: String. Statistics of changes with the following | |
|
383 | format: "modified files: +added/-removed lines" | |
|
384 | :files: List of strings. All files modified, added, or removed | |
|
385 | by this changeset. | |
|
386 | :file_adds: List of strings. Files added by this changeset. | |
|
387 | :file_mods: List of strings. Files modified by this changeset. | |
|
388 | :file_dels: List of strings. Files removed by this changeset. | |
|
389 | :node: String. The changeset identification hash, as a | |
|
390 | 40-character hexadecimal string. | |
|
391 | :parents: List of strings. The parents of the changeset. | |
|
392 | :rev: Integer. The repository-local changeset revision | |
|
393 | number. | |
|
394 | :tags: List of strings. Any tags associated with the | |
|
395 | changeset. | |
|
396 | :latesttag: String. Most recent global tag in the ancestors of this | |
|
397 | changeset. | |
|
398 | :latesttagdistance: Integer. Longest path to the latest tag. | |
|
399 | ||
|
400 | The "date" keyword does not produce human-readable output. If you | |
|
401 | want to use a date in your output, you can use a filter to process | |
|
402 | it. Filters are functions which return a string based on the input | |
|
403 | variable. You can also use a chain of filters to get the desired | |
|
404 | output:: | |
|
405 | ||
|
406 | $ hg tip --template "{date|isodate}\n" | |
|
407 | 2008-08-21 18:22 +0000 | |
|
408 | ||
|
409 | List of filters: | |
|
78 | path = os.path.join(docdir, topic + ".txt") | |
|
79 | return gettext(open(path).read()) | |
|
80 | return loader | |
|
410 | 81 | |
|
411 | :addbreaks: Any text. Add an XHTML "<br />" tag before the end of | |
|
412 | every line except the last. | |
|
413 | :age: Date. Returns a human-readable date/time difference | |
|
414 | between the given date/time and the current | |
|
415 | date/time. | |
|
416 | :basename: Any text. Treats the text as a path, and returns the | |
|
417 | last component of the path after splitting by the | |
|
418 | path separator (ignoring trailing separators). For | |
|
419 | example, "foo/bar/baz" becomes "baz" and "foo/bar//" | |
|
420 | becomes "bar". | |
|
421 | :stripdir: Treat the text as path and strip a directory level, | |
|
422 | if possible. For example, "foo" and "foo/bar" becomes | |
|
423 | "foo". | |
|
424 | :date: Date. Returns a date in a Unix date format, including | |
|
425 | the timezone: "Mon Sep 04 15:13:13 2006 0700". | |
|
426 | :domain: Any text. Finds the first string that looks like an | |
|
427 | email address, and extracts just the domain | |
|
428 | component. Example: 'User <user@example.com>' becomes | |
|
429 | 'example.com'. | |
|
430 | :email: Any text. Extracts the first string that looks like | |
|
431 | an email address. Example: 'User <user@example.com>' | |
|
432 | becomes 'user@example.com'. | |
|
433 | :escape: Any text. Replaces the special XML/XHTML characters | |
|
434 | "&", "<" and ">" with XML entities. | |
|
435 | :fill68: Any text. Wraps the text to fit in 68 columns. | |
|
436 | :fill76: Any text. Wraps the text to fit in 76 columns. | |
|
437 | :firstline: Any text. Returns the first line of text. | |
|
438 | :nonempty: Any text. Returns '(none)' if the string is empty. | |
|
439 | :hgdate: Date. Returns the date as a pair of numbers: | |
|
440 | "1157407993 25200" (Unix timestamp, timezone offset). | |
|
441 | :isodate: Date. Returns the date in ISO 8601 format: | |
|
442 | "2009-08-18 13:00 +0200". | |
|
443 | :isodatesec: Date. Returns the date in ISO 8601 format, including | |
|
444 | seconds: "2009-08-18 13:00:13 +0200". See also the | |
|
445 | rfc3339date filter. | |
|
446 | :localdate: Date. Converts a date to local date. | |
|
447 | :obfuscate: Any text. Returns the input text rendered as a | |
|
448 | sequence of XML entities. | |
|
449 | :person: Any text. Returns the text before an email address. | |
|
450 | :rfc822date: Date. Returns a date using the same format used in | |
|
451 | email headers: "Tue, 18 Aug 2009 13:00:13 +0200". | |
|
452 | :rfc3339date: Date. Returns a date using the Internet date format | |
|
453 | specified in RFC 3339: "2009-08-18T13:00:13+02:00". | |
|
454 | :short: Changeset hash. Returns the short form of a changeset | |
|
455 | hash, i.e. a 12-byte hexadecimal string. | |
|
456 | :shortdate: Date. Returns a date like "2006-09-18". | |
|
457 | :strip: Any text. Strips all leading and trailing whitespace. | |
|
458 | :tabindent: Any text. Returns the text, with every line except | |
|
459 | the first starting with a tab character. | |
|
460 | :urlescape: Any text. Escapes all "special" characters. For | |
|
461 | example, "foo bar" becomes "foo%20bar". | |
|
462 | :user: Any text. Returns the user portion of an email | |
|
463 | address. | |
|
464 | ''')), | |
|
465 | ||
|
466 | (['urls'], _('URL Paths'), | |
|
467 | _(r''' | |
|
468 | Valid URLs are of the form:: | |
|
469 | ||
|
470 | local/filesystem/path[#revision] | |
|
471 | file://local/filesystem/path[#revision] | |
|
472 | http://[user[:pass]@]host[:port]/[path][#revision] | |
|
473 | https://[user[:pass]@]host[:port]/[path][#revision] | |
|
474 | ssh://[user[:pass]@]host[:port]/[path][#revision] | |
|
475 | ||
|
476 | Paths in the local filesystem can either point to Mercurial | |
|
477 | repositories or to bundle files (as created by 'hg bundle' or 'hg | |
|
478 | incoming --bundle'). | |
|
479 | ||
|
480 | An optional identifier after # indicates a particular branch, tag, | |
|
481 | or changeset to use from the remote repository. See also 'hg help | |
|
482 | revisions'. | |
|
483 | ||
|
484 | Some features, such as pushing to http:// and https:// URLs are | |
|
485 | only possible if the feature is explicitly enabled on the remote | |
|
486 | Mercurial server. | |
|
487 | ||
|
488 | Some notes about using SSH with Mercurial: | |
|
489 | ||
|
490 | - SSH requires an accessible shell account on the destination | |
|
491 | machine and a copy of hg in the remote path or specified with as | |
|
492 | remotecmd. | |
|
493 | - path is relative to the remote user's home directory by default. | |
|
494 | Use an extra slash at the start of a path to specify an absolute | |
|
495 | path:: | |
|
496 | ||
|
497 | ssh://example.com//tmp/repository | |
|
498 | ||
|
499 | - Mercurial doesn't use its own compression via SSH; the right | |
|
500 | thing to do is to configure it in your ~/.ssh/config, e.g.:: | |
|
501 | ||
|
502 | Host *.mylocalnetwork.example.com | |
|
503 | Compression no | |
|
504 | Host * | |
|
505 | Compression yes | |
|
506 | ||
|
507 | Alternatively specify "ssh -C" as your ssh command in your hgrc | |
|
508 | or with the --ssh command line option. | |
|
509 | ||
|
510 | These URLs can all be stored in your hgrc with path aliases under | |
|
511 | the [paths] section like so:: | |
|
512 | ||
|
513 | [paths] | |
|
514 | alias1 = URL1 | |
|
515 | alias2 = URL2 | |
|
516 | ... | |
|
517 | ||
|
518 | You can then use the alias for any command that uses a URL (for | |
|
519 | example 'hg pull alias1' would pull from the 'alias1' path). | |
|
520 | ||
|
521 | Two path aliases are special because they are used as defaults | |
|
522 | when you do not provide the URL to a command: | |
|
523 | ||
|
524 | default: | |
|
525 | When you create a repository with hg clone, the clone command | |
|
526 | saves the location of the source repository as the new | |
|
527 | repository's 'default' path. This is then used when you omit | |
|
528 | path from push- and pull-like commands (including incoming and | |
|
529 | outgoing). | |
|
530 | ||
|
531 | default-push: | |
|
532 | The push command will look for a path named 'default-push', and | |
|
533 | prefer it over 'default' if both are defined. | |
|
534 | ''')), | |
|
82 | helptable = ( | |
|
83 | (["dates"], _("Date Formats"), loaddoc('dates')), | |
|
84 | (["patterns"], _("File Name Patterns"), loaddoc('patterns')), | |
|
85 | (['environment', 'env'], _('Environment Variables'), loaddoc('environment')), | |
|
86 | (['revs', 'revisions'], _('Specifying Single Revisions'), loaddoc('revisions')), | |
|
87 | (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'), loaddoc('multirevs')), | |
|
88 | (['diffs'], _('Diff Formats'), loaddoc('diffs')), | |
|
89 | (['templating', 'templates'], _('Template Usage'), loaddoc('templates')), | |
|
90 | (['urls'], _('URL Paths'), loaddoc('urls')), | |
|
535 | 91 | (["extensions"], _("Using additional features"), extshelp), |
|
536 | 92 | ) |
@@ -1,273 +1,273 | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # |
|
3 | 3 | # This is the mercurial setup script. |
|
4 | 4 | # |
|
5 | 5 | # 'python setup.py install', or |
|
6 | 6 | # 'python setup.py --help' for more options |
|
7 | 7 | |
|
8 | 8 | import sys |
|
9 | 9 | if not hasattr(sys, 'version_info') or sys.version_info < (2, 4, 0, 'final'): |
|
10 | 10 | raise SystemExit("Mercurial requires Python 2.4 or later.") |
|
11 | 11 | |
|
12 | 12 | # Solaris Python packaging brain damage |
|
13 | 13 | try: |
|
14 | 14 | import hashlib |
|
15 | 15 | sha = hashlib.sha1() |
|
16 | 16 | except: |
|
17 | 17 | try: |
|
18 | 18 | import sha |
|
19 | 19 | except: |
|
20 | 20 | raise SystemExit( |
|
21 | 21 | "Couldn't import standard hashlib (incomplete Python install).") |
|
22 | 22 | |
|
23 | 23 | try: |
|
24 | 24 | import zlib |
|
25 | 25 | except: |
|
26 | 26 | raise SystemExit( |
|
27 | 27 | "Couldn't import standard zlib (incomplete Python install).") |
|
28 | 28 | |
|
29 | 29 | import os, subprocess, time |
|
30 | 30 | import shutil |
|
31 | 31 | import tempfile |
|
32 | 32 | from distutils.core import setup, Extension |
|
33 | 33 | from distutils.dist import Distribution |
|
34 | 34 | from distutils.command.install_data import install_data |
|
35 | 35 | from distutils.command.build import build |
|
36 | 36 | from distutils.command.build_py import build_py |
|
37 | 37 | from distutils.spawn import spawn, find_executable |
|
38 | 38 | from distutils.ccompiler import new_compiler |
|
39 | 39 | |
|
40 | 40 | extra = {} |
|
41 | 41 | scripts = ['hg'] |
|
42 | 42 | if os.name == 'nt': |
|
43 | 43 | scripts.append('contrib/win32/hg.bat') |
|
44 | 44 | |
|
45 | 45 | # simplified version of distutils.ccompiler.CCompiler.has_function |
|
46 | 46 | # that actually removes its temporary files. |
|
47 | 47 | def has_function(cc, funcname): |
|
48 | 48 | tmpdir = tempfile.mkdtemp(prefix='hg-install-') |
|
49 | 49 | devnull = oldstderr = None |
|
50 | 50 | try: |
|
51 | 51 | try: |
|
52 | 52 | fname = os.path.join(tmpdir, 'funcname.c') |
|
53 | 53 | f = open(fname, 'w') |
|
54 | 54 | f.write('int main(void) {\n') |
|
55 | 55 | f.write(' %s();\n' % funcname) |
|
56 | 56 | f.write('}\n') |
|
57 | 57 | f.close() |
|
58 | 58 | # Redirect stderr to /dev/null to hide any error messages |
|
59 | 59 | # from the compiler. |
|
60 | 60 | # This will have to be changed if we ever have to check |
|
61 | 61 | # for a function on Windows. |
|
62 | 62 | devnull = open('/dev/null', 'w') |
|
63 | 63 | oldstderr = os.dup(sys.stderr.fileno()) |
|
64 | 64 | os.dup2(devnull.fileno(), sys.stderr.fileno()) |
|
65 | 65 | objects = cc.compile([fname], output_dir=tmpdir) |
|
66 | 66 | cc.link_executable(objects, os.path.join(tmpdir, "a.out")) |
|
67 | 67 | except: |
|
68 | 68 | return False |
|
69 | 69 | return True |
|
70 | 70 | finally: |
|
71 | 71 | if oldstderr is not None: |
|
72 | 72 | os.dup2(oldstderr, sys.stderr.fileno()) |
|
73 | 73 | if devnull is not None: |
|
74 | 74 | devnull.close() |
|
75 | 75 | shutil.rmtree(tmpdir) |
|
76 | 76 | |
|
77 | 77 | # py2exe needs to be installed to work |
|
78 | 78 | try: |
|
79 | 79 | import py2exe |
|
80 | 80 | |
|
81 | 81 | # Help py2exe to find win32com.shell |
|
82 | 82 | try: |
|
83 | 83 | import modulefinder |
|
84 | 84 | import win32com |
|
85 | 85 | for p in win32com.__path__[1:]: # Take the path to win32comext |
|
86 | 86 | modulefinder.AddPackagePath("win32com", p) |
|
87 | 87 | pn = "win32com.shell" |
|
88 | 88 | __import__(pn) |
|
89 | 89 | m = sys.modules[pn] |
|
90 | 90 | for p in m.__path__[1:]: |
|
91 | 91 | modulefinder.AddPackagePath(pn, p) |
|
92 | 92 | except ImportError: |
|
93 | 93 | pass |
|
94 | 94 | |
|
95 | 95 | extra['console'] = ['hg'] |
|
96 | 96 | |
|
97 | 97 | except ImportError: |
|
98 | 98 | pass |
|
99 | 99 | |
|
100 | 100 | version = None |
|
101 | 101 | |
|
102 | 102 | if os.path.isdir('.hg'): |
|
103 | 103 | # Execute hg out of this directory with a custom environment which |
|
104 | 104 | # includes the pure Python modules in mercurial/pure. We also take |
|
105 | 105 | # care to not use any hgrc files and do no localization. |
|
106 | 106 | pypath = ['mercurial', os.path.join('mercurial', 'pure')] |
|
107 | 107 | env = {'PYTHONPATH': os.pathsep.join(pypath), |
|
108 | 108 | 'HGRCPATH': '', |
|
109 | 109 | 'LANGUAGE': 'C'} |
|
110 | 110 | if 'SystemRoot' in os.environ: |
|
111 | 111 | # Copy SystemRoot into the custom environment for Python 2.6 |
|
112 | 112 | # under Windows. Otherwise, the subprocess will fail with |
|
113 | 113 | # error 0xc0150004. See: http://bugs.python.org/issue3440 |
|
114 | 114 | env['SystemRoot'] = os.environ['SystemRoot'] |
|
115 | 115 | cmd = [sys.executable, 'hg', 'id', '-i', '-t'] |
|
116 | 116 | |
|
117 | 117 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
|
118 | 118 | stderr=subprocess.PIPE, env=env) |
|
119 | 119 | out, err = p.communicate() |
|
120 | 120 | |
|
121 | 121 | # If root is executing setup.py, but the repository is owned by |
|
122 | 122 | # another user (as in "sudo python setup.py install") we will get |
|
123 | 123 | # trust warnings since the .hg/hgrc file is untrusted. That is |
|
124 | 124 | # fine, we don't want to load it anyway. |
|
125 | 125 | err = [e for e in err.splitlines() |
|
126 | 126 | if not e.startswith('Not trusting file')] |
|
127 | 127 | if err: |
|
128 | 128 | sys.stderr.write('warning: could not establish Mercurial ' |
|
129 | 129 | 'version:\n%s\n' % '\n'.join(err)) |
|
130 | 130 | else: |
|
131 | 131 | l = out.split() |
|
132 | 132 | while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags |
|
133 | 133 | l.pop() |
|
134 | 134 | if l: |
|
135 | 135 | version = l[-1] # latest tag or revision number |
|
136 | 136 | if version.endswith('+'): |
|
137 | 137 | version += time.strftime('%Y%m%d') |
|
138 | 138 | elif os.path.exists('.hg_archival.txt'): |
|
139 | 139 | hgarchival = open('.hg_archival.txt') |
|
140 | 140 | for line in hgarchival: |
|
141 | 141 | if line.startswith('node:'): |
|
142 | 142 | version = line.split(':')[1].strip()[:12] |
|
143 | 143 | break |
|
144 | 144 | |
|
145 | 145 | if version: |
|
146 | 146 | f = open("mercurial/__version__.py", "w") |
|
147 | 147 | f.write('# this file is autogenerated by setup.py\n') |
|
148 | 148 | f.write('version = "%s"\n' % version) |
|
149 | 149 | f.close() |
|
150 | 150 | |
|
151 | 151 | |
|
152 | 152 | try: |
|
153 | 153 | from mercurial import __version__ |
|
154 | 154 | version = __version__.version |
|
155 | 155 | except ImportError: |
|
156 | 156 | version = 'unknown' |
|
157 | 157 | |
|
158 | 158 | class install_package_data(install_data): |
|
159 | 159 | def finalize_options(self): |
|
160 | 160 | self.set_undefined_options('install', |
|
161 | 161 | ('install_lib', 'install_dir')) |
|
162 | 162 | install_data.finalize_options(self) |
|
163 | 163 | |
|
164 | 164 | class build_mo(build): |
|
165 | 165 | |
|
166 | 166 | description = "build translations (.mo files)" |
|
167 | 167 | |
|
168 | 168 | def run(self): |
|
169 | 169 | if not find_executable('msgfmt'): |
|
170 | 170 | self.warn("could not find msgfmt executable, no translations " |
|
171 | 171 | "will be built") |
|
172 | 172 | return |
|
173 | 173 | |
|
174 | 174 | podir = 'i18n' |
|
175 | 175 | if not os.path.isdir(podir): |
|
176 | 176 | self.warn("could not find %s/ directory" % podir) |
|
177 | 177 | return |
|
178 | 178 | |
|
179 | 179 | join = os.path.join |
|
180 | 180 | for po in os.listdir(podir): |
|
181 | 181 | if not po.endswith('.po'): |
|
182 | 182 | continue |
|
183 | 183 | pofile = join(podir, po) |
|
184 | 184 | modir = join('locale', po[:-3], 'LC_MESSAGES') |
|
185 | 185 | mofile = join(modir, 'hg.mo') |
|
186 | 186 | cmd = ['msgfmt', '-v', '-o', mofile, pofile] |
|
187 | 187 | if sys.platform != 'sunos5': |
|
188 | 188 | # msgfmt on Solaris does not know about -c |
|
189 | 189 | cmd.append('-c') |
|
190 | 190 | self.mkpath(modir) |
|
191 | 191 | self.make_file([pofile], mofile, spawn, (cmd,)) |
|
192 | 192 | self.distribution.data_files.append((join('mercurial', modir), |
|
193 | 193 | [mofile])) |
|
194 | 194 | |
|
195 | 195 | build.sub_commands.append(('build_mo', None)) |
|
196 | 196 | |
|
197 | 197 | Distribution.pure = 0 |
|
198 | 198 | Distribution.global_options.append(('pure', None, "use pure (slow) Python " |
|
199 | 199 | "code instead of C extensions")) |
|
200 | 200 | |
|
201 | 201 | class hg_build_py(build_py): |
|
202 | 202 | |
|
203 | 203 | def finalize_options(self): |
|
204 | 204 | build_py.finalize_options(self) |
|
205 | 205 | |
|
206 | 206 | if self.distribution.pure: |
|
207 | 207 | if self.py_modules is None: |
|
208 | 208 | self.py_modules = [] |
|
209 | 209 | for ext in self.distribution.ext_modules: |
|
210 | 210 | if ext.name.startswith("mercurial."): |
|
211 | 211 | self.py_modules.append("mercurial.pure.%s" % ext.name[10:]) |
|
212 | 212 | self.distribution.ext_modules = [] |
|
213 | 213 | |
|
214 | 214 | def find_modules(self): |
|
215 | 215 | modules = build_py.find_modules(self) |
|
216 | 216 | for module in modules: |
|
217 | 217 | if module[0] == "mercurial.pure": |
|
218 | 218 | if module[1] != "__init__": |
|
219 | 219 | yield ("mercurial", module[1], module[2]) |
|
220 | 220 | else: |
|
221 | 221 | yield module |
|
222 | 222 | |
|
223 | 223 | cmdclass = {'install_data': install_package_data, |
|
224 | 224 | 'build_mo': build_mo, |
|
225 | 225 | 'build_py': hg_build_py} |
|
226 | 226 | |
|
227 | 227 | ext_modules=[ |
|
228 | 228 | Extension('mercurial.base85', ['mercurial/base85.c']), |
|
229 | 229 | Extension('mercurial.bdiff', ['mercurial/bdiff.c']), |
|
230 | 230 | Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']), |
|
231 | 231 | Extension('mercurial.mpatch', ['mercurial/mpatch.c']), |
|
232 | 232 | Extension('mercurial.parsers', ['mercurial/parsers.c']), |
|
233 | 233 | Extension('mercurial.osutil', ['mercurial/osutil.c']), |
|
234 | 234 | ] |
|
235 | 235 | |
|
236 | 236 | packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert', |
|
237 | 237 | 'hgext.highlight', 'hgext.zeroconf', ] |
|
238 | 238 | |
|
239 | 239 | if sys.platform == 'linux2' and os.uname()[2] > '2.6': |
|
240 | 240 | # The inotify extension is only usable with Linux 2.6 kernels. |
|
241 | 241 | # You also need a reasonably recent C library. |
|
242 | 242 | cc = new_compiler() |
|
243 | 243 | if has_function(cc, 'inotify_add_watch'): |
|
244 | 244 | ext_modules.append(Extension('hgext.inotify.linux._inotify', |
|
245 | 245 | ['hgext/inotify/linux/_inotify.c'])) |
|
246 | 246 | packages.extend(['hgext.inotify', 'hgext.inotify.linux']) |
|
247 | 247 | |
|
248 | 248 | datafiles = [] |
|
249 | for root in ('templates', 'i18n'): | |
|
249 | for root in ('templates', 'i18n', 'help'): | |
|
250 | 250 | for dir, dirs, files in os.walk(root): |
|
251 | 251 | dirs[:] = [x for x in dirs if not x.startswith('.')] |
|
252 | 252 | files = [x for x in files if not x.startswith('.')] |
|
253 | 253 | datafiles.append((os.path.join('mercurial', dir), |
|
254 | 254 | [os.path.join(dir, file_) for file_ in files])) |
|
255 | 255 | |
|
256 | 256 | setup(name='mercurial', |
|
257 | 257 | version=version, |
|
258 | 258 | author='Matt Mackall', |
|
259 | 259 | author_email='mpm@selenic.com', |
|
260 | 260 | url='http://mercurial.selenic.com/', |
|
261 | 261 | description='Scalable distributed SCM', |
|
262 | 262 | license='GNU GPL', |
|
263 | 263 | scripts=scripts, |
|
264 | 264 | packages=packages, |
|
265 | 265 | ext_modules=ext_modules, |
|
266 | 266 | data_files=datafiles, |
|
267 | 267 | cmdclass=cmdclass, |
|
268 | 268 | options=dict(py2exe=dict(packages=['hgext', 'email']), |
|
269 | 269 | bdist_mpkg=dict(zipdist=True, |
|
270 | 270 | license='COPYING', |
|
271 | 271 | readme='contrib/macosx/Readme.html', |
|
272 | 272 | welcome='contrib/macosx/Welcome.html')), |
|
273 | 273 | **extra) |
General Comments 0
You need to be logged in to leave comments.
Login now