##// END OF EJS Templates
doc: unify section level between help topics...
FUJIWARA Katsunori -
r17267:979b107e stable
parent child Browse files
Show More
@@ -1,168 +1,168 b''
1 import os, sys, textwrap
1 import os, sys, textwrap
2 # import from the live mercurial repo
2 # import from the live mercurial repo
3 sys.path.insert(0, "..")
3 sys.path.insert(0, "..")
4 # fall back to pure modules if required C extensions are not available
4 # fall back to pure modules if required C extensions are not available
5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
6 from mercurial import demandimport; demandimport.enable()
6 from mercurial import demandimport; demandimport.enable()
7 from mercurial import encoding
7 from mercurial import encoding
8 from mercurial.commands import table, globalopts
8 from mercurial.commands import table, globalopts
9 from mercurial.i18n import _
9 from mercurial.i18n import _
10 from mercurial.help import helptable
10 from mercurial.help import helptable
11 from mercurial import extensions
11 from mercurial import extensions
12 from mercurial import util
12 from mercurial import util
13
13
14 def get_desc(docstr):
14 def get_desc(docstr):
15 if not docstr:
15 if not docstr:
16 return "", ""
16 return "", ""
17 # sanitize
17 # sanitize
18 docstr = docstr.strip("\n")
18 docstr = docstr.strip("\n")
19 docstr = docstr.rstrip()
19 docstr = docstr.rstrip()
20 shortdesc = docstr.splitlines()[0].strip()
20 shortdesc = docstr.splitlines()[0].strip()
21
21
22 i = docstr.find("\n")
22 i = docstr.find("\n")
23 if i != -1:
23 if i != -1:
24 desc = docstr[i + 2:]
24 desc = docstr[i + 2:]
25 else:
25 else:
26 desc = shortdesc
26 desc = shortdesc
27
27
28 desc = textwrap.dedent(desc)
28 desc = textwrap.dedent(desc)
29
29
30 return (shortdesc, desc)
30 return (shortdesc, desc)
31
31
32 def get_opts(opts):
32 def get_opts(opts):
33 for opt in opts:
33 for opt in opts:
34 if len(opt) == 5:
34 if len(opt) == 5:
35 shortopt, longopt, default, desc, optlabel = opt
35 shortopt, longopt, default, desc, optlabel = opt
36 else:
36 else:
37 shortopt, longopt, default, desc = opt
37 shortopt, longopt, default, desc = opt
38 allopts = []
38 allopts = []
39 if shortopt:
39 if shortopt:
40 allopts.append("-%s" % shortopt)
40 allopts.append("-%s" % shortopt)
41 if longopt:
41 if longopt:
42 allopts.append("--%s" % longopt)
42 allopts.append("--%s" % longopt)
43 desc += default and _(" (default: %s)") % default or ""
43 desc += default and _(" (default: %s)") % default or ""
44 yield (", ".join(allopts), desc)
44 yield (", ".join(allopts), desc)
45
45
46 def get_cmd(cmd, cmdtable):
46 def get_cmd(cmd, cmdtable):
47 d = {}
47 d = {}
48 attr = cmdtable[cmd]
48 attr = cmdtable[cmd]
49 cmds = cmd.lstrip("^").split("|")
49 cmds = cmd.lstrip("^").split("|")
50
50
51 d['cmd'] = cmds[0]
51 d['cmd'] = cmds[0]
52 d['aliases'] = cmd.split("|")[1:]
52 d['aliases'] = cmd.split("|")[1:]
53 d['desc'] = get_desc(attr[0].__doc__)
53 d['desc'] = get_desc(attr[0].__doc__)
54 d['opts'] = list(get_opts(attr[1]))
54 d['opts'] = list(get_opts(attr[1]))
55
55
56 s = 'hg ' + cmds[0]
56 s = 'hg ' + cmds[0]
57 if len(attr) > 2:
57 if len(attr) > 2:
58 if not attr[2].startswith('hg'):
58 if not attr[2].startswith('hg'):
59 s += ' ' + attr[2]
59 s += ' ' + attr[2]
60 else:
60 else:
61 s = attr[2]
61 s = attr[2]
62 d['synopsis'] = s.strip()
62 d['synopsis'] = s.strip()
63
63
64 return d
64 return d
65
65
66 def section(ui, s):
66 def section(ui, s):
67 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
67 ui.write("%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s)))
68
68
69 def subsection(ui, s):
69 def subsection(ui, s):
70 ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s)))
70 ui.write("%s\n%s\n\n" % (s, '=' * encoding.colwidth(s)))
71
71
72 def subsubsection(ui, s):
72 def subsubsection(ui, s):
73 ui.write("%s\n%s\n\n" % (s, "." * encoding.colwidth(s)))
73 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
74
74
75 def subsubsubsection(ui, s):
75 def subsubsubsection(ui, s):
76 ui.write("%s\n%s\n\n" % (s, "#" * encoding.colwidth(s)))
76 ui.write("%s\n%s\n\n" % (s, "." * encoding.colwidth(s)))
77
77
78
78
79 def show_doc(ui):
79 def show_doc(ui):
80 # print options
80 # print options
81 section(ui, _("Options"))
81 section(ui, _("Options"))
82 for optstr, desc in get_opts(globalopts):
82 for optstr, desc in get_opts(globalopts):
83 ui.write("%s\n %s\n\n" % (optstr, desc))
83 ui.write("%s\n %s\n\n" % (optstr, desc))
84
84
85 # print cmds
85 # print cmds
86 section(ui, _("Commands"))
86 section(ui, _("Commands"))
87 commandprinter(ui, table, subsection)
87 commandprinter(ui, table, subsection)
88
88
89 # print topics
89 # print topics
90 for names, sec, doc in helptable:
90 for names, sec, doc in helptable:
91 if names[0] == "config":
91 if names[0] == "config":
92 # The config help topic is included in the hgrc.5 man
92 # The config help topic is included in the hgrc.5 man
93 # page.
93 # page.
94 continue
94 continue
95 for name in names:
95 for name in names:
96 ui.write(".. _%s:\n" % name)
96 ui.write(".. _%s:\n" % name)
97 ui.write("\n")
97 ui.write("\n")
98 section(ui, sec)
98 section(ui, sec)
99 if util.safehasattr(doc, '__call__'):
99 if util.safehasattr(doc, '__call__'):
100 doc = doc()
100 doc = doc()
101 ui.write(doc)
101 ui.write(doc)
102 ui.write("\n")
102 ui.write("\n")
103
103
104 section(ui, _("Extensions"))
104 section(ui, _("Extensions"))
105 ui.write(_("This section contains help for extensions that are "
105 ui.write(_("This section contains help for extensions that are "
106 "distributed together with Mercurial. Help for other "
106 "distributed together with Mercurial. Help for other "
107 "extensions is available in the help system."))
107 "extensions is available in the help system."))
108 ui.write("\n\n"
108 ui.write("\n\n"
109 ".. contents::\n"
109 ".. contents::\n"
110 " :class: htmlonly\n"
110 " :class: htmlonly\n"
111 " :local:\n"
111 " :local:\n"
112 " :depth: 1\n\n")
112 " :depth: 1\n\n")
113
113
114 for extensionname in sorted(allextensionnames()):
114 for extensionname in sorted(allextensionnames()):
115 mod = extensions.load(None, extensionname, None)
115 mod = extensions.load(None, extensionname, None)
116 subsection(ui, extensionname)
116 subsection(ui, extensionname)
117 ui.write("%s\n\n" % mod.__doc__)
117 ui.write("%s\n\n" % mod.__doc__)
118 cmdtable = getattr(mod, 'cmdtable', None)
118 cmdtable = getattr(mod, 'cmdtable', None)
119 if cmdtable:
119 if cmdtable:
120 subsubsection(ui, _('Commands'))
120 subsubsection(ui, _('Commands'))
121 commandprinter(ui, cmdtable, subsubsubsection)
121 commandprinter(ui, cmdtable, subsubsubsection)
122
122
123 def commandprinter(ui, cmdtable, sectionfunc):
123 def commandprinter(ui, cmdtable, sectionfunc):
124 h = {}
124 h = {}
125 for c, attr in cmdtable.items():
125 for c, attr in cmdtable.items():
126 f = c.split("|")[0]
126 f = c.split("|")[0]
127 f = f.lstrip("^")
127 f = f.lstrip("^")
128 h[f] = c
128 h[f] = c
129 cmds = h.keys()
129 cmds = h.keys()
130 cmds.sort()
130 cmds.sort()
131
131
132 for f in cmds:
132 for f in cmds:
133 if f.startswith("debug"):
133 if f.startswith("debug"):
134 continue
134 continue
135 d = get_cmd(h[f], cmdtable)
135 d = get_cmd(h[f], cmdtable)
136 sectionfunc(ui, d['cmd'])
136 sectionfunc(ui, d['cmd'])
137 # synopsis
137 # synopsis
138 ui.write("::\n\n")
138 ui.write("::\n\n")
139 synopsislines = d['synopsis'].splitlines()
139 synopsislines = d['synopsis'].splitlines()
140 for line in synopsislines:
140 for line in synopsislines:
141 # some commands (such as rebase) have a multi-line
141 # some commands (such as rebase) have a multi-line
142 # synopsis
142 # synopsis
143 ui.write(" %s\n" % line)
143 ui.write(" %s\n" % line)
144 ui.write('\n')
144 ui.write('\n')
145 # description
145 # description
146 ui.write("%s\n\n" % d['desc'][1])
146 ui.write("%s\n\n" % d['desc'][1])
147 # options
147 # options
148 opt_output = list(d['opts'])
148 opt_output = list(d['opts'])
149 if opt_output:
149 if opt_output:
150 opts_len = max([len(line[0]) for line in opt_output])
150 opts_len = max([len(line[0]) for line in opt_output])
151 ui.write(_("Options:\n\n"))
151 ui.write(_("Options:\n\n"))
152 for optstr, desc in opt_output:
152 for optstr, desc in opt_output:
153 if desc:
153 if desc:
154 s = "%-*s %s" % (opts_len, optstr, desc)
154 s = "%-*s %s" % (opts_len, optstr, desc)
155 else:
155 else:
156 s = optstr
156 s = optstr
157 ui.write("%s\n" % s)
157 ui.write("%s\n" % s)
158 ui.write("\n")
158 ui.write("\n")
159 # aliases
159 # aliases
160 if d['aliases']:
160 if d['aliases']:
161 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
161 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
162
162
163
163
164 def allextensionnames():
164 def allextensionnames():
165 return extensions.enabled().keys() + extensions.disabled().keys()
165 return extensions.enabled().keys() + extensions.disabled().keys()
166
166
167 if __name__ == "__main__":
167 if __name__ == "__main__":
168 show_doc(sys.stdout)
168 show_doc(sys.stdout)
@@ -1,119 +1,119 b''
1 ====
1 ====
2 hg
2 hg
3 ====
3 ====
4
4
5 ---------------------------------------
5 ---------------------------------------
6 Mercurial source code management system
6 Mercurial source code management system
7 ---------------------------------------
7 ---------------------------------------
8
8
9 :Author: Matt Mackall <mpm@selenic.com>
9 :Author: Matt Mackall <mpm@selenic.com>
10 :Organization: Mercurial
10 :Organization: Mercurial
11 :Manual section: 1
11 :Manual section: 1
12 :Manual group: Mercurial Manual
12 :Manual group: Mercurial Manual
13
13
14 .. contents::
14 .. contents::
15 :backlinks: top
15 :backlinks: top
16 :class: htmlonly
16 :class: htmlonly
17 :depth: 1
17 :depth: 1
18
18
19
19
20 Synopsis
20 Synopsis
21 --------
21 """"""""
22 **hg** *command* [*option*]... [*argument*]...
22 **hg** *command* [*option*]... [*argument*]...
23
23
24 Description
24 Description
25 -----------
25 """""""""""
26 The **hg** command provides a command line interface to the Mercurial
26 The **hg** command provides a command line interface to the Mercurial
27 system.
27 system.
28
28
29 Command Elements
29 Command Elements
30 ----------------
30 """"""""""""""""
31
31
32 files...
32 files...
33 indicates one or more filename or relative path filenames; see
33 indicates one or more filename or relative path filenames; see
34 `File Name Patterns`_ for information on pattern matching
34 `File Name Patterns`_ for information on pattern matching
35
35
36 path
36 path
37 indicates a path on the local machine
37 indicates a path on the local machine
38
38
39 revision
39 revision
40 indicates a changeset which can be specified as a changeset
40 indicates a changeset which can be specified as a changeset
41 revision number, a tag, or a unique substring of the changeset
41 revision number, a tag, or a unique substring of the changeset
42 hash value
42 hash value
43
43
44 repository path
44 repository path
45 either the pathname of a local repository or the URI of a remote
45 either the pathname of a local repository or the URI of a remote
46 repository.
46 repository.
47
47
48 .. include:: hg.1.gendoc.txt
48 .. include:: hg.1.gendoc.txt
49
49
50 Files
50 Files
51 -----
51 """""
52
52
53 ``/etc/mercurial/hgrc``, ``$HOME/.hgrc``, ``.hg/hgrc``
53 ``/etc/mercurial/hgrc``, ``$HOME/.hgrc``, ``.hg/hgrc``
54 This file contains defaults and configuration. Values in
54 This file contains defaults and configuration. Values in
55 ``.hg/hgrc`` override those in ``$HOME/.hgrc``, and these override
55 ``.hg/hgrc`` override those in ``$HOME/.hgrc``, and these override
56 settings made in the global ``/etc/mercurial/hgrc`` configuration.
56 settings made in the global ``/etc/mercurial/hgrc`` configuration.
57 See |hgrc(5)|_ for details of the contents and format of these
57 See |hgrc(5)|_ for details of the contents and format of these
58 files.
58 files.
59
59
60 ``.hgignore``
60 ``.hgignore``
61 This file contains regular expressions (one per line) that
61 This file contains regular expressions (one per line) that
62 describe file names that should be ignored by **hg**. For details,
62 describe file names that should be ignored by **hg**. For details,
63 see |hgignore(5)|_.
63 see |hgignore(5)|_.
64
64
65 ``.hgsub``
65 ``.hgsub``
66 This file defines the locations of all subrepositories, and
66 This file defines the locations of all subrepositories, and
67 tells where the subrepository checkouts came from. For details, see
67 tells where the subrepository checkouts came from. For details, see
68 :hg:`help subrepos`.
68 :hg:`help subrepos`.
69
69
70 ``.hgsubstate``
70 ``.hgsubstate``
71 This file is where Mercurial stores all nested repository states. *NB: This
71 This file is where Mercurial stores all nested repository states. *NB: This
72 file should not be edited manually.*
72 file should not be edited manually.*
73
73
74 ``.hgtags``
74 ``.hgtags``
75 This file contains changeset hash values and text tag names (one
75 This file contains changeset hash values and text tag names (one
76 of each separated by spaces) that correspond to tagged versions of
76 of each separated by spaces) that correspond to tagged versions of
77 the repository contents. The file content is encoded using UTF-8.
77 the repository contents. The file content is encoded using UTF-8.
78
78
79 ``.hg/last-message.txt``
79 ``.hg/last-message.txt``
80 This file is used by :hg:`commit` to store a backup of the commit message
80 This file is used by :hg:`commit` to store a backup of the commit message
81 in case the commit fails.
81 in case the commit fails.
82
82
83 ``.hg/localtags``
83 ``.hg/localtags``
84 This file can be used to define local tags which are not shared among
84 This file can be used to define local tags which are not shared among
85 repositories. The file format is the same as for ``.hgtags``, but it is
85 repositories. The file format is the same as for ``.hgtags``, but it is
86 encoded using the local system encoding.
86 encoded using the local system encoding.
87
87
88 Some commands (e.g. revert) produce backup files ending in ``.orig``,
88 Some commands (e.g. revert) produce backup files ending in ``.orig``,
89 if the ``.orig`` file already exists and is not tracked by Mercurial,
89 if the ``.orig`` file already exists and is not tracked by Mercurial,
90 it will be overwritten.
90 it will be overwritten.
91
91
92 Bugs
92 Bugs
93 ----
93 """"
94 Probably lots, please post them to the mailing list (see Resources_
94 Probably lots, please post them to the mailing list (see Resources_
95 below) when you find them.
95 below) when you find them.
96
96
97 See Also
97 See Also
98 --------
98 """"""""
99 |hgignore(5)|_, |hgrc(5)|_
99 |hgignore(5)|_, |hgrc(5)|_
100
100
101 Author
101 Author
102 ------
102 """"""
103 Written by Matt Mackall <mpm@selenic.com>
103 Written by Matt Mackall <mpm@selenic.com>
104
104
105 Resources
105 Resources
106 ---------
106 """""""""
107 Main Web Site: http://mercurial.selenic.com/
107 Main Web Site: http://mercurial.selenic.com/
108
108
109 Source code repository: http://selenic.com/hg
109 Source code repository: http://selenic.com/hg
110
110
111 Mailing list: http://selenic.com/mailman/listinfo/mercurial
111 Mailing list: http://selenic.com/mailman/listinfo/mercurial
112
112
113 Copying
113 Copying
114 -------
114 """""""
115 Copyright (C) 2005-2012 Matt Mackall.
115 Copyright (C) 2005-2012 Matt Mackall.
116 Free use of this software is granted under the terms of the GNU General
116 Free use of this software is granted under the terms of the GNU General
117 Public License version 2 or any later version.
117 Public License version 2 or any later version.
118
118
119 .. include:: common.txt
119 .. include:: common.txt
@@ -1,34 +1,34 b''
1 ==========
1 ==========
2 hgignore
2 hgignore
3 ==========
3 ==========
4
4
5 ---------------------------------
5 ---------------------------------
6 syntax for Mercurial ignore files
6 syntax for Mercurial ignore files
7 ---------------------------------
7 ---------------------------------
8
8
9 :Author: Vadim Gelfer <vadim.gelfer@gmail.com>
9 :Author: Vadim Gelfer <vadim.gelfer@gmail.com>
10 :Organization: Mercurial
10 :Organization: Mercurial
11 :Manual section: 5
11 :Manual section: 5
12 :Manual group: Mercurial Manual
12 :Manual group: Mercurial Manual
13
13
14 .. include:: ../mercurial/help/hgignore.txt
14 .. include:: ../mercurial/help/hgignore.txt
15
15
16 Author
16 Author
17 ------
17 ======
18 Vadim Gelfer <vadim.gelfer@gmail.com>
18 Vadim Gelfer <vadim.gelfer@gmail.com>
19
19
20 Mercurial was written by Matt Mackall <mpm@selenic.com>.
20 Mercurial was written by Matt Mackall <mpm@selenic.com>.
21
21
22 See Also
22 See Also
23 --------
23 ========
24 |hg(1)|_, |hgrc(5)|_
24 |hg(1)|_, |hgrc(5)|_
25
25
26 Copying
26 Copying
27 -------
27 =======
28 This manual page is copyright 2006 Vadim Gelfer.
28 This manual page is copyright 2006 Vadim Gelfer.
29 Mercurial is copyright 2005-2012 Matt Mackall.
29 Mercurial is copyright 2005-2012 Matt Mackall.
30 Free use of this software is granted under the terms of the GNU General
30 Free use of this software is granted under the terms of the GNU General
31 Public License version 2 or any later version.
31 Public License version 2 or any later version.
32
32
33 .. include:: common.txt
33 .. include:: common.txt
34
34
@@ -1,41 +1,41 b''
1 ======
1 ======
2 hgrc
2 hgrc
3 ======
3 ======
4
4
5 ---------------------------------
5 ---------------------------------
6 configuration files for Mercurial
6 configuration files for Mercurial
7 ---------------------------------
7 ---------------------------------
8
8
9 :Author: Bryan O'Sullivan <bos@serpentine.com>
9 :Author: Bryan O'Sullivan <bos@serpentine.com>
10 :Organization: Mercurial
10 :Organization: Mercurial
11 :Manual section: 5
11 :Manual section: 5
12 :Manual group: Mercurial Manual
12 :Manual group: Mercurial Manual
13
13
14 .. contents::
14 .. contents::
15 :backlinks: top
15 :backlinks: top
16 :class: htmlonly
16 :class: htmlonly
17
17
18
18
19 Synopsis
19 Synopsis
20 --------
20 ========
21
21
22 .. include:: ../mercurial/help/config.txt
22 .. include:: ../mercurial/help/config.txt
23
23
24 Author
24 Author
25 ------
25 ======
26 Bryan O'Sullivan <bos@serpentine.com>.
26 Bryan O'Sullivan <bos@serpentine.com>.
27
27
28 Mercurial was written by Matt Mackall <mpm@selenic.com>.
28 Mercurial was written by Matt Mackall <mpm@selenic.com>.
29
29
30 See Also
30 See Also
31 --------
31 ========
32 |hg(1)|_, |hgignore(5)|_
32 |hg(1)|_, |hgignore(5)|_
33
33
34 Copying
34 Copying
35 -------
35 =======
36 This manual page is copyright 2005 Bryan O'Sullivan.
36 This manual page is copyright 2005 Bryan O'Sullivan.
37 Mercurial is copyright 2005-2012 Matt Mackall.
37 Mercurial is copyright 2005-2012 Matt Mackall.
38 Free use of this software is granted under the terms of the GNU General
38 Free use of this software is granted under the terms of the GNU General
39 Public License version 2 or any later version.
39 Public License version 2 or any later version.
40
40
41 .. include:: common.txt
41 .. include:: common.txt
@@ -1,316 +1,316 b''
1 # acl.py - changeset access control for mercurial
1 # acl.py - changeset access control for mercurial
2 #
2 #
3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''hooks for controlling repository access
8 '''hooks for controlling repository access
9
9
10 This hook makes it possible to allow or deny write access to given
10 This hook makes it possible to allow or deny write access to given
11 branches and paths of a repository when receiving incoming changesets
11 branches and paths of a repository when receiving incoming changesets
12 via pretxnchangegroup and pretxncommit.
12 via pretxnchangegroup and pretxncommit.
13
13
14 The authorization is matched based on the local user name on the
14 The authorization is matched based on the local user name on the
15 system where the hook runs, and not the committer of the original
15 system where the hook runs, and not the committer of the original
16 changeset (since the latter is merely informative).
16 changeset (since the latter is merely informative).
17
17
18 The acl hook is best used along with a restricted shell like hgsh,
18 The acl hook is best used along with a restricted shell like hgsh,
19 preventing authenticating users from doing anything other than pushing
19 preventing authenticating users from doing anything other than pushing
20 or pulling. The hook is not safe to use if users have interactive
20 or pulling. The hook is not safe to use if users have interactive
21 shell access, as they can then disable the hook. Nor is it safe if
21 shell access, as they can then disable the hook. Nor is it safe if
22 remote users share an account, because then there is no way to
22 remote users share an account, because then there is no way to
23 distinguish them.
23 distinguish them.
24
24
25 The order in which access checks are performed is:
25 The order in which access checks are performed is:
26
26
27 1) Deny list for branches (section ``acl.deny.branches``)
27 1) Deny list for branches (section ``acl.deny.branches``)
28 2) Allow list for branches (section ``acl.allow.branches``)
28 2) Allow list for branches (section ``acl.allow.branches``)
29 3) Deny list for paths (section ``acl.deny``)
29 3) Deny list for paths (section ``acl.deny``)
30 4) Allow list for paths (section ``acl.allow``)
30 4) Allow list for paths (section ``acl.allow``)
31
31
32 The allow and deny sections take key-value pairs.
32 The allow and deny sections take key-value pairs.
33
33
34 Branch-based Access Control
34 Branch-based Access Control
35 ...........................
35 ---------------------------
36
36
37 Use the ``acl.deny.branches`` and ``acl.allow.branches`` sections to
37 Use the ``acl.deny.branches`` and ``acl.allow.branches`` sections to
38 have branch-based access control. Keys in these sections can be
38 have branch-based access control. Keys in these sections can be
39 either:
39 either:
40
40
41 - a branch name, or
41 - a branch name, or
42 - an asterisk, to match any branch;
42 - an asterisk, to match any branch;
43
43
44 The corresponding values can be either:
44 The corresponding values can be either:
45
45
46 - a comma-separated list containing users and groups, or
46 - a comma-separated list containing users and groups, or
47 - an asterisk, to match anyone;
47 - an asterisk, to match anyone;
48
48
49 You can add the "!" prefix to a user or group name to invert the sense
49 You can add the "!" prefix to a user or group name to invert the sense
50 of the match.
50 of the match.
51
51
52 Path-based Access Control
52 Path-based Access Control
53 .........................
53 -------------------------
54
54
55 Use the ``acl.deny`` and ``acl.allow`` sections to have path-based
55 Use the ``acl.deny`` and ``acl.allow`` sections to have path-based
56 access control. Keys in these sections accept a subtree pattern (with
56 access control. Keys in these sections accept a subtree pattern (with
57 a glob syntax by default). The corresponding values follow the same
57 a glob syntax by default). The corresponding values follow the same
58 syntax as the other sections above.
58 syntax as the other sections above.
59
59
60 Groups
60 Groups
61 ......
61 ------
62
62
63 Group names must be prefixed with an ``@`` symbol. Specifying a group
63 Group names must be prefixed with an ``@`` symbol. Specifying a group
64 name has the same effect as specifying all the users in that group.
64 name has the same effect as specifying all the users in that group.
65
65
66 You can define group members in the ``acl.groups`` section.
66 You can define group members in the ``acl.groups`` section.
67 If a group name is not defined there, and Mercurial is running under
67 If a group name is not defined there, and Mercurial is running under
68 a Unix-like system, the list of users will be taken from the OS.
68 a Unix-like system, the list of users will be taken from the OS.
69 Otherwise, an exception will be raised.
69 Otherwise, an exception will be raised.
70
70
71 Example Configuration
71 Example Configuration
72 .....................
72 ---------------------
73
73
74 ::
74 ::
75
75
76 [hooks]
76 [hooks]
77
77
78 # Use this if you want to check access restrictions at commit time
78 # Use this if you want to check access restrictions at commit time
79 pretxncommit.acl = python:hgext.acl.hook
79 pretxncommit.acl = python:hgext.acl.hook
80
80
81 # Use this if you want to check access restrictions for pull, push,
81 # Use this if you want to check access restrictions for pull, push,
82 # bundle and serve.
82 # bundle and serve.
83 pretxnchangegroup.acl = python:hgext.acl.hook
83 pretxnchangegroup.acl = python:hgext.acl.hook
84
84
85 [acl]
85 [acl]
86 # Allow or deny access for incoming changes only if their source is
86 # Allow or deny access for incoming changes only if their source is
87 # listed here, let them pass otherwise. Source is "serve" for all
87 # listed here, let them pass otherwise. Source is "serve" for all
88 # remote access (http or ssh), "push", "pull" or "bundle" when the
88 # remote access (http or ssh), "push", "pull" or "bundle" when the
89 # related commands are run locally.
89 # related commands are run locally.
90 # Default: serve
90 # Default: serve
91 sources = serve
91 sources = serve
92
92
93 [acl.deny.branches]
93 [acl.deny.branches]
94
94
95 # Everyone is denied to the frozen branch:
95 # Everyone is denied to the frozen branch:
96 frozen-branch = *
96 frozen-branch = *
97
97
98 # A bad user is denied on all branches:
98 # A bad user is denied on all branches:
99 * = bad-user
99 * = bad-user
100
100
101 [acl.allow.branches]
101 [acl.allow.branches]
102
102
103 # A few users are allowed on branch-a:
103 # A few users are allowed on branch-a:
104 branch-a = user-1, user-2, user-3
104 branch-a = user-1, user-2, user-3
105
105
106 # Only one user is allowed on branch-b:
106 # Only one user is allowed on branch-b:
107 branch-b = user-1
107 branch-b = user-1
108
108
109 # The super user is allowed on any branch:
109 # The super user is allowed on any branch:
110 * = super-user
110 * = super-user
111
111
112 # Everyone is allowed on branch-for-tests:
112 # Everyone is allowed on branch-for-tests:
113 branch-for-tests = *
113 branch-for-tests = *
114
114
115 [acl.deny]
115 [acl.deny]
116 # This list is checked first. If a match is found, acl.allow is not
116 # This list is checked first. If a match is found, acl.allow is not
117 # checked. All users are granted access if acl.deny is not present.
117 # checked. All users are granted access if acl.deny is not present.
118 # Format for both lists: glob pattern = user, ..., @group, ...
118 # Format for both lists: glob pattern = user, ..., @group, ...
119
119
120 # To match everyone, use an asterisk for the user:
120 # To match everyone, use an asterisk for the user:
121 # my/glob/pattern = *
121 # my/glob/pattern = *
122
122
123 # user6 will not have write access to any file:
123 # user6 will not have write access to any file:
124 ** = user6
124 ** = user6
125
125
126 # Group "hg-denied" will not have write access to any file:
126 # Group "hg-denied" will not have write access to any file:
127 ** = @hg-denied
127 ** = @hg-denied
128
128
129 # Nobody will be able to change "DONT-TOUCH-THIS.txt", despite
129 # Nobody will be able to change "DONT-TOUCH-THIS.txt", despite
130 # everyone being able to change all other files. See below.
130 # everyone being able to change all other files. See below.
131 src/main/resources/DONT-TOUCH-THIS.txt = *
131 src/main/resources/DONT-TOUCH-THIS.txt = *
132
132
133 [acl.allow]
133 [acl.allow]
134 # if acl.allow is not present, all users are allowed by default
134 # if acl.allow is not present, all users are allowed by default
135 # empty acl.allow = no users allowed
135 # empty acl.allow = no users allowed
136
136
137 # User "doc_writer" has write access to any file under the "docs"
137 # User "doc_writer" has write access to any file under the "docs"
138 # folder:
138 # folder:
139 docs/** = doc_writer
139 docs/** = doc_writer
140
140
141 # User "jack" and group "designers" have write access to any file
141 # User "jack" and group "designers" have write access to any file
142 # under the "images" folder:
142 # under the "images" folder:
143 images/** = jack, @designers
143 images/** = jack, @designers
144
144
145 # Everyone (except for "user6" and "@hg-denied" - see acl.deny above)
145 # Everyone (except for "user6" and "@hg-denied" - see acl.deny above)
146 # will have write access to any file under the "resources" folder
146 # will have write access to any file under the "resources" folder
147 # (except for 1 file. See acl.deny):
147 # (except for 1 file. See acl.deny):
148 src/main/resources/** = *
148 src/main/resources/** = *
149
149
150 .hgtags = release_engineer
150 .hgtags = release_engineer
151
151
152 Examples using the "!" prefix
152 Examples using the "!" prefix
153 .............................
153 .............................
154
154
155 Suppose there's a branch that only a given user (or group) should be able to
155 Suppose there's a branch that only a given user (or group) should be able to
156 push to, and you don't want to restrict access to any other branch that may
156 push to, and you don't want to restrict access to any other branch that may
157 be created.
157 be created.
158
158
159 The "!" prefix allows you to prevent anyone except a given user or group to
159 The "!" prefix allows you to prevent anyone except a given user or group to
160 push changesets in a given branch or path.
160 push changesets in a given branch or path.
161
161
162 In the examples below, we will:
162 In the examples below, we will:
163 1) Deny access to branch "ring" to anyone but user "gollum"
163 1) Deny access to branch "ring" to anyone but user "gollum"
164 2) Deny access to branch "lake" to anyone but members of the group "hobbit"
164 2) Deny access to branch "lake" to anyone but members of the group "hobbit"
165 3) Deny access to a file to anyone but user "gollum"
165 3) Deny access to a file to anyone but user "gollum"
166
166
167 ::
167 ::
168
168
169 [acl.allow.branches]
169 [acl.allow.branches]
170 # Empty
170 # Empty
171
171
172 [acl.deny.branches]
172 [acl.deny.branches]
173
173
174 # 1) only 'gollum' can commit to branch 'ring';
174 # 1) only 'gollum' can commit to branch 'ring';
175 # 'gollum' and anyone else can still commit to any other branch.
175 # 'gollum' and anyone else can still commit to any other branch.
176 ring = !gollum
176 ring = !gollum
177
177
178 # 2) only members of the group 'hobbit' can commit to branch 'lake';
178 # 2) only members of the group 'hobbit' can commit to branch 'lake';
179 # 'hobbit' members and anyone else can still commit to any other branch.
179 # 'hobbit' members and anyone else can still commit to any other branch.
180 lake = !@hobbit
180 lake = !@hobbit
181
181
182 # You can also deny access based on file paths:
182 # You can also deny access based on file paths:
183
183
184 [acl.allow]
184 [acl.allow]
185 # Empty
185 # Empty
186
186
187 [acl.deny]
187 [acl.deny]
188 # 3) only 'gollum' can change the file below;
188 # 3) only 'gollum' can change the file below;
189 # 'gollum' and anyone else can still change any other file.
189 # 'gollum' and anyone else can still change any other file.
190 /misty/mountains/cave/ring = !gollum
190 /misty/mountains/cave/ring = !gollum
191
191
192 '''
192 '''
193
193
194 from mercurial.i18n import _
194 from mercurial.i18n import _
195 from mercurial import util, match
195 from mercurial import util, match
196 import getpass, urllib
196 import getpass, urllib
197
197
198 testedwith = 'internal'
198 testedwith = 'internal'
199
199
200 def _getusers(ui, group):
200 def _getusers(ui, group):
201
201
202 # First, try to use group definition from section [acl.groups]
202 # First, try to use group definition from section [acl.groups]
203 hgrcusers = ui.configlist('acl.groups', group)
203 hgrcusers = ui.configlist('acl.groups', group)
204 if hgrcusers:
204 if hgrcusers:
205 return hgrcusers
205 return hgrcusers
206
206
207 ui.debug('acl: "%s" not defined in [acl.groups]\n' % group)
207 ui.debug('acl: "%s" not defined in [acl.groups]\n' % group)
208 # If no users found in group definition, get users from OS-level group
208 # If no users found in group definition, get users from OS-level group
209 try:
209 try:
210 return util.groupmembers(group)
210 return util.groupmembers(group)
211 except KeyError:
211 except KeyError:
212 raise util.Abort(_("group '%s' is undefined") % group)
212 raise util.Abort(_("group '%s' is undefined") % group)
213
213
214 def _usermatch(ui, user, usersorgroups):
214 def _usermatch(ui, user, usersorgroups):
215
215
216 if usersorgroups == '*':
216 if usersorgroups == '*':
217 return True
217 return True
218
218
219 for ug in usersorgroups.replace(',', ' ').split():
219 for ug in usersorgroups.replace(',', ' ').split():
220
220
221 if ug.startswith('!'):
221 if ug.startswith('!'):
222 # Test for excluded user or group. Format:
222 # Test for excluded user or group. Format:
223 # if ug is a user name: !username
223 # if ug is a user name: !username
224 # if ug is a group name: !@groupname
224 # if ug is a group name: !@groupname
225 ug = ug[1:]
225 ug = ug[1:]
226 if not ug.startswith('@') and user != ug \
226 if not ug.startswith('@') and user != ug \
227 or ug.startswith('@') and user not in _getusers(ui, ug[1:]):
227 or ug.startswith('@') and user not in _getusers(ui, ug[1:]):
228 return True
228 return True
229
229
230 # Test for user or group. Format:
230 # Test for user or group. Format:
231 # if ug is a user name: username
231 # if ug is a user name: username
232 # if ug is a group name: @groupname
232 # if ug is a group name: @groupname
233 elif user == ug \
233 elif user == ug \
234 or ug.startswith('@') and user in _getusers(ui, ug[1:]):
234 or ug.startswith('@') and user in _getusers(ui, ug[1:]):
235 return True
235 return True
236
236
237 return False
237 return False
238
238
239 def buildmatch(ui, repo, user, key):
239 def buildmatch(ui, repo, user, key):
240 '''return tuple of (match function, list enabled).'''
240 '''return tuple of (match function, list enabled).'''
241 if not ui.has_section(key):
241 if not ui.has_section(key):
242 ui.debug('acl: %s not enabled\n' % key)
242 ui.debug('acl: %s not enabled\n' % key)
243 return None
243 return None
244
244
245 pats = [pat for pat, users in ui.configitems(key)
245 pats = [pat for pat, users in ui.configitems(key)
246 if _usermatch(ui, user, users)]
246 if _usermatch(ui, user, users)]
247 ui.debug('acl: %s enabled, %d entries for user %s\n' %
247 ui.debug('acl: %s enabled, %d entries for user %s\n' %
248 (key, len(pats), user))
248 (key, len(pats), user))
249
249
250 # Branch-based ACL
250 # Branch-based ACL
251 if not repo:
251 if not repo:
252 if pats:
252 if pats:
253 # If there's an asterisk (meaning "any branch"), always return True;
253 # If there's an asterisk (meaning "any branch"), always return True;
254 # Otherwise, test if b is in pats
254 # Otherwise, test if b is in pats
255 if '*' in pats:
255 if '*' in pats:
256 return util.always
256 return util.always
257 return lambda b: b in pats
257 return lambda b: b in pats
258 return util.never
258 return util.never
259
259
260 # Path-based ACL
260 # Path-based ACL
261 if pats:
261 if pats:
262 return match.match(repo.root, '', pats)
262 return match.match(repo.root, '', pats)
263 return util.never
263 return util.never
264
264
265 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
265 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
266 if hooktype not in ['pretxnchangegroup', 'pretxncommit']:
266 if hooktype not in ['pretxnchangegroup', 'pretxncommit']:
267 raise util.Abort(_('config error - hook type "%s" cannot stop '
267 raise util.Abort(_('config error - hook type "%s" cannot stop '
268 'incoming changesets nor commits') % hooktype)
268 'incoming changesets nor commits') % hooktype)
269 if (hooktype == 'pretxnchangegroup' and
269 if (hooktype == 'pretxnchangegroup' and
270 source not in ui.config('acl', 'sources', 'serve').split()):
270 source not in ui.config('acl', 'sources', 'serve').split()):
271 ui.debug('acl: changes have source "%s" - skipping\n' % source)
271 ui.debug('acl: changes have source "%s" - skipping\n' % source)
272 return
272 return
273
273
274 user = None
274 user = None
275 if source == 'serve' and 'url' in kwargs:
275 if source == 'serve' and 'url' in kwargs:
276 url = kwargs['url'].split(':')
276 url = kwargs['url'].split(':')
277 if url[0] == 'remote' and url[1].startswith('http'):
277 if url[0] == 'remote' and url[1].startswith('http'):
278 user = urllib.unquote(url[3])
278 user = urllib.unquote(url[3])
279
279
280 if user is None:
280 if user is None:
281 user = getpass.getuser()
281 user = getpass.getuser()
282
282
283 ui.debug('acl: checking access for user "%s"\n' % user)
283 ui.debug('acl: checking access for user "%s"\n' % user)
284
284
285 cfg = ui.config('acl', 'config')
285 cfg = ui.config('acl', 'config')
286 if cfg:
286 if cfg:
287 ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches',
287 ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches',
288 'acl.deny.branches', 'acl.allow', 'acl.deny'])
288 'acl.deny.branches', 'acl.allow', 'acl.deny'])
289
289
290 allowbranches = buildmatch(ui, None, user, 'acl.allow.branches')
290 allowbranches = buildmatch(ui, None, user, 'acl.allow.branches')
291 denybranches = buildmatch(ui, None, user, 'acl.deny.branches')
291 denybranches = buildmatch(ui, None, user, 'acl.deny.branches')
292 allow = buildmatch(ui, repo, user, 'acl.allow')
292 allow = buildmatch(ui, repo, user, 'acl.allow')
293 deny = buildmatch(ui, repo, user, 'acl.deny')
293 deny = buildmatch(ui, repo, user, 'acl.deny')
294
294
295 for rev in xrange(repo[node], len(repo)):
295 for rev in xrange(repo[node], len(repo)):
296 ctx = repo[rev]
296 ctx = repo[rev]
297 branch = ctx.branch()
297 branch = ctx.branch()
298 if denybranches and denybranches(branch):
298 if denybranches and denybranches(branch):
299 raise util.Abort(_('acl: user "%s" denied on branch "%s"'
299 raise util.Abort(_('acl: user "%s" denied on branch "%s"'
300 ' (changeset "%s")')
300 ' (changeset "%s")')
301 % (user, branch, ctx))
301 % (user, branch, ctx))
302 if allowbranches and not allowbranches(branch):
302 if allowbranches and not allowbranches(branch):
303 raise util.Abort(_('acl: user "%s" not allowed on branch "%s"'
303 raise util.Abort(_('acl: user "%s" not allowed on branch "%s"'
304 ' (changeset "%s")')
304 ' (changeset "%s")')
305 % (user, branch, ctx))
305 % (user, branch, ctx))
306 ui.debug('acl: branch access granted: "%s" on branch "%s"\n'
306 ui.debug('acl: branch access granted: "%s" on branch "%s"\n'
307 % (ctx, branch))
307 % (ctx, branch))
308
308
309 for f in ctx.files():
309 for f in ctx.files():
310 if deny and deny(f):
310 if deny and deny(f):
311 raise util.Abort(_('acl: user "%s" denied on "%s"'
311 raise util.Abort(_('acl: user "%s" denied on "%s"'
312 ' (changeset "%s")') % (user, f, ctx))
312 ' (changeset "%s")') % (user, f, ctx))
313 if allow and not allow(f):
313 if allow and not allow(f):
314 raise util.Abort(_('acl: user "%s" not allowed on "%s"'
314 raise util.Abort(_('acl: user "%s" not allowed on "%s"'
315 ' (changeset "%s")') % (user, f, ctx))
315 ' (changeset "%s")') % (user, f, ctx))
316 ui.debug('acl: path access granted: "%s"\n' % ctx)
316 ui.debug('acl: path access granted: "%s"\n' % ctx)
@@ -1,370 +1,370 b''
1 # convert.py Foreign SCM converter
1 # convert.py Foreign SCM converter
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''import revisions from foreign VCS repositories into Mercurial'''
8 '''import revisions from foreign VCS repositories into Mercurial'''
9
9
10 import convcmd
10 import convcmd
11 import cvsps
11 import cvsps
12 import subversion
12 import subversion
13 from mercurial import commands, templatekw
13 from mercurial import commands, templatekw
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15
15
16 testedwith = 'internal'
16 testedwith = 'internal'
17
17
18 # Commands definition was moved elsewhere to ease demandload job.
18 # Commands definition was moved elsewhere to ease demandload job.
19
19
20 def convert(ui, src, dest=None, revmapfile=None, **opts):
20 def convert(ui, src, dest=None, revmapfile=None, **opts):
21 """convert a foreign SCM repository to a Mercurial one.
21 """convert a foreign SCM repository to a Mercurial one.
22
22
23 Accepted source formats [identifiers]:
23 Accepted source formats [identifiers]:
24
24
25 - Mercurial [hg]
25 - Mercurial [hg]
26 - CVS [cvs]
26 - CVS [cvs]
27 - Darcs [darcs]
27 - Darcs [darcs]
28 - git [git]
28 - git [git]
29 - Subversion [svn]
29 - Subversion [svn]
30 - Monotone [mtn]
30 - Monotone [mtn]
31 - GNU Arch [gnuarch]
31 - GNU Arch [gnuarch]
32 - Bazaar [bzr]
32 - Bazaar [bzr]
33 - Perforce [p4]
33 - Perforce [p4]
34
34
35 Accepted destination formats [identifiers]:
35 Accepted destination formats [identifiers]:
36
36
37 - Mercurial [hg]
37 - Mercurial [hg]
38 - Subversion [svn] (history on branches is not preserved)
38 - Subversion [svn] (history on branches is not preserved)
39
39
40 If no revision is given, all revisions will be converted.
40 If no revision is given, all revisions will be converted.
41 Otherwise, convert will only import up to the named revision
41 Otherwise, convert will only import up to the named revision
42 (given in a format understood by the source).
42 (given in a format understood by the source).
43
43
44 If no destination directory name is specified, it defaults to the
44 If no destination directory name is specified, it defaults to the
45 basename of the source with ``-hg`` appended. If the destination
45 basename of the source with ``-hg`` appended. If the destination
46 repository doesn't exist, it will be created.
46 repository doesn't exist, it will be created.
47
47
48 By default, all sources except Mercurial will use --branchsort.
48 By default, all sources except Mercurial will use --branchsort.
49 Mercurial uses --sourcesort to preserve original revision numbers
49 Mercurial uses --sourcesort to preserve original revision numbers
50 order. Sort modes have the following effects:
50 order. Sort modes have the following effects:
51
51
52 --branchsort convert from parent to child revision when possible,
52 --branchsort convert from parent to child revision when possible,
53 which means branches are usually converted one after
53 which means branches are usually converted one after
54 the other. It generates more compact repositories.
54 the other. It generates more compact repositories.
55
55
56 --datesort sort revisions by date. Converted repositories have
56 --datesort sort revisions by date. Converted repositories have
57 good-looking changelogs but are often an order of
57 good-looking changelogs but are often an order of
58 magnitude larger than the same ones generated by
58 magnitude larger than the same ones generated by
59 --branchsort.
59 --branchsort.
60
60
61 --sourcesort try to preserve source revisions order, only
61 --sourcesort try to preserve source revisions order, only
62 supported by Mercurial sources.
62 supported by Mercurial sources.
63
63
64 If ``REVMAP`` isn't given, it will be put in a default location
64 If ``REVMAP`` isn't given, it will be put in a default location
65 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
65 (``<dest>/.hg/shamap`` by default). The ``REVMAP`` is a simple
66 text file that maps each source commit ID to the destination ID
66 text file that maps each source commit ID to the destination ID
67 for that revision, like so::
67 for that revision, like so::
68
68
69 <source ID> <destination ID>
69 <source ID> <destination ID>
70
70
71 If the file doesn't exist, it's automatically created. It's
71 If the file doesn't exist, it's automatically created. It's
72 updated on each commit copied, so :hg:`convert` can be interrupted
72 updated on each commit copied, so :hg:`convert` can be interrupted
73 and can be run repeatedly to copy new commits.
73 and can be run repeatedly to copy new commits.
74
74
75 The authormap is a simple text file that maps each source commit
75 The authormap is a simple text file that maps each source commit
76 author to a destination commit author. It is handy for source SCMs
76 author to a destination commit author. It is handy for source SCMs
77 that use unix logins to identify authors (eg: CVS). One line per
77 that use unix logins to identify authors (eg: CVS). One line per
78 author mapping and the line format is::
78 author mapping and the line format is::
79
79
80 source author = destination author
80 source author = destination author
81
81
82 Empty lines and lines starting with a ``#`` are ignored.
82 Empty lines and lines starting with a ``#`` are ignored.
83
83
84 The filemap is a file that allows filtering and remapping of files
84 The filemap is a file that allows filtering and remapping of files
85 and directories. Each line can contain one of the following
85 and directories. Each line can contain one of the following
86 directives::
86 directives::
87
87
88 include path/to/file-or-dir
88 include path/to/file-or-dir
89
89
90 exclude path/to/file-or-dir
90 exclude path/to/file-or-dir
91
91
92 rename path/to/source path/to/destination
92 rename path/to/source path/to/destination
93
93
94 Comment lines start with ``#``. A specified path matches if it
94 Comment lines start with ``#``. A specified path matches if it
95 equals the full relative name of a file or one of its parent
95 equals the full relative name of a file or one of its parent
96 directories. The ``include`` or ``exclude`` directive with the
96 directories. The ``include`` or ``exclude`` directive with the
97 longest matching path applies, so line order does not matter.
97 longest matching path applies, so line order does not matter.
98
98
99 The ``include`` directive causes a file, or all files under a
99 The ``include`` directive causes a file, or all files under a
100 directory, to be included in the destination repository, and the
100 directory, to be included in the destination repository, and the
101 exclusion of all other files and directories not explicitly
101 exclusion of all other files and directories not explicitly
102 included. The ``exclude`` directive causes files or directories to
102 included. The ``exclude`` directive causes files or directories to
103 be omitted. The ``rename`` directive renames a file or directory if
103 be omitted. The ``rename`` directive renames a file or directory if
104 it is converted. To rename from a subdirectory into the root of
104 it is converted. To rename from a subdirectory into the root of
105 the repository, use ``.`` as the path to rename to.
105 the repository, use ``.`` as the path to rename to.
106
106
107 The splicemap is a file that allows insertion of synthetic
107 The splicemap is a file that allows insertion of synthetic
108 history, letting you specify the parents of a revision. This is
108 history, letting you specify the parents of a revision. This is
109 useful if you want to e.g. give a Subversion merge two parents, or
109 useful if you want to e.g. give a Subversion merge two parents, or
110 graft two disconnected series of history together. Each entry
110 graft two disconnected series of history together. Each entry
111 contains a key, followed by a space, followed by one or two
111 contains a key, followed by a space, followed by one or two
112 comma-separated values::
112 comma-separated values::
113
113
114 key parent1, parent2
114 key parent1, parent2
115
115
116 The key is the revision ID in the source
116 The key is the revision ID in the source
117 revision control system whose parents should be modified (same
117 revision control system whose parents should be modified (same
118 format as a key in .hg/shamap). The values are the revision IDs
118 format as a key in .hg/shamap). The values are the revision IDs
119 (in either the source or destination revision control system) that
119 (in either the source or destination revision control system) that
120 should be used as the new parents for that node. For example, if
120 should be used as the new parents for that node. For example, if
121 you have merged "release-1.0" into "trunk", then you should
121 you have merged "release-1.0" into "trunk", then you should
122 specify the revision on "trunk" as the first parent and the one on
122 specify the revision on "trunk" as the first parent and the one on
123 the "release-1.0" branch as the second.
123 the "release-1.0" branch as the second.
124
124
125 The branchmap is a file that allows you to rename a branch when it is
125 The branchmap is a file that allows you to rename a branch when it is
126 being brought in from whatever external repository. When used in
126 being brought in from whatever external repository. When used in
127 conjunction with a splicemap, it allows for a powerful combination
127 conjunction with a splicemap, it allows for a powerful combination
128 to help fix even the most badly mismanaged repositories and turn them
128 to help fix even the most badly mismanaged repositories and turn them
129 into nicely structured Mercurial repositories. The branchmap contains
129 into nicely structured Mercurial repositories. The branchmap contains
130 lines of the form::
130 lines of the form::
131
131
132 original_branch_name new_branch_name
132 original_branch_name new_branch_name
133
133
134 where "original_branch_name" is the name of the branch in the
134 where "original_branch_name" is the name of the branch in the
135 source repository, and "new_branch_name" is the name of the branch
135 source repository, and "new_branch_name" is the name of the branch
136 is the destination repository. No whitespace is allowed in the
136 is the destination repository. No whitespace is allowed in the
137 branch names. This can be used to (for instance) move code in one
137 branch names. This can be used to (for instance) move code in one
138 repository from "default" to a named branch.
138 repository from "default" to a named branch.
139
139
140 Mercurial Source
140 Mercurial Source
141 ''''''''''''''''
141 ################
142
142
143 The Mercurial source recognizes the following configuration
143 The Mercurial source recognizes the following configuration
144 options, which you can set on the command line with ``--config``:
144 options, which you can set on the command line with ``--config``:
145
145
146 :convert.hg.ignoreerrors: ignore integrity errors when reading.
146 :convert.hg.ignoreerrors: ignore integrity errors when reading.
147 Use it to fix Mercurial repositories with missing revlogs, by
147 Use it to fix Mercurial repositories with missing revlogs, by
148 converting from and to Mercurial. Default is False.
148 converting from and to Mercurial. Default is False.
149
149
150 :convert.hg.saverev: store original revision ID in changeset
150 :convert.hg.saverev: store original revision ID in changeset
151 (forces target IDs to change). It takes a boolean argument and
151 (forces target IDs to change). It takes a boolean argument and
152 defaults to False.
152 defaults to False.
153
153
154 :convert.hg.startrev: convert start revision and its descendants.
154 :convert.hg.startrev: convert start revision and its descendants.
155 It takes a hg revision identifier and defaults to 0.
155 It takes a hg revision identifier and defaults to 0.
156
156
157 CVS Source
157 CVS Source
158 ''''''''''
158 ##########
159
159
160 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
160 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
161 to indicate the starting point of what will be converted. Direct
161 to indicate the starting point of what will be converted. Direct
162 access to the repository files is not needed, unless of course the
162 access to the repository files is not needed, unless of course the
163 repository is ``:local:``. The conversion uses the top level
163 repository is ``:local:``. The conversion uses the top level
164 directory in the sandbox to find the CVS repository, and then uses
164 directory in the sandbox to find the CVS repository, and then uses
165 CVS rlog commands to find files to convert. This means that unless
165 CVS rlog commands to find files to convert. This means that unless
166 a filemap is given, all files under the starting directory will be
166 a filemap is given, all files under the starting directory will be
167 converted, and that any directory reorganization in the CVS
167 converted, and that any directory reorganization in the CVS
168 sandbox is ignored.
168 sandbox is ignored.
169
169
170 The following options can be used with ``--config``:
170 The following options can be used with ``--config``:
171
171
172 :convert.cvsps.cache: Set to False to disable remote log caching,
172 :convert.cvsps.cache: Set to False to disable remote log caching,
173 for testing and debugging purposes. Default is True.
173 for testing and debugging purposes. Default is True.
174
174
175 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
175 :convert.cvsps.fuzz: Specify the maximum time (in seconds) that is
176 allowed between commits with identical user and log message in
176 allowed between commits with identical user and log message in
177 a single changeset. When very large files were checked in as
177 a single changeset. When very large files were checked in as
178 part of a changeset then the default may not be long enough.
178 part of a changeset then the default may not be long enough.
179 The default is 60.
179 The default is 60.
180
180
181 :convert.cvsps.mergeto: Specify a regular expression to which
181 :convert.cvsps.mergeto: Specify a regular expression to which
182 commit log messages are matched. If a match occurs, then the
182 commit log messages are matched. If a match occurs, then the
183 conversion process will insert a dummy revision merging the
183 conversion process will insert a dummy revision merging the
184 branch on which this log message occurs to the branch
184 branch on which this log message occurs to the branch
185 indicated in the regex. Default is ``{{mergetobranch
185 indicated in the regex. Default is ``{{mergetobranch
186 ([-\\w]+)}}``
186 ([-\\w]+)}}``
187
187
188 :convert.cvsps.mergefrom: Specify a regular expression to which
188 :convert.cvsps.mergefrom: Specify a regular expression to which
189 commit log messages are matched. If a match occurs, then the
189 commit log messages are matched. If a match occurs, then the
190 conversion process will add the most recent revision on the
190 conversion process will add the most recent revision on the
191 branch indicated in the regex as the second parent of the
191 branch indicated in the regex as the second parent of the
192 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
192 changeset. Default is ``{{mergefrombranch ([-\\w]+)}}``
193
193
194 :hook.cvslog: Specify a Python function to be called at the end of
194 :hook.cvslog: Specify a Python function to be called at the end of
195 gathering the CVS log. The function is passed a list with the
195 gathering the CVS log. The function is passed a list with the
196 log entries, and can modify the entries in-place, or add or
196 log entries, and can modify the entries in-place, or add or
197 delete them.
197 delete them.
198
198
199 :hook.cvschangesets: Specify a Python function to be called after
199 :hook.cvschangesets: Specify a Python function to be called after
200 the changesets are calculated from the CVS log. The
200 the changesets are calculated from the CVS log. The
201 function is passed a list with the changeset entries, and can
201 function is passed a list with the changeset entries, and can
202 modify the changesets in-place, or add or delete them.
202 modify the changesets in-place, or add or delete them.
203
203
204 An additional "debugcvsps" Mercurial command allows the builtin
204 An additional "debugcvsps" Mercurial command allows the builtin
205 changeset merging code to be run without doing a conversion. Its
205 changeset merging code to be run without doing a conversion. Its
206 parameters and output are similar to that of cvsps 2.1. Please see
206 parameters and output are similar to that of cvsps 2.1. Please see
207 the command help for more details.
207 the command help for more details.
208
208
209 Subversion Source
209 Subversion Source
210 '''''''''''''''''
210 #################
211
211
212 Subversion source detects classical trunk/branches/tags layouts.
212 Subversion source detects classical trunk/branches/tags layouts.
213 By default, the supplied ``svn://repo/path/`` source URL is
213 By default, the supplied ``svn://repo/path/`` source URL is
214 converted as a single branch. If ``svn://repo/path/trunk`` exists
214 converted as a single branch. If ``svn://repo/path/trunk`` exists
215 it replaces the default branch. If ``svn://repo/path/branches``
215 it replaces the default branch. If ``svn://repo/path/branches``
216 exists, its subdirectories are listed as possible branches. If
216 exists, its subdirectories are listed as possible branches. If
217 ``svn://repo/path/tags`` exists, it is looked for tags referencing
217 ``svn://repo/path/tags`` exists, it is looked for tags referencing
218 converted branches. Default ``trunk``, ``branches`` and ``tags``
218 converted branches. Default ``trunk``, ``branches`` and ``tags``
219 values can be overridden with following options. Set them to paths
219 values can be overridden with following options. Set them to paths
220 relative to the source URL, or leave them blank to disable auto
220 relative to the source URL, or leave them blank to disable auto
221 detection.
221 detection.
222
222
223 The following options can be set with ``--config``:
223 The following options can be set with ``--config``:
224
224
225 :convert.svn.branches: specify the directory containing branches.
225 :convert.svn.branches: specify the directory containing branches.
226 The default is ``branches``.
226 The default is ``branches``.
227
227
228 :convert.svn.tags: specify the directory containing tags. The
228 :convert.svn.tags: specify the directory containing tags. The
229 default is ``tags``.
229 default is ``tags``.
230
230
231 :convert.svn.trunk: specify the name of the trunk branch. The
231 :convert.svn.trunk: specify the name of the trunk branch. The
232 default is ``trunk``.
232 default is ``trunk``.
233
233
234 Source history can be retrieved starting at a specific revision,
234 Source history can be retrieved starting at a specific revision,
235 instead of being integrally converted. Only single branch
235 instead of being integrally converted. Only single branch
236 conversions are supported.
236 conversions are supported.
237
237
238 :convert.svn.startrev: specify start Subversion revision number.
238 :convert.svn.startrev: specify start Subversion revision number.
239 The default is 0.
239 The default is 0.
240
240
241 Perforce Source
241 Perforce Source
242 '''''''''''''''
242 ###############
243
243
244 The Perforce (P4) importer can be given a p4 depot path or a
244 The Perforce (P4) importer can be given a p4 depot path or a
245 client specification as source. It will convert all files in the
245 client specification as source. It will convert all files in the
246 source to a flat Mercurial repository, ignoring labels, branches
246 source to a flat Mercurial repository, ignoring labels, branches
247 and integrations. Note that when a depot path is given you then
247 and integrations. Note that when a depot path is given you then
248 usually should specify a target directory, because otherwise the
248 usually should specify a target directory, because otherwise the
249 target may be named ``...-hg``.
249 target may be named ``...-hg``.
250
250
251 It is possible to limit the amount of source history to be
251 It is possible to limit the amount of source history to be
252 converted by specifying an initial Perforce revision:
252 converted by specifying an initial Perforce revision:
253
253
254 :convert.p4.startrev: specify initial Perforce revision (a
254 :convert.p4.startrev: specify initial Perforce revision (a
255 Perforce changelist number).
255 Perforce changelist number).
256
256
257 Mercurial Destination
257 Mercurial Destination
258 '''''''''''''''''''''
258 #####################
259
259
260 The following options are supported:
260 The following options are supported:
261
261
262 :convert.hg.clonebranches: dispatch source branches in separate
262 :convert.hg.clonebranches: dispatch source branches in separate
263 clones. The default is False.
263 clones. The default is False.
264
264
265 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
265 :convert.hg.tagsbranch: branch name for tag revisions, defaults to
266 ``default``.
266 ``default``.
267
267
268 :convert.hg.usebranchnames: preserve branch names. The default is
268 :convert.hg.usebranchnames: preserve branch names. The default is
269 True.
269 True.
270 """
270 """
271 return convcmd.convert(ui, src, dest, revmapfile, **opts)
271 return convcmd.convert(ui, src, dest, revmapfile, **opts)
272
272
273 def debugsvnlog(ui, **opts):
273 def debugsvnlog(ui, **opts):
274 return subversion.debugsvnlog(ui, **opts)
274 return subversion.debugsvnlog(ui, **opts)
275
275
276 def debugcvsps(ui, *args, **opts):
276 def debugcvsps(ui, *args, **opts):
277 '''create changeset information from CVS
277 '''create changeset information from CVS
278
278
279 This command is intended as a debugging tool for the CVS to
279 This command is intended as a debugging tool for the CVS to
280 Mercurial converter, and can be used as a direct replacement for
280 Mercurial converter, and can be used as a direct replacement for
281 cvsps.
281 cvsps.
282
282
283 Hg debugcvsps reads the CVS rlog for current directory (or any
283 Hg debugcvsps reads the CVS rlog for current directory (or any
284 named directory) in the CVS repository, and converts the log to a
284 named directory) in the CVS repository, and converts the log to a
285 series of changesets based on matching commit log entries and
285 series of changesets based on matching commit log entries and
286 dates.'''
286 dates.'''
287 return cvsps.debugcvsps(ui, *args, **opts)
287 return cvsps.debugcvsps(ui, *args, **opts)
288
288
289 commands.norepo += " convert debugsvnlog debugcvsps"
289 commands.norepo += " convert debugsvnlog debugcvsps"
290
290
291 cmdtable = {
291 cmdtable = {
292 "convert":
292 "convert":
293 (convert,
293 (convert,
294 [('', 'authors', '',
294 [('', 'authors', '',
295 _('username mapping filename (DEPRECATED, use --authormap instead)'),
295 _('username mapping filename (DEPRECATED, use --authormap instead)'),
296 _('FILE')),
296 _('FILE')),
297 ('s', 'source-type', '',
297 ('s', 'source-type', '',
298 _('source repository type'), _('TYPE')),
298 _('source repository type'), _('TYPE')),
299 ('d', 'dest-type', '',
299 ('d', 'dest-type', '',
300 _('destination repository type'), _('TYPE')),
300 _('destination repository type'), _('TYPE')),
301 ('r', 'rev', '',
301 ('r', 'rev', '',
302 _('import up to target revision REV'), _('REV')),
302 _('import up to target revision REV'), _('REV')),
303 ('A', 'authormap', '',
303 ('A', 'authormap', '',
304 _('remap usernames using this file'), _('FILE')),
304 _('remap usernames using this file'), _('FILE')),
305 ('', 'filemap', '',
305 ('', 'filemap', '',
306 _('remap file names using contents of file'), _('FILE')),
306 _('remap file names using contents of file'), _('FILE')),
307 ('', 'splicemap', '',
307 ('', 'splicemap', '',
308 _('splice synthesized history into place'), _('FILE')),
308 _('splice synthesized history into place'), _('FILE')),
309 ('', 'branchmap', '',
309 ('', 'branchmap', '',
310 _('change branch names while converting'), _('FILE')),
310 _('change branch names while converting'), _('FILE')),
311 ('', 'branchsort', None, _('try to sort changesets by branches')),
311 ('', 'branchsort', None, _('try to sort changesets by branches')),
312 ('', 'datesort', None, _('try to sort changesets by date')),
312 ('', 'datesort', None, _('try to sort changesets by date')),
313 ('', 'sourcesort', None, _('preserve source changesets order'))],
313 ('', 'sourcesort', None, _('preserve source changesets order'))],
314 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
314 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
315 "debugsvnlog":
315 "debugsvnlog":
316 (debugsvnlog,
316 (debugsvnlog,
317 [],
317 [],
318 'hg debugsvnlog'),
318 'hg debugsvnlog'),
319 "debugcvsps":
319 "debugcvsps":
320 (debugcvsps,
320 (debugcvsps,
321 [
321 [
322 # Main options shared with cvsps-2.1
322 # Main options shared with cvsps-2.1
323 ('b', 'branches', [], _('only return changes on specified branches')),
323 ('b', 'branches', [], _('only return changes on specified branches')),
324 ('p', 'prefix', '', _('prefix to remove from file names')),
324 ('p', 'prefix', '', _('prefix to remove from file names')),
325 ('r', 'revisions', [],
325 ('r', 'revisions', [],
326 _('only return changes after or between specified tags')),
326 _('only return changes after or between specified tags')),
327 ('u', 'update-cache', None, _("update cvs log cache")),
327 ('u', 'update-cache', None, _("update cvs log cache")),
328 ('x', 'new-cache', None, _("create new cvs log cache")),
328 ('x', 'new-cache', None, _("create new cvs log cache")),
329 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
329 ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
330 ('', 'root', '', _('specify cvsroot')),
330 ('', 'root', '', _('specify cvsroot')),
331 # Options specific to builtin cvsps
331 # Options specific to builtin cvsps
332 ('', 'parents', '', _('show parent changesets')),
332 ('', 'parents', '', _('show parent changesets')),
333 ('', 'ancestors', '',
333 ('', 'ancestors', '',
334 _('show current changeset in ancestor branches')),
334 _('show current changeset in ancestor branches')),
335 # Options that are ignored for compatibility with cvsps-2.1
335 # Options that are ignored for compatibility with cvsps-2.1
336 ('A', 'cvs-direct', None, _('ignored for compatibility')),
336 ('A', 'cvs-direct', None, _('ignored for compatibility')),
337 ],
337 ],
338 _('hg debugcvsps [OPTION]... [PATH]...')),
338 _('hg debugcvsps [OPTION]... [PATH]...')),
339 }
339 }
340
340
341 def kwconverted(ctx, name):
341 def kwconverted(ctx, name):
342 rev = ctx.extra().get('convert_revision', '')
342 rev = ctx.extra().get('convert_revision', '')
343 if rev.startswith('svn:'):
343 if rev.startswith('svn:'):
344 if name == 'svnrev':
344 if name == 'svnrev':
345 return str(subversion.revsplit(rev)[2])
345 return str(subversion.revsplit(rev)[2])
346 elif name == 'svnpath':
346 elif name == 'svnpath':
347 return subversion.revsplit(rev)[1]
347 return subversion.revsplit(rev)[1]
348 elif name == 'svnuuid':
348 elif name == 'svnuuid':
349 return subversion.revsplit(rev)[0]
349 return subversion.revsplit(rev)[0]
350 return rev
350 return rev
351
351
352 def kwsvnrev(repo, ctx, **args):
352 def kwsvnrev(repo, ctx, **args):
353 """:svnrev: String. Converted subversion revision number."""
353 """:svnrev: String. Converted subversion revision number."""
354 return kwconverted(ctx, 'svnrev')
354 return kwconverted(ctx, 'svnrev')
355
355
356 def kwsvnpath(repo, ctx, **args):
356 def kwsvnpath(repo, ctx, **args):
357 """:svnpath: String. Converted subversion revision project path."""
357 """:svnpath: String. Converted subversion revision project path."""
358 return kwconverted(ctx, 'svnpath')
358 return kwconverted(ctx, 'svnpath')
359
359
360 def kwsvnuuid(repo, ctx, **args):
360 def kwsvnuuid(repo, ctx, **args):
361 """:svnuuid: String. Converted subversion revision repository identifier."""
361 """:svnuuid: String. Converted subversion revision repository identifier."""
362 return kwconverted(ctx, 'svnuuid')
362 return kwconverted(ctx, 'svnuuid')
363
363
364 def extsetup(ui):
364 def extsetup(ui):
365 templatekw.keywords['svnrev'] = kwsvnrev
365 templatekw.keywords['svnrev'] = kwsvnrev
366 templatekw.keywords['svnpath'] = kwsvnpath
366 templatekw.keywords['svnpath'] = kwsvnpath
367 templatekw.keywords['svnuuid'] = kwsvnuuid
367 templatekw.keywords['svnuuid'] = kwsvnuuid
368
368
369 # tell hggettext to extract docstrings from these functions:
369 # tell hggettext to extract docstrings from these functions:
370 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
370 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
@@ -1,1437 +1,1437 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 The configuration files use a simple ini-file format. A configuration
4 The configuration files use a simple ini-file format. A configuration
5 file consists of sections, led by a ``[section]`` header and followed
5 file consists of sections, led by a ``[section]`` header and followed
6 by ``name = value`` entries::
6 by ``name = value`` entries::
7
7
8 [ui]
8 [ui]
9 username = Firstname Lastname <firstname.lastname@example.net>
9 username = Firstname Lastname <firstname.lastname@example.net>
10 verbose = True
10 verbose = True
11
11
12 The above entries will be referred to as ``ui.username`` and
12 The above entries will be referred to as ``ui.username`` and
13 ``ui.verbose``, respectively. See the Syntax section below.
13 ``ui.verbose``, respectively. See the Syntax section below.
14
14
15 Files
15 Files
16 -----
16 =====
17
17
18 Mercurial reads configuration data from several files, if they exist.
18 Mercurial reads configuration data from several files, if they exist.
19 These files do not exist by default and you will have to create the
19 These files do not exist by default and you will have to create the
20 appropriate configuration files yourself: global configuration like
20 appropriate configuration files yourself: global configuration like
21 the username setting is typically put into
21 the username setting is typically put into
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
24
24
25 The names of these files depend on the system on which Mercurial is
25 The names of these files depend on the system on which Mercurial is
26 installed. ``*.rc`` files from a single directory are read in
26 installed. ``*.rc`` files from a single directory are read in
27 alphabetical order, later ones overriding earlier ones. Where multiple
27 alphabetical order, later ones overriding earlier ones. Where multiple
28 paths are given below, settings from earlier paths override later
28 paths are given below, settings from earlier paths override later
29 ones.
29 ones.
30
30
31 | (All) ``<repo>/.hg/hgrc``
31 | (All) ``<repo>/.hg/hgrc``
32
32
33 Per-repository configuration options that only apply in a
33 Per-repository configuration options that only apply in a
34 particular repository. This file is not version-controlled, and
34 particular repository. This file is not version-controlled, and
35 will not get transferred during a "clone" operation. Options in
35 will not get transferred during a "clone" operation. Options in
36 this file override options in all other configuration files. On
36 this file override options in all other configuration files. On
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
38 belong to a trusted user or to a trusted group. See the documentation
38 belong to a trusted user or to a trusted group. See the documentation
39 for the ``[trusted]`` section below for more details.
39 for the ``[trusted]`` section below for more details.
40
40
41 | (Plan 9) ``$home/lib/hgrc``
41 | (Plan 9) ``$home/lib/hgrc``
42 | (Unix) ``$HOME/.hgrc``
42 | (Unix) ``$HOME/.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
45 | (Windows) ``%HOME%\.hgrc``
45 | (Windows) ``%HOME%\.hgrc``
46 | (Windows) ``%HOME%\Mercurial.ini``
46 | (Windows) ``%HOME%\Mercurial.ini``
47
47
48 Per-user configuration file(s), for the user running Mercurial. On
48 Per-user configuration file(s), for the user running Mercurial. On
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
50 files apply to all Mercurial commands executed by this user in any
50 files apply to all Mercurial commands executed by this user in any
51 directory. Options in these files override per-system and per-installation
51 directory. Options in these files override per-system and per-installation
52 options.
52 options.
53
53
54 | (Plan 9) ``/lib/mercurial/hgrc``
54 | (Plan 9) ``/lib/mercurial/hgrc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
56 | (Unix) ``/etc/mercurial/hgrc``
56 | (Unix) ``/etc/mercurial/hgrc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
58
58
59 Per-system configuration files, for the system on which Mercurial
59 Per-system configuration files, for the system on which Mercurial
60 is running. Options in these files apply to all Mercurial commands
60 is running. Options in these files apply to all Mercurial commands
61 executed by any user in any directory. Options in these files
61 executed by any user in any directory. Options in these files
62 override per-installation options.
62 override per-installation options.
63
63
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
68
68
69 Per-installation configuration files, searched for in the
69 Per-installation configuration files, searched for in the
70 directory where Mercurial is installed. ``<install-root>`` is the
70 directory where Mercurial is installed. ``<install-root>`` is the
71 parent directory of the **hg** executable (or symlink) being run. For
71 parent directory of the **hg** executable (or symlink) being run. For
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
74 to all Mercurial commands executed by any user in any directory.
74 to all Mercurial commands executed by any user in any directory.
75
75
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
79
79
80 Per-installation/system configuration files, for the system on
80 Per-installation/system configuration files, for the system on
81 which Mercurial is running. Options in these files apply to all
81 which Mercurial is running. Options in these files apply to all
82 Mercurial commands executed by any user in any directory. Registry
82 Mercurial commands executed by any user in any directory. Registry
83 keys contain PATH-like strings, every part of which must reference
83 keys contain PATH-like strings, every part of which must reference
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
85 be read. Mercurial checks each of these locations in the specified
85 be read. Mercurial checks each of these locations in the specified
86 order until one or more configuration files are detected.
86 order until one or more configuration files are detected.
87
87
88 Syntax
88 Syntax
89 ------
89 ======
90
90
91 A configuration file consists of sections, led by a ``[section]`` header
91 A configuration file consists of sections, led by a ``[section]`` header
92 and followed by ``name = value`` entries (sometimes called
92 and followed by ``name = value`` entries (sometimes called
93 ``configuration keys``)::
93 ``configuration keys``)::
94
94
95 [spam]
95 [spam]
96 eggs=ham
96 eggs=ham
97 green=
97 green=
98 eggs
98 eggs
99
99
100 Each line contains one entry. If the lines that follow are indented,
100 Each line contains one entry. If the lines that follow are indented,
101 they are treated as continuations of that entry. Leading whitespace is
101 they are treated as continuations of that entry. Leading whitespace is
102 removed from values. Empty lines are skipped. Lines beginning with
102 removed from values. Empty lines are skipped. Lines beginning with
103 ``#`` or ``;`` are ignored and may be used to provide comments.
103 ``#`` or ``;`` are ignored and may be used to provide comments.
104
104
105 Configuration keys can be set multiple times, in which case Mercurial
105 Configuration keys can be set multiple times, in which case Mercurial
106 will use the value that was configured last. As an example::
106 will use the value that was configured last. As an example::
107
107
108 [spam]
108 [spam]
109 eggs=large
109 eggs=large
110 ham=serrano
110 ham=serrano
111 eggs=small
111 eggs=small
112
112
113 This would set the configuration key named ``eggs`` to ``small``.
113 This would set the configuration key named ``eggs`` to ``small``.
114
114
115 It is also possible to define a section multiple times. A section can
115 It is also possible to define a section multiple times. A section can
116 be redefined on the same and/or on different configuration files. For
116 be redefined on the same and/or on different configuration files. For
117 example::
117 example::
118
118
119 [foo]
119 [foo]
120 eggs=large
120 eggs=large
121 ham=serrano
121 ham=serrano
122 eggs=small
122 eggs=small
123
123
124 [bar]
124 [bar]
125 eggs=ham
125 eggs=ham
126 green=
126 green=
127 eggs
127 eggs
128
128
129 [foo]
129 [foo]
130 ham=prosciutto
130 ham=prosciutto
131 eggs=medium
131 eggs=medium
132 bread=toasted
132 bread=toasted
133
133
134 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
134 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
135 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
135 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
136 respectively. As you can see there only thing that matters is the last
136 respectively. As you can see there only thing that matters is the last
137 value that was set for each of the configuration keys.
137 value that was set for each of the configuration keys.
138
138
139 If a configuration key is set multiple times in different
139 If a configuration key is set multiple times in different
140 configuration files the final value will depend on the order in which
140 configuration files the final value will depend on the order in which
141 the different configuration files are read, with settings from earlier
141 the different configuration files are read, with settings from earlier
142 paths overriding later ones as described on the ``Files`` section
142 paths overriding later ones as described on the ``Files`` section
143 above.
143 above.
144
144
145 A line of the form ``%include file`` will include ``file`` into the
145 A line of the form ``%include file`` will include ``file`` into the
146 current configuration file. The inclusion is recursive, which means
146 current configuration file. The inclusion is recursive, which means
147 that included files can include other files. Filenames are relative to
147 that included files can include other files. Filenames are relative to
148 the configuration file in which the ``%include`` directive is found.
148 the configuration file in which the ``%include`` directive is found.
149 Environment variables and ``~user`` constructs are expanded in
149 Environment variables and ``~user`` constructs are expanded in
150 ``file``. This lets you do something like::
150 ``file``. This lets you do something like::
151
151
152 %include ~/.hgrc.d/$HOST.rc
152 %include ~/.hgrc.d/$HOST.rc
153
153
154 to include a different configuration file on each computer you use.
154 to include a different configuration file on each computer you use.
155
155
156 A line with ``%unset name`` will remove ``name`` from the current
156 A line with ``%unset name`` will remove ``name`` from the current
157 section, if it has been set previously.
157 section, if it has been set previously.
158
158
159 The values are either free-form text strings, lists of text strings,
159 The values are either free-form text strings, lists of text strings,
160 or Boolean values. Boolean values can be set to true using any of "1",
160 or Boolean values. Boolean values can be set to true using any of "1",
161 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
161 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
162 (all case insensitive).
162 (all case insensitive).
163
163
164 List values are separated by whitespace or comma, except when values are
164 List values are separated by whitespace or comma, except when values are
165 placed in double quotation marks::
165 placed in double quotation marks::
166
166
167 allow_read = "John Doe, PhD", brian, betty
167 allow_read = "John Doe, PhD", brian, betty
168
168
169 Quotation marks can be escaped by prefixing them with a backslash. Only
169 Quotation marks can be escaped by prefixing them with a backslash. Only
170 quotation marks at the beginning of a word is counted as a quotation
170 quotation marks at the beginning of a word is counted as a quotation
171 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
171 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
172
172
173 Sections
173 Sections
174 --------
174 ========
175
175
176 This section describes the different sections that may appear in a
176 This section describes the different sections that may appear in a
177 Mercurial configuration file, the purpose of each section, its possible
177 Mercurial configuration file, the purpose of each section, its possible
178 keys, and their possible values.
178 keys, and their possible values.
179
179
180 ``alias``
180 ``alias``
181 """""""""
181 ---------
182
182
183 Defines command aliases.
183 Defines command aliases.
184 Aliases allow you to define your own commands in terms of other
184 Aliases allow you to define your own commands in terms of other
185 commands (or aliases), optionally including arguments. Positional
185 commands (or aliases), optionally including arguments. Positional
186 arguments in the form of ``$1``, ``$2``, etc in the alias definition
186 arguments in the form of ``$1``, ``$2``, etc in the alias definition
187 are expanded by Mercurial before execution. Positional arguments not
187 are expanded by Mercurial before execution. Positional arguments not
188 already used by ``$N`` in the definition are put at the end of the
188 already used by ``$N`` in the definition are put at the end of the
189 command to be executed.
189 command to be executed.
190
190
191 Alias definitions consist of lines of the form::
191 Alias definitions consist of lines of the form::
192
192
193 <alias> = <command> [<argument>]...
193 <alias> = <command> [<argument>]...
194
194
195 For example, this definition::
195 For example, this definition::
196
196
197 latest = log --limit 5
197 latest = log --limit 5
198
198
199 creates a new command ``latest`` that shows only the five most recent
199 creates a new command ``latest`` that shows only the five most recent
200 changesets. You can define subsequent aliases using earlier ones::
200 changesets. You can define subsequent aliases using earlier ones::
201
201
202 stable5 = latest -b stable
202 stable5 = latest -b stable
203
203
204 .. note:: It is possible to create aliases with the same names as
204 .. note:: It is possible to create aliases with the same names as
205 existing commands, which will then override the original
205 existing commands, which will then override the original
206 definitions. This is almost always a bad idea!
206 definitions. This is almost always a bad idea!
207
207
208 An alias can start with an exclamation point (``!``) to make it a
208 An alias can start with an exclamation point (``!``) to make it a
209 shell alias. A shell alias is executed with the shell and will let you
209 shell alias. A shell alias is executed with the shell and will let you
210 run arbitrary commands. As an example, ::
210 run arbitrary commands. As an example, ::
211
211
212 echo = !echo $@
212 echo = !echo $@
213
213
214 will let you do ``hg echo foo`` to have ``foo`` printed in your
214 will let you do ``hg echo foo`` to have ``foo`` printed in your
215 terminal. A better example might be::
215 terminal. A better example might be::
216
216
217 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
217 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
218
218
219 which will make ``hg purge`` delete all unknown files in the
219 which will make ``hg purge`` delete all unknown files in the
220 repository in the same manner as the purge extension.
220 repository in the same manner as the purge extension.
221
221
222 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
222 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
223 expand to the command arguments. Unmatched arguments are
223 expand to the command arguments. Unmatched arguments are
224 removed. ``$0`` expands to the alias name and ``$@`` expands to all
224 removed. ``$0`` expands to the alias name and ``$@`` expands to all
225 arguments separated by a space. These expansions happen before the
225 arguments separated by a space. These expansions happen before the
226 command is passed to the shell.
226 command is passed to the shell.
227
227
228 Shell aliases are executed in an environment where ``$HG`` expands to
228 Shell aliases are executed in an environment where ``$HG`` expands to
229 the path of the Mercurial that was used to execute the alias. This is
229 the path of the Mercurial that was used to execute the alias. This is
230 useful when you want to call further Mercurial commands in a shell
230 useful when you want to call further Mercurial commands in a shell
231 alias, as was done above for the purge alias. In addition,
231 alias, as was done above for the purge alias. In addition,
232 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
232 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
233 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
233 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
234
234
235 .. note:: Some global configuration options such as ``-R`` are
235 .. note:: Some global configuration options such as ``-R`` are
236 processed before shell aliases and will thus not be passed to
236 processed before shell aliases and will thus not be passed to
237 aliases.
237 aliases.
238
238
239
239
240 ``annotate``
240 ``annotate``
241 """"""""""""
241 ------------
242
242
243 Settings used when displaying file annotations. All values are
243 Settings used when displaying file annotations. All values are
244 Booleans and default to False. See ``diff`` section for related
244 Booleans and default to False. See ``diff`` section for related
245 options for the diff command.
245 options for the diff command.
246
246
247 ``ignorews``
247 ``ignorews``
248 Ignore white space when comparing lines.
248 Ignore white space when comparing lines.
249
249
250 ``ignorewsamount``
250 ``ignorewsamount``
251 Ignore changes in the amount of white space.
251 Ignore changes in the amount of white space.
252
252
253 ``ignoreblanklines``
253 ``ignoreblanklines``
254 Ignore changes whose lines are all blank.
254 Ignore changes whose lines are all blank.
255
255
256
256
257 ``auth``
257 ``auth``
258 """"""""
258 --------
259
259
260 Authentication credentials for HTTP authentication. This section
260 Authentication credentials for HTTP authentication. This section
261 allows you to store usernames and passwords for use when logging
261 allows you to store usernames and passwords for use when logging
262 *into* HTTP servers. See the ``[web]`` configuration section if
262 *into* HTTP servers. See the ``[web]`` configuration section if
263 you want to configure *who* can login to your HTTP server.
263 you want to configure *who* can login to your HTTP server.
264
264
265 Each line has the following format::
265 Each line has the following format::
266
266
267 <name>.<argument> = <value>
267 <name>.<argument> = <value>
268
268
269 where ``<name>`` is used to group arguments into authentication
269 where ``<name>`` is used to group arguments into authentication
270 entries. Example::
270 entries. Example::
271
271
272 foo.prefix = hg.intevation.org/mercurial
272 foo.prefix = hg.intevation.org/mercurial
273 foo.username = foo
273 foo.username = foo
274 foo.password = bar
274 foo.password = bar
275 foo.schemes = http https
275 foo.schemes = http https
276
276
277 bar.prefix = secure.example.org
277 bar.prefix = secure.example.org
278 bar.key = path/to/file.key
278 bar.key = path/to/file.key
279 bar.cert = path/to/file.cert
279 bar.cert = path/to/file.cert
280 bar.schemes = https
280 bar.schemes = https
281
281
282 Supported arguments:
282 Supported arguments:
283
283
284 ``prefix``
284 ``prefix``
285 Either ``*`` or a URI prefix with or without the scheme part.
285 Either ``*`` or a URI prefix with or without the scheme part.
286 The authentication entry with the longest matching prefix is used
286 The authentication entry with the longest matching prefix is used
287 (where ``*`` matches everything and counts as a match of length
287 (where ``*`` matches everything and counts as a match of length
288 1). If the prefix doesn't include a scheme, the match is performed
288 1). If the prefix doesn't include a scheme, the match is performed
289 against the URI with its scheme stripped as well, and the schemes
289 against the URI with its scheme stripped as well, and the schemes
290 argument, q.v., is then subsequently consulted.
290 argument, q.v., is then subsequently consulted.
291
291
292 ``username``
292 ``username``
293 Optional. Username to authenticate with. If not given, and the
293 Optional. Username to authenticate with. If not given, and the
294 remote site requires basic or digest authentication, the user will
294 remote site requires basic or digest authentication, the user will
295 be prompted for it. Environment variables are expanded in the
295 be prompted for it. Environment variables are expanded in the
296 username letting you do ``foo.username = $USER``. If the URI
296 username letting you do ``foo.username = $USER``. If the URI
297 includes a username, only ``[auth]`` entries with a matching
297 includes a username, only ``[auth]`` entries with a matching
298 username or without a username will be considered.
298 username or without a username will be considered.
299
299
300 ``password``
300 ``password``
301 Optional. Password to authenticate with. If not given, and the
301 Optional. Password to authenticate with. If not given, and the
302 remote site requires basic or digest authentication, the user
302 remote site requires basic or digest authentication, the user
303 will be prompted for it.
303 will be prompted for it.
304
304
305 ``key``
305 ``key``
306 Optional. PEM encoded client certificate key file. Environment
306 Optional. PEM encoded client certificate key file. Environment
307 variables are expanded in the filename.
307 variables are expanded in the filename.
308
308
309 ``cert``
309 ``cert``
310 Optional. PEM encoded client certificate chain file. Environment
310 Optional. PEM encoded client certificate chain file. Environment
311 variables are expanded in the filename.
311 variables are expanded in the filename.
312
312
313 ``schemes``
313 ``schemes``
314 Optional. Space separated list of URI schemes to use this
314 Optional. Space separated list of URI schemes to use this
315 authentication entry with. Only used if the prefix doesn't include
315 authentication entry with. Only used if the prefix doesn't include
316 a scheme. Supported schemes are http and https. They will match
316 a scheme. Supported schemes are http and https. They will match
317 static-http and static-https respectively, as well.
317 static-http and static-https respectively, as well.
318 Default: https.
318 Default: https.
319
319
320 If no suitable authentication entry is found, the user is prompted
320 If no suitable authentication entry is found, the user is prompted
321 for credentials as usual if required by the remote.
321 for credentials as usual if required by the remote.
322
322
323
323
324 ``decode/encode``
324 ``decode/encode``
325 """""""""""""""""
325 -----------------
326
326
327 Filters for transforming files on checkout/checkin. This would
327 Filters for transforming files on checkout/checkin. This would
328 typically be used for newline processing or other
328 typically be used for newline processing or other
329 localization/canonicalization of files.
329 localization/canonicalization of files.
330
330
331 Filters consist of a filter pattern followed by a filter command.
331 Filters consist of a filter pattern followed by a filter command.
332 Filter patterns are globs by default, rooted at the repository root.
332 Filter patterns are globs by default, rooted at the repository root.
333 For example, to match any file ending in ``.txt`` in the root
333 For example, to match any file ending in ``.txt`` in the root
334 directory only, use the pattern ``*.txt``. To match any file ending
334 directory only, use the pattern ``*.txt``. To match any file ending
335 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
335 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
336 For each file only the first matching filter applies.
336 For each file only the first matching filter applies.
337
337
338 The filter command can start with a specifier, either ``pipe:`` or
338 The filter command can start with a specifier, either ``pipe:`` or
339 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
339 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
340
340
341 A ``pipe:`` command must accept data on stdin and return the transformed
341 A ``pipe:`` command must accept data on stdin and return the transformed
342 data on stdout.
342 data on stdout.
343
343
344 Pipe example::
344 Pipe example::
345
345
346 [encode]
346 [encode]
347 # uncompress gzip files on checkin to improve delta compression
347 # uncompress gzip files on checkin to improve delta compression
348 # note: not necessarily a good idea, just an example
348 # note: not necessarily a good idea, just an example
349 *.gz = pipe: gunzip
349 *.gz = pipe: gunzip
350
350
351 [decode]
351 [decode]
352 # recompress gzip files when writing them to the working dir (we
352 # recompress gzip files when writing them to the working dir (we
353 # can safely omit "pipe:", because it's the default)
353 # can safely omit "pipe:", because it's the default)
354 *.gz = gzip
354 *.gz = gzip
355
355
356 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
356 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
357 with the name of a temporary file that contains the data to be
357 with the name of a temporary file that contains the data to be
358 filtered by the command. The string ``OUTFILE`` is replaced with the name
358 filtered by the command. The string ``OUTFILE`` is replaced with the name
359 of an empty temporary file, where the filtered data must be written by
359 of an empty temporary file, where the filtered data must be written by
360 the command.
360 the command.
361
361
362 .. note:: The tempfile mechanism is recommended for Windows systems,
362 .. note:: The tempfile mechanism is recommended for Windows systems,
363 where the standard shell I/O redirection operators often have
363 where the standard shell I/O redirection operators often have
364 strange effects and may corrupt the contents of your files.
364 strange effects and may corrupt the contents of your files.
365
365
366 This filter mechanism is used internally by the ``eol`` extension to
366 This filter mechanism is used internally by the ``eol`` extension to
367 translate line ending characters between Windows (CRLF) and Unix (LF)
367 translate line ending characters between Windows (CRLF) and Unix (LF)
368 format. We suggest you use the ``eol`` extension for convenience.
368 format. We suggest you use the ``eol`` extension for convenience.
369
369
370
370
371 ``defaults``
371 ``defaults``
372 """"""""""""
372 ------------
373
373
374 (defaults are deprecated. Don't use them. Use aliases instead)
374 (defaults are deprecated. Don't use them. Use aliases instead)
375
375
376 Use the ``[defaults]`` section to define command defaults, i.e. the
376 Use the ``[defaults]`` section to define command defaults, i.e. the
377 default options/arguments to pass to the specified commands.
377 default options/arguments to pass to the specified commands.
378
378
379 The following example makes :hg:`log` run in verbose mode, and
379 The following example makes :hg:`log` run in verbose mode, and
380 :hg:`status` show only the modified files, by default::
380 :hg:`status` show only the modified files, by default::
381
381
382 [defaults]
382 [defaults]
383 log = -v
383 log = -v
384 status = -m
384 status = -m
385
385
386 The actual commands, instead of their aliases, must be used when
386 The actual commands, instead of their aliases, must be used when
387 defining command defaults. The command defaults will also be applied
387 defining command defaults. The command defaults will also be applied
388 to the aliases of the commands defined.
388 to the aliases of the commands defined.
389
389
390
390
391 ``diff``
391 ``diff``
392 """"""""
392 --------
393
393
394 Settings used when displaying diffs. Everything except for ``unified``
394 Settings used when displaying diffs. Everything except for ``unified``
395 is a Boolean and defaults to False. See ``annotate`` section for
395 is a Boolean and defaults to False. See ``annotate`` section for
396 related options for the annotate command.
396 related options for the annotate command.
397
397
398 ``git``
398 ``git``
399 Use git extended diff format.
399 Use git extended diff format.
400
400
401 ``nodates``
401 ``nodates``
402 Don't include dates in diff headers.
402 Don't include dates in diff headers.
403
403
404 ``showfunc``
404 ``showfunc``
405 Show which function each change is in.
405 Show which function each change is in.
406
406
407 ``ignorews``
407 ``ignorews``
408 Ignore white space when comparing lines.
408 Ignore white space when comparing lines.
409
409
410 ``ignorewsamount``
410 ``ignorewsamount``
411 Ignore changes in the amount of white space.
411 Ignore changes in the amount of white space.
412
412
413 ``ignoreblanklines``
413 ``ignoreblanklines``
414 Ignore changes whose lines are all blank.
414 Ignore changes whose lines are all blank.
415
415
416 ``unified``
416 ``unified``
417 Number of lines of context to show.
417 Number of lines of context to show.
418
418
419 ``email``
419 ``email``
420 """""""""
420 ---------
421
421
422 Settings for extensions that send email messages.
422 Settings for extensions that send email messages.
423
423
424 ``from``
424 ``from``
425 Optional. Email address to use in "From" header and SMTP envelope
425 Optional. Email address to use in "From" header and SMTP envelope
426 of outgoing messages.
426 of outgoing messages.
427
427
428 ``to``
428 ``to``
429 Optional. Comma-separated list of recipients' email addresses.
429 Optional. Comma-separated list of recipients' email addresses.
430
430
431 ``cc``
431 ``cc``
432 Optional. Comma-separated list of carbon copy recipients'
432 Optional. Comma-separated list of carbon copy recipients'
433 email addresses.
433 email addresses.
434
434
435 ``bcc``
435 ``bcc``
436 Optional. Comma-separated list of blind carbon copy recipients'
436 Optional. Comma-separated list of blind carbon copy recipients'
437 email addresses.
437 email addresses.
438
438
439 ``method``
439 ``method``
440 Optional. Method to use to send email messages. If value is ``smtp``
440 Optional. Method to use to send email messages. If value is ``smtp``
441 (default), use SMTP (see the ``[smtp]`` section for configuration).
441 (default), use SMTP (see the ``[smtp]`` section for configuration).
442 Otherwise, use as name of program to run that acts like sendmail
442 Otherwise, use as name of program to run that acts like sendmail
443 (takes ``-f`` option for sender, list of recipients on command line,
443 (takes ``-f`` option for sender, list of recipients on command line,
444 message on stdin). Normally, setting this to ``sendmail`` or
444 message on stdin). Normally, setting this to ``sendmail`` or
445 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
445 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
446
446
447 ``charsets``
447 ``charsets``
448 Optional. Comma-separated list of character sets considered
448 Optional. Comma-separated list of character sets considered
449 convenient for recipients. Addresses, headers, and parts not
449 convenient for recipients. Addresses, headers, and parts not
450 containing patches of outgoing messages will be encoded in the
450 containing patches of outgoing messages will be encoded in the
451 first character set to which conversion from local encoding
451 first character set to which conversion from local encoding
452 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
452 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
453 conversion fails, the text in question is sent as is. Defaults to
453 conversion fails, the text in question is sent as is. Defaults to
454 empty (explicit) list.
454 empty (explicit) list.
455
455
456 Order of outgoing email character sets:
456 Order of outgoing email character sets:
457
457
458 1. ``us-ascii``: always first, regardless of settings
458 1. ``us-ascii``: always first, regardless of settings
459 2. ``email.charsets``: in order given by user
459 2. ``email.charsets``: in order given by user
460 3. ``ui.fallbackencoding``: if not in email.charsets
460 3. ``ui.fallbackencoding``: if not in email.charsets
461 4. ``$HGENCODING``: if not in email.charsets
461 4. ``$HGENCODING``: if not in email.charsets
462 5. ``utf-8``: always last, regardless of settings
462 5. ``utf-8``: always last, regardless of settings
463
463
464 Email example::
464 Email example::
465
465
466 [email]
466 [email]
467 from = Joseph User <joe.user@example.com>
467 from = Joseph User <joe.user@example.com>
468 method = /usr/sbin/sendmail
468 method = /usr/sbin/sendmail
469 # charsets for western Europeans
469 # charsets for western Europeans
470 # us-ascii, utf-8 omitted, as they are tried first and last
470 # us-ascii, utf-8 omitted, as they are tried first and last
471 charsets = iso-8859-1, iso-8859-15, windows-1252
471 charsets = iso-8859-1, iso-8859-15, windows-1252
472
472
473
473
474 ``extensions``
474 ``extensions``
475 """"""""""""""
475 --------------
476
476
477 Mercurial has an extension mechanism for adding new features. To
477 Mercurial has an extension mechanism for adding new features. To
478 enable an extension, create an entry for it in this section.
478 enable an extension, create an entry for it in this section.
479
479
480 If you know that the extension is already in Python's search path,
480 If you know that the extension is already in Python's search path,
481 you can give the name of the module, followed by ``=``, with nothing
481 you can give the name of the module, followed by ``=``, with nothing
482 after the ``=``.
482 after the ``=``.
483
483
484 Otherwise, give a name that you choose, followed by ``=``, followed by
484 Otherwise, give a name that you choose, followed by ``=``, followed by
485 the path to the ``.py`` file (including the file name extension) that
485 the path to the ``.py`` file (including the file name extension) that
486 defines the extension.
486 defines the extension.
487
487
488 To explicitly disable an extension that is enabled in an hgrc of
488 To explicitly disable an extension that is enabled in an hgrc of
489 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
489 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
490 or ``foo = !`` when path is not supplied.
490 or ``foo = !`` when path is not supplied.
491
491
492 Example for ``~/.hgrc``::
492 Example for ``~/.hgrc``::
493
493
494 [extensions]
494 [extensions]
495 # (the mq extension will get loaded from Mercurial's path)
495 # (the mq extension will get loaded from Mercurial's path)
496 mq =
496 mq =
497 # (this extension will get loaded from the file specified)
497 # (this extension will get loaded from the file specified)
498 myfeature = ~/.hgext/myfeature.py
498 myfeature = ~/.hgext/myfeature.py
499
499
500
500
501 ``format``
501 ``format``
502 """"""""""
502 ----------
503
503
504 ``usestore``
504 ``usestore``
505 Enable or disable the "store" repository format which improves
505 Enable or disable the "store" repository format which improves
506 compatibility with systems that fold case or otherwise mangle
506 compatibility with systems that fold case or otherwise mangle
507 filenames. Enabled by default. Disabling this option will allow
507 filenames. Enabled by default. Disabling this option will allow
508 you to store longer filenames in some situations at the expense of
508 you to store longer filenames in some situations at the expense of
509 compatibility and ensures that the on-disk format of newly created
509 compatibility and ensures that the on-disk format of newly created
510 repositories will be compatible with Mercurial before version 0.9.4.
510 repositories will be compatible with Mercurial before version 0.9.4.
511
511
512 ``usefncache``
512 ``usefncache``
513 Enable or disable the "fncache" repository format which enhances
513 Enable or disable the "fncache" repository format which enhances
514 the "store" repository format (which has to be enabled to use
514 the "store" repository format (which has to be enabled to use
515 fncache) to allow longer filenames and avoids using Windows
515 fncache) to allow longer filenames and avoids using Windows
516 reserved names, e.g. "nul". Enabled by default. Disabling this
516 reserved names, e.g. "nul". Enabled by default. Disabling this
517 option ensures that the on-disk format of newly created
517 option ensures that the on-disk format of newly created
518 repositories will be compatible with Mercurial before version 1.1.
518 repositories will be compatible with Mercurial before version 1.1.
519
519
520 ``dotencode``
520 ``dotencode``
521 Enable or disable the "dotencode" repository format which enhances
521 Enable or disable the "dotencode" repository format which enhances
522 the "fncache" repository format (which has to be enabled to use
522 the "fncache" repository format (which has to be enabled to use
523 dotencode) to avoid issues with filenames starting with ._ on
523 dotencode) to avoid issues with filenames starting with ._ on
524 Mac OS X and spaces on Windows. Enabled by default. Disabling this
524 Mac OS X and spaces on Windows. Enabled by default. Disabling this
525 option ensures that the on-disk format of newly created
525 option ensures that the on-disk format of newly created
526 repositories will be compatible with Mercurial before version 1.7.
526 repositories will be compatible with Mercurial before version 1.7.
527
527
528 ``graph``
528 ``graph``
529 """""""""
529 ---------
530
530
531 Web graph view configuration. This section let you change graph
531 Web graph view configuration. This section let you change graph
532 elements display properties by branches, for instance to make the
532 elements display properties by branches, for instance to make the
533 ``default`` branch stand out.
533 ``default`` branch stand out.
534
534
535 Each line has the following format::
535 Each line has the following format::
536
536
537 <branch>.<argument> = <value>
537 <branch>.<argument> = <value>
538
538
539 where ``<branch>`` is the name of the branch being
539 where ``<branch>`` is the name of the branch being
540 customized. Example::
540 customized. Example::
541
541
542 [graph]
542 [graph]
543 # 2px width
543 # 2px width
544 default.width = 2
544 default.width = 2
545 # red color
545 # red color
546 default.color = FF0000
546 default.color = FF0000
547
547
548 Supported arguments:
548 Supported arguments:
549
549
550 ``width``
550 ``width``
551 Set branch edges width in pixels.
551 Set branch edges width in pixels.
552
552
553 ``color``
553 ``color``
554 Set branch edges color in hexadecimal RGB notation.
554 Set branch edges color in hexadecimal RGB notation.
555
555
556 ``hooks``
556 ``hooks``
557 """""""""
557 ---------
558
558
559 Commands or Python functions that get automatically executed by
559 Commands or Python functions that get automatically executed by
560 various actions such as starting or finishing a commit. Multiple
560 various actions such as starting or finishing a commit. Multiple
561 hooks can be run for the same action by appending a suffix to the
561 hooks can be run for the same action by appending a suffix to the
562 action. Overriding a site-wide hook can be done by changing its
562 action. Overriding a site-wide hook can be done by changing its
563 value or setting it to an empty string. Hooks can be prioritized
563 value or setting it to an empty string. Hooks can be prioritized
564 by adding a prefix of ``priority`` to the hook name on a new line
564 by adding a prefix of ``priority`` to the hook name on a new line
565 and setting the priority. The default priority is 0 if
565 and setting the priority. The default priority is 0 if
566 not specified.
566 not specified.
567
567
568 Example ``.hg/hgrc``::
568 Example ``.hg/hgrc``::
569
569
570 [hooks]
570 [hooks]
571 # update working directory after adding changesets
571 # update working directory after adding changesets
572 changegroup.update = hg update
572 changegroup.update = hg update
573 # do not use the site-wide hook
573 # do not use the site-wide hook
574 incoming =
574 incoming =
575 incoming.email = /my/email/hook
575 incoming.email = /my/email/hook
576 incoming.autobuild = /my/build/hook
576 incoming.autobuild = /my/build/hook
577 # force autobuild hook to run before other incoming hooks
577 # force autobuild hook to run before other incoming hooks
578 priority.incoming.autobuild = 1
578 priority.incoming.autobuild = 1
579
579
580 Most hooks are run with environment variables set that give useful
580 Most hooks are run with environment variables set that give useful
581 additional information. For each hook below, the environment
581 additional information. For each hook below, the environment
582 variables it is passed are listed with names of the form ``$HG_foo``.
582 variables it is passed are listed with names of the form ``$HG_foo``.
583
583
584 ``changegroup``
584 ``changegroup``
585 Run after a changegroup has been added via push, pull or unbundle.
585 Run after a changegroup has been added via push, pull or unbundle.
586 ID of the first new changeset is in ``$HG_NODE``. URL from which
586 ID of the first new changeset is in ``$HG_NODE``. URL from which
587 changes came is in ``$HG_URL``.
587 changes came is in ``$HG_URL``.
588
588
589 ``commit``
589 ``commit``
590 Run after a changeset has been created in the local repository. ID
590 Run after a changeset has been created in the local repository. ID
591 of the newly created changeset is in ``$HG_NODE``. Parent changeset
591 of the newly created changeset is in ``$HG_NODE``. Parent changeset
592 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
592 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
593
593
594 ``incoming``
594 ``incoming``
595 Run after a changeset has been pulled, pushed, or unbundled into
595 Run after a changeset has been pulled, pushed, or unbundled into
596 the local repository. The ID of the newly arrived changeset is in
596 the local repository. The ID of the newly arrived changeset is in
597 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
597 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
598
598
599 ``outgoing``
599 ``outgoing``
600 Run after sending changes from local repository to another. ID of
600 Run after sending changes from local repository to another. ID of
601 first changeset sent is in ``$HG_NODE``. Source of operation is in
601 first changeset sent is in ``$HG_NODE``. Source of operation is in
602 ``$HG_SOURCE``; see "preoutgoing" hook for description.
602 ``$HG_SOURCE``; see "preoutgoing" hook for description.
603
603
604 ``post-<command>``
604 ``post-<command>``
605 Run after successful invocations of the associated command. The
605 Run after successful invocations of the associated command. The
606 contents of the command line are passed as ``$HG_ARGS`` and the result
606 contents of the command line are passed as ``$HG_ARGS`` and the result
607 code in ``$HG_RESULT``. Parsed command line arguments are passed as
607 code in ``$HG_RESULT``. Parsed command line arguments are passed as
608 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
608 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
609 the python data internally passed to <command>. ``$HG_OPTS`` is a
609 the python data internally passed to <command>. ``$HG_OPTS`` is a
610 dictionary of options (with unspecified options set to their defaults).
610 dictionary of options (with unspecified options set to their defaults).
611 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
611 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
612
612
613 ``pre-<command>``
613 ``pre-<command>``
614 Run before executing the associated command. The contents of the
614 Run before executing the associated command. The contents of the
615 command line are passed as ``$HG_ARGS``. Parsed command line arguments
615 command line are passed as ``$HG_ARGS``. Parsed command line arguments
616 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
616 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
617 representations of the data internally passed to <command>. ``$HG_OPTS``
617 representations of the data internally passed to <command>. ``$HG_OPTS``
618 is a dictionary of options (with unspecified options set to their
618 is a dictionary of options (with unspecified options set to their
619 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
619 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
620 failure, the command doesn't execute and Mercurial returns the failure
620 failure, the command doesn't execute and Mercurial returns the failure
621 code.
621 code.
622
622
623 ``prechangegroup``
623 ``prechangegroup``
624 Run before a changegroup is added via push, pull or unbundle. Exit
624 Run before a changegroup is added via push, pull or unbundle. Exit
625 status 0 allows the changegroup to proceed. Non-zero status will
625 status 0 allows the changegroup to proceed. Non-zero status will
626 cause the push, pull or unbundle to fail. URL from which changes
626 cause the push, pull or unbundle to fail. URL from which changes
627 will come is in ``$HG_URL``.
627 will come is in ``$HG_URL``.
628
628
629 ``precommit``
629 ``precommit``
630 Run before starting a local commit. Exit status 0 allows the
630 Run before starting a local commit. Exit status 0 allows the
631 commit to proceed. Non-zero status will cause the commit to fail.
631 commit to proceed. Non-zero status will cause the commit to fail.
632 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
632 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
633
633
634 ``prelistkeys``
634 ``prelistkeys``
635 Run before listing pushkeys (like bookmarks) in the
635 Run before listing pushkeys (like bookmarks) in the
636 repository. Non-zero status will cause failure. The key namespace is
636 repository. Non-zero status will cause failure. The key namespace is
637 in ``$HG_NAMESPACE``.
637 in ``$HG_NAMESPACE``.
638
638
639 ``preoutgoing``
639 ``preoutgoing``
640 Run before collecting changes to send from the local repository to
640 Run before collecting changes to send from the local repository to
641 another. Non-zero status will cause failure. This lets you prevent
641 another. Non-zero status will cause failure. This lets you prevent
642 pull over HTTP or SSH. Also prevents against local pull, push
642 pull over HTTP or SSH. Also prevents against local pull, push
643 (outbound) or bundle commands, but not effective, since you can
643 (outbound) or bundle commands, but not effective, since you can
644 just copy files instead then. Source of operation is in
644 just copy files instead then. Source of operation is in
645 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
645 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
646 SSH or HTTP repository. If "push", "pull" or "bundle", operation
646 SSH or HTTP repository. If "push", "pull" or "bundle", operation
647 is happening on behalf of repository on same system.
647 is happening on behalf of repository on same system.
648
648
649 ``prepushkey``
649 ``prepushkey``
650 Run before a pushkey (like a bookmark) is added to the
650 Run before a pushkey (like a bookmark) is added to the
651 repository. Non-zero status will cause the key to be rejected. The
651 repository. Non-zero status will cause the key to be rejected. The
652 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
652 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
653 the old value (if any) is in ``$HG_OLD``, and the new value is in
653 the old value (if any) is in ``$HG_OLD``, and the new value is in
654 ``$HG_NEW``.
654 ``$HG_NEW``.
655
655
656 ``pretag``
656 ``pretag``
657 Run before creating a tag. Exit status 0 allows the tag to be
657 Run before creating a tag. Exit status 0 allows the tag to be
658 created. Non-zero status will cause the tag to fail. ID of
658 created. Non-zero status will cause the tag to fail. ID of
659 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
659 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
660 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
660 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
661
661
662 ``pretxnchangegroup``
662 ``pretxnchangegroup``
663 Run after a changegroup has been added via push, pull or unbundle,
663 Run after a changegroup has been added via push, pull or unbundle,
664 but before the transaction has been committed. Changegroup is
664 but before the transaction has been committed. Changegroup is
665 visible to hook program. This lets you validate incoming changes
665 visible to hook program. This lets you validate incoming changes
666 before accepting them. Passed the ID of the first new changeset in
666 before accepting them. Passed the ID of the first new changeset in
667 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
667 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
668 status will cause the transaction to be rolled back and the push,
668 status will cause the transaction to be rolled back and the push,
669 pull or unbundle will fail. URL that was source of changes is in
669 pull or unbundle will fail. URL that was source of changes is in
670 ``$HG_URL``.
670 ``$HG_URL``.
671
671
672 ``pretxncommit``
672 ``pretxncommit``
673 Run after a changeset has been created but the transaction not yet
673 Run after a changeset has been created but the transaction not yet
674 committed. Changeset is visible to hook program. This lets you
674 committed. Changeset is visible to hook program. This lets you
675 validate commit message and changes. Exit status 0 allows the
675 validate commit message and changes. Exit status 0 allows the
676 commit to proceed. Non-zero status will cause the transaction to
676 commit to proceed. Non-zero status will cause the transaction to
677 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
677 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
678 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
678 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
679
679
680 ``preupdate``
680 ``preupdate``
681 Run before updating the working directory. Exit status 0 allows
681 Run before updating the working directory. Exit status 0 allows
682 the update to proceed. Non-zero status will prevent the update.
682 the update to proceed. Non-zero status will prevent the update.
683 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
683 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
684 of second new parent is in ``$HG_PARENT2``.
684 of second new parent is in ``$HG_PARENT2``.
685
685
686 ``listkeys``
686 ``listkeys``
687 Run after listing pushkeys (like bookmarks) in the repository. The
687 Run after listing pushkeys (like bookmarks) in the repository. The
688 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
688 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
689 dictionary containing the keys and values.
689 dictionary containing the keys and values.
690
690
691 ``pushkey``
691 ``pushkey``
692 Run after a pushkey (like a bookmark) is added to the
692 Run after a pushkey (like a bookmark) is added to the
693 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
693 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
694 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
694 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
695 value is in ``$HG_NEW``.
695 value is in ``$HG_NEW``.
696
696
697 ``tag``
697 ``tag``
698 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
698 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
699 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
699 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
700 repository if ``$HG_LOCAL=0``.
700 repository if ``$HG_LOCAL=0``.
701
701
702 ``update``
702 ``update``
703 Run after updating the working directory. Changeset ID of first
703 Run after updating the working directory. Changeset ID of first
704 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
704 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
705 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
705 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
706 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
706 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
707
707
708 .. note:: It is generally better to use standard hooks rather than the
708 .. note:: It is generally better to use standard hooks rather than the
709 generic pre- and post- command hooks as they are guaranteed to be
709 generic pre- and post- command hooks as they are guaranteed to be
710 called in the appropriate contexts for influencing transactions.
710 called in the appropriate contexts for influencing transactions.
711 Also, hooks like "commit" will be called in all contexts that
711 Also, hooks like "commit" will be called in all contexts that
712 generate a commit (e.g. tag) and not just the commit command.
712 generate a commit (e.g. tag) and not just the commit command.
713
713
714 .. note:: Environment variables with empty values may not be passed to
714 .. note:: Environment variables with empty values may not be passed to
715 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
715 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
716 will have an empty value under Unix-like platforms for non-merge
716 will have an empty value under Unix-like platforms for non-merge
717 changesets, while it will not be available at all under Windows.
717 changesets, while it will not be available at all under Windows.
718
718
719 The syntax for Python hooks is as follows::
719 The syntax for Python hooks is as follows::
720
720
721 hookname = python:modulename.submodule.callable
721 hookname = python:modulename.submodule.callable
722 hookname = python:/path/to/python/module.py:callable
722 hookname = python:/path/to/python/module.py:callable
723
723
724 Python hooks are run within the Mercurial process. Each hook is
724 Python hooks are run within the Mercurial process. Each hook is
725 called with at least three keyword arguments: a ui object (keyword
725 called with at least three keyword arguments: a ui object (keyword
726 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
726 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
727 keyword that tells what kind of hook is used. Arguments listed as
727 keyword that tells what kind of hook is used. Arguments listed as
728 environment variables above are passed as keyword arguments, with no
728 environment variables above are passed as keyword arguments, with no
729 ``HG_`` prefix, and names in lower case.
729 ``HG_`` prefix, and names in lower case.
730
730
731 If a Python hook returns a "true" value or raises an exception, this
731 If a Python hook returns a "true" value or raises an exception, this
732 is treated as a failure.
732 is treated as a failure.
733
733
734
734
735 ``hostfingerprints``
735 ``hostfingerprints``
736 """"""""""""""""""""
736 --------------------
737
737
738 Fingerprints of the certificates of known HTTPS servers.
738 Fingerprints of the certificates of known HTTPS servers.
739 A HTTPS connection to a server with a fingerprint configured here will
739 A HTTPS connection to a server with a fingerprint configured here will
740 only succeed if the servers certificate matches the fingerprint.
740 only succeed if the servers certificate matches the fingerprint.
741 This is very similar to how ssh known hosts works.
741 This is very similar to how ssh known hosts works.
742 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
742 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
743 The CA chain and web.cacerts is not used for servers with a fingerprint.
743 The CA chain and web.cacerts is not used for servers with a fingerprint.
744
744
745 For example::
745 For example::
746
746
747 [hostfingerprints]
747 [hostfingerprints]
748 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
748 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
749
749
750 This feature is only supported when using Python 2.6 or later.
750 This feature is only supported when using Python 2.6 or later.
751
751
752
752
753 ``http_proxy``
753 ``http_proxy``
754 """"""""""""""
754 --------------
755
755
756 Used to access web-based Mercurial repositories through a HTTP
756 Used to access web-based Mercurial repositories through a HTTP
757 proxy.
757 proxy.
758
758
759 ``host``
759 ``host``
760 Host name and (optional) port of the proxy server, for example
760 Host name and (optional) port of the proxy server, for example
761 "myproxy:8000".
761 "myproxy:8000".
762
762
763 ``no``
763 ``no``
764 Optional. Comma-separated list of host names that should bypass
764 Optional. Comma-separated list of host names that should bypass
765 the proxy.
765 the proxy.
766
766
767 ``passwd``
767 ``passwd``
768 Optional. Password to authenticate with at the proxy server.
768 Optional. Password to authenticate with at the proxy server.
769
769
770 ``user``
770 ``user``
771 Optional. User name to authenticate with at the proxy server.
771 Optional. User name to authenticate with at the proxy server.
772
772
773 ``always``
773 ``always``
774 Optional. Always use the proxy, even for localhost and any entries
774 Optional. Always use the proxy, even for localhost and any entries
775 in ``http_proxy.no``. True or False. Default: False.
775 in ``http_proxy.no``. True or False. Default: False.
776
776
777 ``merge-patterns``
777 ``merge-patterns``
778 """"""""""""""""""
778 ------------------
779
779
780 This section specifies merge tools to associate with particular file
780 This section specifies merge tools to associate with particular file
781 patterns. Tools matched here will take precedence over the default
781 patterns. Tools matched here will take precedence over the default
782 merge tool. Patterns are globs by default, rooted at the repository
782 merge tool. Patterns are globs by default, rooted at the repository
783 root.
783 root.
784
784
785 Example::
785 Example::
786
786
787 [merge-patterns]
787 [merge-patterns]
788 **.c = kdiff3
788 **.c = kdiff3
789 **.jpg = myimgmerge
789 **.jpg = myimgmerge
790
790
791 ``merge-tools``
791 ``merge-tools``
792 """""""""""""""
792 ---------------
793
793
794 This section configures external merge tools to use for file-level
794 This section configures external merge tools to use for file-level
795 merges.
795 merges.
796
796
797 Example ``~/.hgrc``::
797 Example ``~/.hgrc``::
798
798
799 [merge-tools]
799 [merge-tools]
800 # Override stock tool location
800 # Override stock tool location
801 kdiff3.executable = ~/bin/kdiff3
801 kdiff3.executable = ~/bin/kdiff3
802 # Specify command line
802 # Specify command line
803 kdiff3.args = $base $local $other -o $output
803 kdiff3.args = $base $local $other -o $output
804 # Give higher priority
804 # Give higher priority
805 kdiff3.priority = 1
805 kdiff3.priority = 1
806
806
807 # Define new tool
807 # Define new tool
808 myHtmlTool.args = -m $local $other $base $output
808 myHtmlTool.args = -m $local $other $base $output
809 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
809 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
810 myHtmlTool.priority = 1
810 myHtmlTool.priority = 1
811
811
812 Supported arguments:
812 Supported arguments:
813
813
814 ``priority``
814 ``priority``
815 The priority in which to evaluate this tool.
815 The priority in which to evaluate this tool.
816 Default: 0.
816 Default: 0.
817
817
818 ``executable``
818 ``executable``
819 Either just the name of the executable or its pathname. On Windows,
819 Either just the name of the executable or its pathname. On Windows,
820 the path can use environment variables with ${ProgramFiles} syntax.
820 the path can use environment variables with ${ProgramFiles} syntax.
821 Default: the tool name.
821 Default: the tool name.
822
822
823 ``args``
823 ``args``
824 The arguments to pass to the tool executable. You can refer to the
824 The arguments to pass to the tool executable. You can refer to the
825 files being merged as well as the output file through these
825 files being merged as well as the output file through these
826 variables: ``$base``, ``$local``, ``$other``, ``$output``.
826 variables: ``$base``, ``$local``, ``$other``, ``$output``.
827 Default: ``$local $base $other``
827 Default: ``$local $base $other``
828
828
829 ``premerge``
829 ``premerge``
830 Attempt to run internal non-interactive 3-way merge tool before
830 Attempt to run internal non-interactive 3-way merge tool before
831 launching external tool. Options are ``true``, ``false``, or ``keep``
831 launching external tool. Options are ``true``, ``false``, or ``keep``
832 to leave markers in the file if the premerge fails.
832 to leave markers in the file if the premerge fails.
833 Default: True
833 Default: True
834
834
835 ``binary``
835 ``binary``
836 This tool can merge binary files. Defaults to False, unless tool
836 This tool can merge binary files. Defaults to False, unless tool
837 was selected by file pattern match.
837 was selected by file pattern match.
838
838
839 ``symlink``
839 ``symlink``
840 This tool can merge symlinks. Defaults to False, even if tool was
840 This tool can merge symlinks. Defaults to False, even if tool was
841 selected by file pattern match.
841 selected by file pattern match.
842
842
843 ``check``
843 ``check``
844 A list of merge success-checking options:
844 A list of merge success-checking options:
845
845
846 ``changed``
846 ``changed``
847 Ask whether merge was successful when the merged file shows no changes.
847 Ask whether merge was successful when the merged file shows no changes.
848 ``conflicts``
848 ``conflicts``
849 Check whether there are conflicts even though the tool reported success.
849 Check whether there are conflicts even though the tool reported success.
850 ``prompt``
850 ``prompt``
851 Always prompt for merge success, regardless of success reported by tool.
851 Always prompt for merge success, regardless of success reported by tool.
852
852
853 ``checkchanged``
853 ``checkchanged``
854 True is equivalent to ``check = changed``.
854 True is equivalent to ``check = changed``.
855 Default: False
855 Default: False
856
856
857 ``checkconflicts``
857 ``checkconflicts``
858 True is equivalent to ``check = conflicts``.
858 True is equivalent to ``check = conflicts``.
859 Default: False
859 Default: False
860
860
861 ``fixeol``
861 ``fixeol``
862 Attempt to fix up EOL changes caused by the merge tool.
862 Attempt to fix up EOL changes caused by the merge tool.
863 Default: False
863 Default: False
864
864
865 ``gui``
865 ``gui``
866 This tool requires a graphical interface to run. Default: False
866 This tool requires a graphical interface to run. Default: False
867
867
868 ``regkey``
868 ``regkey``
869 Windows registry key which describes install location of this
869 Windows registry key which describes install location of this
870 tool. Mercurial will search for this key first under
870 tool. Mercurial will search for this key first under
871 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
871 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
872 Default: None
872 Default: None
873
873
874 ``regkeyalt``
874 ``regkeyalt``
875 An alternate Windows registry key to try if the first key is not
875 An alternate Windows registry key to try if the first key is not
876 found. The alternate key uses the same ``regname`` and ``regappend``
876 found. The alternate key uses the same ``regname`` and ``regappend``
877 semantics of the primary key. The most common use for this key
877 semantics of the primary key. The most common use for this key
878 is to search for 32bit applications on 64bit operating systems.
878 is to search for 32bit applications on 64bit operating systems.
879 Default: None
879 Default: None
880
880
881 ``regname``
881 ``regname``
882 Name of value to read from specified registry key. Defaults to the
882 Name of value to read from specified registry key. Defaults to the
883 unnamed (default) value.
883 unnamed (default) value.
884
884
885 ``regappend``
885 ``regappend``
886 String to append to the value read from the registry, typically
886 String to append to the value read from the registry, typically
887 the executable name of the tool.
887 the executable name of the tool.
888 Default: None
888 Default: None
889
889
890
890
891 ``patch``
891 ``patch``
892 """""""""
892 ---------
893
893
894 Settings used when applying patches, for instance through the 'import'
894 Settings used when applying patches, for instance through the 'import'
895 command or with Mercurial Queues extension.
895 command or with Mercurial Queues extension.
896
896
897 ``eol``
897 ``eol``
898 When set to 'strict' patch content and patched files end of lines
898 When set to 'strict' patch content and patched files end of lines
899 are preserved. When set to ``lf`` or ``crlf``, both files end of
899 are preserved. When set to ``lf`` or ``crlf``, both files end of
900 lines are ignored when patching and the result line endings are
900 lines are ignored when patching and the result line endings are
901 normalized to either LF (Unix) or CRLF (Windows). When set to
901 normalized to either LF (Unix) or CRLF (Windows). When set to
902 ``auto``, end of lines are again ignored while patching but line
902 ``auto``, end of lines are again ignored while patching but line
903 endings in patched files are normalized to their original setting
903 endings in patched files are normalized to their original setting
904 on a per-file basis. If target file does not exist or has no end
904 on a per-file basis. If target file does not exist or has no end
905 of line, patch line endings are preserved.
905 of line, patch line endings are preserved.
906 Default: strict.
906 Default: strict.
907
907
908
908
909 ``paths``
909 ``paths``
910 """""""""
910 ---------
911
911
912 Assigns symbolic names to repositories. The left side is the
912 Assigns symbolic names to repositories. The left side is the
913 symbolic name, and the right gives the directory or URL that is the
913 symbolic name, and the right gives the directory or URL that is the
914 location of the repository. Default paths can be declared by setting
914 location of the repository. Default paths can be declared by setting
915 the following entries.
915 the following entries.
916
916
917 ``default``
917 ``default``
918 Directory or URL to use when pulling if no source is specified.
918 Directory or URL to use when pulling if no source is specified.
919 Default is set to repository from which the current repository was
919 Default is set to repository from which the current repository was
920 cloned.
920 cloned.
921
921
922 ``default-push``
922 ``default-push``
923 Optional. Directory or URL to use when pushing if no destination
923 Optional. Directory or URL to use when pushing if no destination
924 is specified.
924 is specified.
925
925
926 ``phases``
926 ``phases``
927 """"""""""
927 ----------
928
928
929 Specifies default handling of phases. See :hg:`help phases` for more
929 Specifies default handling of phases. See :hg:`help phases` for more
930 information about working with phases.
930 information about working with phases.
931
931
932 ``publish``
932 ``publish``
933 Controls draft phase behavior when working as a server. When true,
933 Controls draft phase behavior when working as a server. When true,
934 pushed changesets are set to public in both client and server and
934 pushed changesets are set to public in both client and server and
935 pulled or cloned changesets are set to public in the client.
935 pulled or cloned changesets are set to public in the client.
936 Default: True
936 Default: True
937
937
938 ``new-commit``
938 ``new-commit``
939 Phase of newly-created commits.
939 Phase of newly-created commits.
940 Default: draft
940 Default: draft
941
941
942 ``profiling``
942 ``profiling``
943 """""""""""""
943 -------------
944
944
945 Specifies profiling type, format, and file output. Two profilers are
945 Specifies profiling type, format, and file output. Two profilers are
946 supported: an instrumenting profiler (named ``ls``), and a sampling
946 supported: an instrumenting profiler (named ``ls``), and a sampling
947 profiler (named ``stat``).
947 profiler (named ``stat``).
948
948
949 In this section description, 'profiling data' stands for the raw data
949 In this section description, 'profiling data' stands for the raw data
950 collected during profiling, while 'profiling report' stands for a
950 collected during profiling, while 'profiling report' stands for a
951 statistical text report generated from the profiling data. The
951 statistical text report generated from the profiling data. The
952 profiling is done using lsprof.
952 profiling is done using lsprof.
953
953
954 ``type``
954 ``type``
955 The type of profiler to use.
955 The type of profiler to use.
956 Default: ls.
956 Default: ls.
957
957
958 ``ls``
958 ``ls``
959 Use Python's built-in instrumenting profiler. This profiler
959 Use Python's built-in instrumenting profiler. This profiler
960 works on all platforms, but each line number it reports is the
960 works on all platforms, but each line number it reports is the
961 first line of a function. This restriction makes it difficult to
961 first line of a function. This restriction makes it difficult to
962 identify the expensive parts of a non-trivial function.
962 identify the expensive parts of a non-trivial function.
963 ``stat``
963 ``stat``
964 Use a third-party statistical profiler, statprof. This profiler
964 Use a third-party statistical profiler, statprof. This profiler
965 currently runs only on Unix systems, and is most useful for
965 currently runs only on Unix systems, and is most useful for
966 profiling commands that run for longer than about 0.1 seconds.
966 profiling commands that run for longer than about 0.1 seconds.
967
967
968 ``format``
968 ``format``
969 Profiling format. Specific to the ``ls`` instrumenting profiler.
969 Profiling format. Specific to the ``ls`` instrumenting profiler.
970 Default: text.
970 Default: text.
971
971
972 ``text``
972 ``text``
973 Generate a profiling report. When saving to a file, it should be
973 Generate a profiling report. When saving to a file, it should be
974 noted that only the report is saved, and the profiling data is
974 noted that only the report is saved, and the profiling data is
975 not kept.
975 not kept.
976 ``kcachegrind``
976 ``kcachegrind``
977 Format profiling data for kcachegrind use: when saving to a
977 Format profiling data for kcachegrind use: when saving to a
978 file, the generated file can directly be loaded into
978 file, the generated file can directly be loaded into
979 kcachegrind.
979 kcachegrind.
980
980
981 ``frequency``
981 ``frequency``
982 Sampling frequency. Specific to the ``stat`` sampling profiler.
982 Sampling frequency. Specific to the ``stat`` sampling profiler.
983 Default: 1000.
983 Default: 1000.
984
984
985 ``output``
985 ``output``
986 File path where profiling data or report should be saved. If the
986 File path where profiling data or report should be saved. If the
987 file exists, it is replaced. Default: None, data is printed on
987 file exists, it is replaced. Default: None, data is printed on
988 stderr
988 stderr
989
989
990 ``revsetalias``
990 ``revsetalias``
991 """""""""""""""
991 ---------------
992
992
993 Alias definitions for revsets. See :hg:`help revsets` for details.
993 Alias definitions for revsets. See :hg:`help revsets` for details.
994
994
995 ``server``
995 ``server``
996 """"""""""
996 ----------
997
997
998 Controls generic server settings.
998 Controls generic server settings.
999
999
1000 ``uncompressed``
1000 ``uncompressed``
1001 Whether to allow clients to clone a repository using the
1001 Whether to allow clients to clone a repository using the
1002 uncompressed streaming protocol. This transfers about 40% more
1002 uncompressed streaming protocol. This transfers about 40% more
1003 data than a regular clone, but uses less memory and CPU on both
1003 data than a regular clone, but uses less memory and CPU on both
1004 server and client. Over a LAN (100 Mbps or better) or a very fast
1004 server and client. Over a LAN (100 Mbps or better) or a very fast
1005 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1005 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1006 regular clone. Over most WAN connections (anything slower than
1006 regular clone. Over most WAN connections (anything slower than
1007 about 6 Mbps), uncompressed streaming is slower, because of the
1007 about 6 Mbps), uncompressed streaming is slower, because of the
1008 extra data transfer overhead. This mode will also temporarily hold
1008 extra data transfer overhead. This mode will also temporarily hold
1009 the write lock while determining what data to transfer.
1009 the write lock while determining what data to transfer.
1010 Default is True.
1010 Default is True.
1011
1011
1012 ``preferuncompressed``
1012 ``preferuncompressed``
1013 When set, clients will try to use the uncompressed streaming
1013 When set, clients will try to use the uncompressed streaming
1014 protocol. Default is False.
1014 protocol. Default is False.
1015
1015
1016 ``validate``
1016 ``validate``
1017 Whether to validate the completeness of pushed changesets by
1017 Whether to validate the completeness of pushed changesets by
1018 checking that all new file revisions specified in manifests are
1018 checking that all new file revisions specified in manifests are
1019 present. Default is False.
1019 present. Default is False.
1020
1020
1021 ``smtp``
1021 ``smtp``
1022 """"""""
1022 --------
1023
1023
1024 Configuration for extensions that need to send email messages.
1024 Configuration for extensions that need to send email messages.
1025
1025
1026 ``host``
1026 ``host``
1027 Host name of mail server, e.g. "mail.example.com".
1027 Host name of mail server, e.g. "mail.example.com".
1028
1028
1029 ``port``
1029 ``port``
1030 Optional. Port to connect to on mail server. Default: 25.
1030 Optional. Port to connect to on mail server. Default: 25.
1031
1031
1032 ``tls``
1032 ``tls``
1033 Optional. Method to enable TLS when connecting to mail server: starttls,
1033 Optional. Method to enable TLS when connecting to mail server: starttls,
1034 smtps or none. Default: none.
1034 smtps or none. Default: none.
1035
1035
1036 ``username``
1036 ``username``
1037 Optional. User name for authenticating with the SMTP server.
1037 Optional. User name for authenticating with the SMTP server.
1038 Default: none.
1038 Default: none.
1039
1039
1040 ``password``
1040 ``password``
1041 Optional. Password for authenticating with the SMTP server. If not
1041 Optional. Password for authenticating with the SMTP server. If not
1042 specified, interactive sessions will prompt the user for a
1042 specified, interactive sessions will prompt the user for a
1043 password; non-interactive sessions will fail. Default: none.
1043 password; non-interactive sessions will fail. Default: none.
1044
1044
1045 ``local_hostname``
1045 ``local_hostname``
1046 Optional. It's the hostname that the sender can use to identify
1046 Optional. It's the hostname that the sender can use to identify
1047 itself to the MTA.
1047 itself to the MTA.
1048
1048
1049
1049
1050 ``subpaths``
1050 ``subpaths``
1051 """"""""""""
1051 ------------
1052
1052
1053 Subrepository source URLs can go stale if a remote server changes name
1053 Subrepository source URLs can go stale if a remote server changes name
1054 or becomes temporarily unavailable. This section lets you define
1054 or becomes temporarily unavailable. This section lets you define
1055 rewrite rules of the form::
1055 rewrite rules of the form::
1056
1056
1057 <pattern> = <replacement>
1057 <pattern> = <replacement>
1058
1058
1059 where ``pattern`` is a regular expression matching a subrepository
1059 where ``pattern`` is a regular expression matching a subrepository
1060 source URL and ``replacement`` is the replacement string used to
1060 source URL and ``replacement`` is the replacement string used to
1061 rewrite it. Groups can be matched in ``pattern`` and referenced in
1061 rewrite it. Groups can be matched in ``pattern`` and referenced in
1062 ``replacements``. For instance::
1062 ``replacements``. For instance::
1063
1063
1064 http://server/(.*)-hg/ = http://hg.server/\1/
1064 http://server/(.*)-hg/ = http://hg.server/\1/
1065
1065
1066 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1066 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1067
1067
1068 Relative subrepository paths are first made absolute, and the
1068 Relative subrepository paths are first made absolute, and the
1069 rewrite rules are then applied on the full (absolute) path. The rules
1069 rewrite rules are then applied on the full (absolute) path. The rules
1070 are applied in definition order.
1070 are applied in definition order.
1071
1071
1072 ``trusted``
1072 ``trusted``
1073 """""""""""
1073 -----------
1074
1074
1075 Mercurial will not use the settings in the
1075 Mercurial will not use the settings in the
1076 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1076 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1077 user or to a trusted group, as various hgrc features allow arbitrary
1077 user or to a trusted group, as various hgrc features allow arbitrary
1078 commands to be run. This issue is often encountered when configuring
1078 commands to be run. This issue is often encountered when configuring
1079 hooks or extensions for shared repositories or servers. However,
1079 hooks or extensions for shared repositories or servers. However,
1080 the web interface will use some safe settings from the ``[web]``
1080 the web interface will use some safe settings from the ``[web]``
1081 section.
1081 section.
1082
1082
1083 This section specifies what users and groups are trusted. The
1083 This section specifies what users and groups are trusted. The
1084 current user is always trusted. To trust everybody, list a user or a
1084 current user is always trusted. To trust everybody, list a user or a
1085 group with name ``*``. These settings must be placed in an
1085 group with name ``*``. These settings must be placed in an
1086 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1086 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1087 user or service running Mercurial.
1087 user or service running Mercurial.
1088
1088
1089 ``users``
1089 ``users``
1090 Comma-separated list of trusted users.
1090 Comma-separated list of trusted users.
1091
1091
1092 ``groups``
1092 ``groups``
1093 Comma-separated list of trusted groups.
1093 Comma-separated list of trusted groups.
1094
1094
1095
1095
1096 ``ui``
1096 ``ui``
1097 """"""
1097 ------
1098
1098
1099 User interface controls.
1099 User interface controls.
1100
1100
1101 ``archivemeta``
1101 ``archivemeta``
1102 Whether to include the .hg_archival.txt file containing meta data
1102 Whether to include the .hg_archival.txt file containing meta data
1103 (hashes for the repository base and for tip) in archives created
1103 (hashes for the repository base and for tip) in archives created
1104 by the :hg:`archive` command or downloaded via hgweb.
1104 by the :hg:`archive` command or downloaded via hgweb.
1105 Default is True.
1105 Default is True.
1106
1106
1107 ``askusername``
1107 ``askusername``
1108 Whether to prompt for a username when committing. If True, and
1108 Whether to prompt for a username when committing. If True, and
1109 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1109 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1110 be prompted to enter a username. If no username is entered, the
1110 be prompted to enter a username. If no username is entered, the
1111 default ``USER@HOST`` is used instead.
1111 default ``USER@HOST`` is used instead.
1112 Default is False.
1112 Default is False.
1113
1113
1114 ``commitsubrepos``
1114 ``commitsubrepos``
1115 Whether to commit modified subrepositories when committing the
1115 Whether to commit modified subrepositories when committing the
1116 parent repository. If False and one subrepository has uncommitted
1116 parent repository. If False and one subrepository has uncommitted
1117 changes, abort the commit.
1117 changes, abort the commit.
1118 Default is False.
1118 Default is False.
1119
1119
1120 ``debug``
1120 ``debug``
1121 Print debugging information. True or False. Default is False.
1121 Print debugging information. True or False. Default is False.
1122
1122
1123 ``editor``
1123 ``editor``
1124 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1124 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1125
1125
1126 ``fallbackencoding``
1126 ``fallbackencoding``
1127 Encoding to try if it's not possible to decode the changelog using
1127 Encoding to try if it's not possible to decode the changelog using
1128 UTF-8. Default is ISO-8859-1.
1128 UTF-8. Default is ISO-8859-1.
1129
1129
1130 ``ignore``
1130 ``ignore``
1131 A file to read per-user ignore patterns from. This file should be
1131 A file to read per-user ignore patterns from. This file should be
1132 in the same format as a repository-wide .hgignore file. This
1132 in the same format as a repository-wide .hgignore file. This
1133 option supports hook syntax, so if you want to specify multiple
1133 option supports hook syntax, so if you want to specify multiple
1134 ignore files, you can do so by setting something like
1134 ignore files, you can do so by setting something like
1135 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1135 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1136 format, see the ``hgignore(5)`` man page.
1136 format, see the ``hgignore(5)`` man page.
1137
1137
1138 ``interactive``
1138 ``interactive``
1139 Allow to prompt the user. True or False. Default is True.
1139 Allow to prompt the user. True or False. Default is True.
1140
1140
1141 ``logtemplate``
1141 ``logtemplate``
1142 Template string for commands that print changesets.
1142 Template string for commands that print changesets.
1143
1143
1144 ``merge``
1144 ``merge``
1145 The conflict resolution program to use during a manual merge.
1145 The conflict resolution program to use during a manual merge.
1146 For more information on merge tools see :hg:`help merge-tools`.
1146 For more information on merge tools see :hg:`help merge-tools`.
1147 For configuring merge tools see the ``[merge-tools]`` section.
1147 For configuring merge tools see the ``[merge-tools]`` section.
1148
1148
1149 ``portablefilenames``
1149 ``portablefilenames``
1150 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1150 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1151 Default is ``warn``.
1151 Default is ``warn``.
1152 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1152 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1153 platforms, if a file with a non-portable filename is added (e.g. a file
1153 platforms, if a file with a non-portable filename is added (e.g. a file
1154 with a name that can't be created on Windows because it contains reserved
1154 with a name that can't be created on Windows because it contains reserved
1155 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1155 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1156 collision with an existing file).
1156 collision with an existing file).
1157 If set to ``ignore`` (or ``false``), no warning is printed.
1157 If set to ``ignore`` (or ``false``), no warning is printed.
1158 If set to ``abort``, the command is aborted.
1158 If set to ``abort``, the command is aborted.
1159 On Windows, this configuration option is ignored and the command aborted.
1159 On Windows, this configuration option is ignored and the command aborted.
1160
1160
1161 ``quiet``
1161 ``quiet``
1162 Reduce the amount of output printed. True or False. Default is False.
1162 Reduce the amount of output printed. True or False. Default is False.
1163
1163
1164 ``remotecmd``
1164 ``remotecmd``
1165 remote command to use for clone/push/pull operations. Default is ``hg``.
1165 remote command to use for clone/push/pull operations. Default is ``hg``.
1166
1166
1167 ``reportoldssl``
1167 ``reportoldssl``
1168 Warn if an SSL certificate is unable to be due to using Python
1168 Warn if an SSL certificate is unable to be due to using Python
1169 2.5 or earlier. True or False. Default is True.
1169 2.5 or earlier. True or False. Default is True.
1170
1170
1171 ``report_untrusted``
1171 ``report_untrusted``
1172 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1172 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1173 trusted user or group. True or False. Default is True.
1173 trusted user or group. True or False. Default is True.
1174
1174
1175 ``slash``
1175 ``slash``
1176 Display paths using a slash (``/``) as the path separator. This
1176 Display paths using a slash (``/``) as the path separator. This
1177 only makes a difference on systems where the default path
1177 only makes a difference on systems where the default path
1178 separator is not the slash character (e.g. Windows uses the
1178 separator is not the slash character (e.g. Windows uses the
1179 backslash character (``\``)).
1179 backslash character (``\``)).
1180 Default is False.
1180 Default is False.
1181
1181
1182 ``ssh``
1182 ``ssh``
1183 command to use for SSH connections. Default is ``ssh``.
1183 command to use for SSH connections. Default is ``ssh``.
1184
1184
1185 ``strict``
1185 ``strict``
1186 Require exact command names, instead of allowing unambiguous
1186 Require exact command names, instead of allowing unambiguous
1187 abbreviations. True or False. Default is False.
1187 abbreviations. True or False. Default is False.
1188
1188
1189 ``style``
1189 ``style``
1190 Name of style to use for command output.
1190 Name of style to use for command output.
1191
1191
1192 ``timeout``
1192 ``timeout``
1193 The timeout used when a lock is held (in seconds), a negative value
1193 The timeout used when a lock is held (in seconds), a negative value
1194 means no timeout. Default is 600.
1194 means no timeout. Default is 600.
1195
1195
1196 ``traceback``
1196 ``traceback``
1197 Mercurial always prints a traceback when an unknown exception
1197 Mercurial always prints a traceback when an unknown exception
1198 occurs. Setting this to True will make Mercurial print a traceback
1198 occurs. Setting this to True will make Mercurial print a traceback
1199 on all exceptions, even those recognized by Mercurial (such as
1199 on all exceptions, even those recognized by Mercurial (such as
1200 IOError or MemoryError). Default is False.
1200 IOError or MemoryError). Default is False.
1201
1201
1202 ``username``
1202 ``username``
1203 The committer of a changeset created when running "commit".
1203 The committer of a changeset created when running "commit".
1204 Typically a person's name and email address, e.g. ``Fred Widget
1204 Typically a person's name and email address, e.g. ``Fred Widget
1205 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1205 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1206 the username in hgrc is empty, it has to be specified manually or
1206 the username in hgrc is empty, it has to be specified manually or
1207 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1207 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1208 ``username =`` in the system hgrc). Environment variables in the
1208 ``username =`` in the system hgrc). Environment variables in the
1209 username are expanded.
1209 username are expanded.
1210
1210
1211 ``verbose``
1211 ``verbose``
1212 Increase the amount of output printed. True or False. Default is False.
1212 Increase the amount of output printed. True or False. Default is False.
1213
1213
1214
1214
1215 ``web``
1215 ``web``
1216 """""""
1216 -------
1217
1217
1218 Web interface configuration. The settings in this section apply to
1218 Web interface configuration. The settings in this section apply to
1219 both the builtin webserver (started by :hg:`serve`) and the script you
1219 both the builtin webserver (started by :hg:`serve`) and the script you
1220 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1220 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1221 and WSGI).
1221 and WSGI).
1222
1222
1223 The Mercurial webserver does no authentication (it does not prompt for
1223 The Mercurial webserver does no authentication (it does not prompt for
1224 usernames and passwords to validate *who* users are), but it does do
1224 usernames and passwords to validate *who* users are), but it does do
1225 authorization (it grants or denies access for *authenticated users*
1225 authorization (it grants or denies access for *authenticated users*
1226 based on settings in this section). You must either configure your
1226 based on settings in this section). You must either configure your
1227 webserver to do authentication for you, or disable the authorization
1227 webserver to do authentication for you, or disable the authorization
1228 checks.
1228 checks.
1229
1229
1230 For a quick setup in a trusted environment, e.g., a private LAN, where
1230 For a quick setup in a trusted environment, e.g., a private LAN, where
1231 you want it to accept pushes from anybody, you can use the following
1231 you want it to accept pushes from anybody, you can use the following
1232 command line::
1232 command line::
1233
1233
1234 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1234 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1235
1235
1236 Note that this will allow anybody to push anything to the server and
1236 Note that this will allow anybody to push anything to the server and
1237 that this should not be used for public servers.
1237 that this should not be used for public servers.
1238
1238
1239 The full set of options is:
1239 The full set of options is:
1240
1240
1241 ``accesslog``
1241 ``accesslog``
1242 Where to output the access log. Default is stdout.
1242 Where to output the access log. Default is stdout.
1243
1243
1244 ``address``
1244 ``address``
1245 Interface address to bind to. Default is all.
1245 Interface address to bind to. Default is all.
1246
1246
1247 ``allow_archive``
1247 ``allow_archive``
1248 List of archive format (bz2, gz, zip) allowed for downloading.
1248 List of archive format (bz2, gz, zip) allowed for downloading.
1249 Default is empty.
1249 Default is empty.
1250
1250
1251 ``allowbz2``
1251 ``allowbz2``
1252 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1252 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1253 revisions.
1253 revisions.
1254 Default is False.
1254 Default is False.
1255
1255
1256 ``allowgz``
1256 ``allowgz``
1257 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1257 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1258 revisions.
1258 revisions.
1259 Default is False.
1259 Default is False.
1260
1260
1261 ``allowpull``
1261 ``allowpull``
1262 Whether to allow pulling from the repository. Default is True.
1262 Whether to allow pulling from the repository. Default is True.
1263
1263
1264 ``allow_push``
1264 ``allow_push``
1265 Whether to allow pushing to the repository. If empty or not set,
1265 Whether to allow pushing to the repository. If empty or not set,
1266 push is not allowed. If the special value ``*``, any remote user can
1266 push is not allowed. If the special value ``*``, any remote user can
1267 push, including unauthenticated users. Otherwise, the remote user
1267 push, including unauthenticated users. Otherwise, the remote user
1268 must have been authenticated, and the authenticated user name must
1268 must have been authenticated, and the authenticated user name must
1269 be present in this list. The contents of the allow_push list are
1269 be present in this list. The contents of the allow_push list are
1270 examined after the deny_push list.
1270 examined after the deny_push list.
1271
1271
1272 ``guessmime``
1272 ``guessmime``
1273 Control MIME types for raw download of file content.
1273 Control MIME types for raw download of file content.
1274 Set to True to let hgweb guess the content type from the file
1274 Set to True to let hgweb guess the content type from the file
1275 extension. This will serve HTML files as ``text/html`` and might
1275 extension. This will serve HTML files as ``text/html`` and might
1276 allow cross-site scripting attacks when serving untrusted
1276 allow cross-site scripting attacks when serving untrusted
1277 repositories. Default is False.
1277 repositories. Default is False.
1278
1278
1279 ``allow_read``
1279 ``allow_read``
1280 If the user has not already been denied repository access due to
1280 If the user has not already been denied repository access due to
1281 the contents of deny_read, this list determines whether to grant
1281 the contents of deny_read, this list determines whether to grant
1282 repository access to the user. If this list is not empty, and the
1282 repository access to the user. If this list is not empty, and the
1283 user is unauthenticated or not present in the list, then access is
1283 user is unauthenticated or not present in the list, then access is
1284 denied for the user. If the list is empty or not set, then access
1284 denied for the user. If the list is empty or not set, then access
1285 is permitted to all users by default. Setting allow_read to the
1285 is permitted to all users by default. Setting allow_read to the
1286 special value ``*`` is equivalent to it not being set (i.e. access
1286 special value ``*`` is equivalent to it not being set (i.e. access
1287 is permitted to all users). The contents of the allow_read list are
1287 is permitted to all users). The contents of the allow_read list are
1288 examined after the deny_read list.
1288 examined after the deny_read list.
1289
1289
1290 ``allowzip``
1290 ``allowzip``
1291 (DEPRECATED) Whether to allow .zip downloading of repository
1291 (DEPRECATED) Whether to allow .zip downloading of repository
1292 revisions. Default is False. This feature creates temporary files.
1292 revisions. Default is False. This feature creates temporary files.
1293
1293
1294 ``baseurl``
1294 ``baseurl``
1295 Base URL to use when publishing URLs in other locations, so
1295 Base URL to use when publishing URLs in other locations, so
1296 third-party tools like email notification hooks can construct
1296 third-party tools like email notification hooks can construct
1297 URLs. Example: ``http://hgserver/repos/``.
1297 URLs. Example: ``http://hgserver/repos/``.
1298
1298
1299 ``cacerts``
1299 ``cacerts``
1300 Path to file containing a list of PEM encoded certificate
1300 Path to file containing a list of PEM encoded certificate
1301 authority certificates. Environment variables and ``~user``
1301 authority certificates. Environment variables and ``~user``
1302 constructs are expanded in the filename. If specified on the
1302 constructs are expanded in the filename. If specified on the
1303 client, then it will verify the identity of remote HTTPS servers
1303 client, then it will verify the identity of remote HTTPS servers
1304 with these certificates.
1304 with these certificates.
1305
1305
1306 This feature is only supported when using Python 2.6 or later. If you wish
1306 This feature is only supported when using Python 2.6 or later. If you wish
1307 to use it with earlier versions of Python, install the backported
1307 to use it with earlier versions of Python, install the backported
1308 version of the ssl library that is available from
1308 version of the ssl library that is available from
1309 ``http://pypi.python.org``.
1309 ``http://pypi.python.org``.
1310
1310
1311 To disable SSL verification temporarily, specify ``--insecure`` from
1311 To disable SSL verification temporarily, specify ``--insecure`` from
1312 command line.
1312 command line.
1313
1313
1314 You can use OpenSSL's CA certificate file if your platform has
1314 You can use OpenSSL's CA certificate file if your platform has
1315 one. On most Linux systems this will be
1315 one. On most Linux systems this will be
1316 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1316 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1317 generate this file manually. The form must be as follows::
1317 generate this file manually. The form must be as follows::
1318
1318
1319 -----BEGIN CERTIFICATE-----
1319 -----BEGIN CERTIFICATE-----
1320 ... (certificate in base64 PEM encoding) ...
1320 ... (certificate in base64 PEM encoding) ...
1321 -----END CERTIFICATE-----
1321 -----END CERTIFICATE-----
1322 -----BEGIN CERTIFICATE-----
1322 -----BEGIN CERTIFICATE-----
1323 ... (certificate in base64 PEM encoding) ...
1323 ... (certificate in base64 PEM encoding) ...
1324 -----END CERTIFICATE-----
1324 -----END CERTIFICATE-----
1325
1325
1326 ``cache``
1326 ``cache``
1327 Whether to support caching in hgweb. Defaults to True.
1327 Whether to support caching in hgweb. Defaults to True.
1328
1328
1329 ``collapse``
1329 ``collapse``
1330 With ``descend`` enabled, repositories in subdirectories are shown at
1330 With ``descend`` enabled, repositories in subdirectories are shown at
1331 a single level alongside repositories in the current path. With
1331 a single level alongside repositories in the current path. With
1332 ``collapse`` also enabled, repositories residing at a deeper level than
1332 ``collapse`` also enabled, repositories residing at a deeper level than
1333 the current path are grouped behind navigable directory entries that
1333 the current path are grouped behind navigable directory entries that
1334 lead to the locations of these repositories. In effect, this setting
1334 lead to the locations of these repositories. In effect, this setting
1335 collapses each collection of repositories found within a subdirectory
1335 collapses each collection of repositories found within a subdirectory
1336 into a single entry for that subdirectory. Default is False.
1336 into a single entry for that subdirectory. Default is False.
1337
1337
1338 ``contact``
1338 ``contact``
1339 Name or email address of the person in charge of the repository.
1339 Name or email address of the person in charge of the repository.
1340 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1340 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1341
1341
1342 ``deny_push``
1342 ``deny_push``
1343 Whether to deny pushing to the repository. If empty or not set,
1343 Whether to deny pushing to the repository. If empty or not set,
1344 push is not denied. If the special value ``*``, all remote users are
1344 push is not denied. If the special value ``*``, all remote users are
1345 denied push. Otherwise, unauthenticated users are all denied, and
1345 denied push. Otherwise, unauthenticated users are all denied, and
1346 any authenticated user name present in this list is also denied. The
1346 any authenticated user name present in this list is also denied. The
1347 contents of the deny_push list are examined before the allow_push list.
1347 contents of the deny_push list are examined before the allow_push list.
1348
1348
1349 ``deny_read``
1349 ``deny_read``
1350 Whether to deny reading/viewing of the repository. If this list is
1350 Whether to deny reading/viewing of the repository. If this list is
1351 not empty, unauthenticated users are all denied, and any
1351 not empty, unauthenticated users are all denied, and any
1352 authenticated user name present in this list is also denied access to
1352 authenticated user name present in this list is also denied access to
1353 the repository. If set to the special value ``*``, all remote users
1353 the repository. If set to the special value ``*``, all remote users
1354 are denied access (rarely needed ;). If deny_read is empty or not set,
1354 are denied access (rarely needed ;). If deny_read is empty or not set,
1355 the determination of repository access depends on the presence and
1355 the determination of repository access depends on the presence and
1356 content of the allow_read list (see description). If both
1356 content of the allow_read list (see description). If both
1357 deny_read and allow_read are empty or not set, then access is
1357 deny_read and allow_read are empty or not set, then access is
1358 permitted to all users by default. If the repository is being
1358 permitted to all users by default. If the repository is being
1359 served via hgwebdir, denied users will not be able to see it in
1359 served via hgwebdir, denied users will not be able to see it in
1360 the list of repositories. The contents of the deny_read list have
1360 the list of repositories. The contents of the deny_read list have
1361 priority over (are examined before) the contents of the allow_read
1361 priority over (are examined before) the contents of the allow_read
1362 list.
1362 list.
1363
1363
1364 ``descend``
1364 ``descend``
1365 hgwebdir indexes will not descend into subdirectories. Only repositories
1365 hgwebdir indexes will not descend into subdirectories. Only repositories
1366 directly in the current path will be shown (other repositories are still
1366 directly in the current path will be shown (other repositories are still
1367 available from the index corresponding to their containing path).
1367 available from the index corresponding to their containing path).
1368
1368
1369 ``description``
1369 ``description``
1370 Textual description of the repository's purpose or contents.
1370 Textual description of the repository's purpose or contents.
1371 Default is "unknown".
1371 Default is "unknown".
1372
1372
1373 ``encoding``
1373 ``encoding``
1374 Character encoding name. Default is the current locale charset.
1374 Character encoding name. Default is the current locale charset.
1375 Example: "UTF-8"
1375 Example: "UTF-8"
1376
1376
1377 ``errorlog``
1377 ``errorlog``
1378 Where to output the error log. Default is stderr.
1378 Where to output the error log. Default is stderr.
1379
1379
1380 ``comparisoncontext``
1380 ``comparisoncontext``
1381 Number of lines of context to show in side-by-side file comparison. If
1381 Number of lines of context to show in side-by-side file comparison. If
1382 negative or the value ``full``, whole files are shown. Default is 5.
1382 negative or the value ``full``, whole files are shown. Default is 5.
1383 This setting can be overridden by a ``context`` request parameter to the
1383 This setting can be overridden by a ``context`` request parameter to the
1384 ``comparison`` command, taking the same values.
1384 ``comparison`` command, taking the same values.
1385
1385
1386 ``hidden``
1386 ``hidden``
1387 Whether to hide the repository in the hgwebdir index.
1387 Whether to hide the repository in the hgwebdir index.
1388 Default is False.
1388 Default is False.
1389
1389
1390 ``ipv6``
1390 ``ipv6``
1391 Whether to use IPv6. Default is False.
1391 Whether to use IPv6. Default is False.
1392
1392
1393 ``logoimg``
1393 ``logoimg``
1394 File name of the logo image that some templates display on each page.
1394 File name of the logo image that some templates display on each page.
1395 The file name is relative to ``staticurl``. That is, the full path to
1395 The file name is relative to ``staticurl``. That is, the full path to
1396 the logo image is "staticurl/logoimg".
1396 the logo image is "staticurl/logoimg".
1397 If unset, ``hglogo.png`` will be used.
1397 If unset, ``hglogo.png`` will be used.
1398
1398
1399 ``logourl``
1399 ``logourl``
1400 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1400 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1401 will be used.
1401 will be used.
1402
1402
1403 ``name``
1403 ``name``
1404 Repository name to use in the web interface. Default is current
1404 Repository name to use in the web interface. Default is current
1405 working directory.
1405 working directory.
1406
1406
1407 ``maxchanges``
1407 ``maxchanges``
1408 Maximum number of changes to list on the changelog. Default is 10.
1408 Maximum number of changes to list on the changelog. Default is 10.
1409
1409
1410 ``maxfiles``
1410 ``maxfiles``
1411 Maximum number of files to list per changeset. Default is 10.
1411 Maximum number of files to list per changeset. Default is 10.
1412
1412
1413 ``port``
1413 ``port``
1414 Port to listen on. Default is 8000.
1414 Port to listen on. Default is 8000.
1415
1415
1416 ``prefix``
1416 ``prefix``
1417 Prefix path to serve from. Default is '' (server root).
1417 Prefix path to serve from. Default is '' (server root).
1418
1418
1419 ``push_ssl``
1419 ``push_ssl``
1420 Whether to require that inbound pushes be transported over SSL to
1420 Whether to require that inbound pushes be transported over SSL to
1421 prevent password sniffing. Default is True.
1421 prevent password sniffing. Default is True.
1422
1422
1423 ``staticurl``
1423 ``staticurl``
1424 Base URL to use for static files. If unset, static files (e.g. the
1424 Base URL to use for static files. If unset, static files (e.g. the
1425 hgicon.png favicon) will be served by the CGI script itself. Use
1425 hgicon.png favicon) will be served by the CGI script itself. Use
1426 this setting to serve them directly with the HTTP server.
1426 this setting to serve them directly with the HTTP server.
1427 Example: ``http://hgserver/static/``.
1427 Example: ``http://hgserver/static/``.
1428
1428
1429 ``stripes``
1429 ``stripes``
1430 How many lines a "zebra stripe" should span in multiline output.
1430 How many lines a "zebra stripe" should span in multiline output.
1431 Default is 1; set to 0 to disable.
1431 Default is 1; set to 0 to disable.
1432
1432
1433 ``style``
1433 ``style``
1434 Which template map style to use.
1434 Which template map style to use.
1435
1435
1436 ``templates``
1436 ``templates``
1437 Where to find the HTML templates. Default is install path.
1437 Where to find the HTML templates. Default is install path.
@@ -1,89 +1,89 b''
1 Synopsis
1 Synopsis
2 --------
2 ========
3
3
4 The Mercurial system uses a file called ``.hgignore`` in the root
4 The Mercurial system uses a file called ``.hgignore`` in the root
5 directory of a repository to control its behavior when it searches
5 directory of a repository to control its behavior when it searches
6 for files that it is not currently tracking.
6 for files that it is not currently tracking.
7
7
8 Description
8 Description
9 -----------
9 ===========
10
10
11 The working directory of a Mercurial repository will often contain
11 The working directory of a Mercurial repository will often contain
12 files that should not be tracked by Mercurial. These include backup
12 files that should not be tracked by Mercurial. These include backup
13 files created by editors and build products created by compilers.
13 files created by editors and build products created by compilers.
14 These files can be ignored by listing them in a ``.hgignore`` file in
14 These files can be ignored by listing them in a ``.hgignore`` file in
15 the root of the working directory. The ``.hgignore`` file must be
15 the root of the working directory. The ``.hgignore`` file must be
16 created manually. It is typically put under version control, so that
16 created manually. It is typically put under version control, so that
17 the settings will propagate to other repositories with push and pull.
17 the settings will propagate to other repositories with push and pull.
18
18
19 An untracked file is ignored if its path relative to the repository
19 An untracked file is ignored if its path relative to the repository
20 root directory, or any prefix path of that path, is matched against
20 root directory, or any prefix path of that path, is matched against
21 any pattern in ``.hgignore``.
21 any pattern in ``.hgignore``.
22
22
23 For example, say we have an untracked file, ``file.c``, at
23 For example, say we have an untracked file, ``file.c``, at
24 ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c``
24 ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c``
25 if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``.
25 if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``.
26
26
27 In addition, a Mercurial configuration file can reference a set of
27 In addition, a Mercurial configuration file can reference a set of
28 per-user or global ignore files. See the ``ignore`` configuration
28 per-user or global ignore files. See the ``ignore`` configuration
29 key on the ``[ui]`` section of :hg:`help config` for details of how to
29 key on the ``[ui]`` section of :hg:`help config` for details of how to
30 configure these files.
30 configure these files.
31
31
32 To control Mercurial's handling of files that it manages, many
32 To control Mercurial's handling of files that it manages, many
33 commands support the ``-I`` and ``-X`` options; see
33 commands support the ``-I`` and ``-X`` options; see
34 :hg:`help <command>` and :hg:`help patterns` for details.
34 :hg:`help <command>` and :hg:`help patterns` for details.
35
35
36 Files that are already tracked are not affected by .hgignore, even
36 Files that are already tracked are not affected by .hgignore, even
37 if they appear in .hgignore. An untracked file X can be explicitly
37 if they appear in .hgignore. An untracked file X can be explicitly
38 added with :hg:`add X`, even if X would be excluded by a pattern
38 added with :hg:`add X`, even if X would be excluded by a pattern
39 in .hgignore.
39 in .hgignore.
40
40
41 Syntax
41 Syntax
42 ------
42 ======
43
43
44 An ignore file is a plain text file consisting of a list of patterns,
44 An ignore file is a plain text file consisting of a list of patterns,
45 with one pattern per line. Empty lines are skipped. The ``#``
45 with one pattern per line. Empty lines are skipped. The ``#``
46 character is treated as a comment character, and the ``\`` character
46 character is treated as a comment character, and the ``\`` character
47 is treated as an escape character.
47 is treated as an escape character.
48
48
49 Mercurial supports several pattern syntaxes. The default syntax used
49 Mercurial supports several pattern syntaxes. The default syntax used
50 is Python/Perl-style regular expressions.
50 is Python/Perl-style regular expressions.
51
51
52 To change the syntax used, use a line of the following form::
52 To change the syntax used, use a line of the following form::
53
53
54 syntax: NAME
54 syntax: NAME
55
55
56 where ``NAME`` is one of the following:
56 where ``NAME`` is one of the following:
57
57
58 ``regexp``
58 ``regexp``
59 Regular expression, Python/Perl syntax.
59 Regular expression, Python/Perl syntax.
60 ``glob``
60 ``glob``
61 Shell-style glob.
61 Shell-style glob.
62
62
63 The chosen syntax stays in effect when parsing all patterns that
63 The chosen syntax stays in effect when parsing all patterns that
64 follow, until another syntax is selected.
64 follow, until another syntax is selected.
65
65
66 Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
66 Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
67 the form ``*.c`` will match a file ending in ``.c`` in any directory,
67 the form ``*.c`` will match a file ending in ``.c`` in any directory,
68 and a regexp pattern of the form ``\.c$`` will do the same. To root a
68 and a regexp pattern of the form ``\.c$`` will do the same. To root a
69 regexp pattern, start it with ``^``.
69 regexp pattern, start it with ``^``.
70
70
71 .. note::
71 .. note::
72 Patterns specified in other than ``.hgignore`` are always rooted.
72 Patterns specified in other than ``.hgignore`` are always rooted.
73 Please see :hg:`help patterns` for details.
73 Please see :hg:`help patterns` for details.
74
74
75 Example
75 Example
76 -------
76 =======
77
77
78 Here is an example ignore file. ::
78 Here is an example ignore file. ::
79
79
80 # use glob syntax.
80 # use glob syntax.
81 syntax: glob
81 syntax: glob
82
82
83 *.elc
83 *.elc
84 *.pyc
84 *.pyc
85 *~
85 *~
86
86
87 # switch to regexp syntax.
87 # switch to regexp syntax.
88 syntax: regexp
88 syntax: regexp
89 ^\.pc/
89 ^\.pc/
@@ -1,84 +1,84 b''
1 To merge files Mercurial uses merge tools.
1 To merge files Mercurial uses merge tools.
2
2
3 A merge tool combines two different versions of a file into a merged
3 A merge tool combines two different versions of a file into a merged
4 file. Merge tools are given the two files and the greatest common
4 file. Merge tools are given the two files and the greatest common
5 ancestor of the two file versions, so they can determine the changes
5 ancestor of the two file versions, so they can determine the changes
6 made on both branches.
6 made on both branches.
7
7
8 Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
8 Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
9 :hg:`backout` and in several extensions.
9 :hg:`backout` and in several extensions.
10
10
11 Usually, the merge tool tries to automatically reconcile the files by
11 Usually, the merge tool tries to automatically reconcile the files by
12 combining all non-overlapping changes that occurred separately in
12 combining all non-overlapping changes that occurred separately in
13 the two different evolutions of the same initial base file. Furthermore, some
13 the two different evolutions of the same initial base file. Furthermore, some
14 interactive merge programs make it easier to manually resolve
14 interactive merge programs make it easier to manually resolve
15 conflicting merges, either in a graphical way, or by inserting some
15 conflicting merges, either in a graphical way, or by inserting some
16 conflict markers. Mercurial does not include any interactive merge
16 conflict markers. Mercurial does not include any interactive merge
17 programs but relies on external tools for that.
17 programs but relies on external tools for that.
18
18
19 Available merge tools
19 Available merge tools
20 """""""""""""""""""""
20 =====================
21
21
22 External merge tools and their properties are configured in the
22 External merge tools and their properties are configured in the
23 merge-tools configuration section - see hgrc(5) - but they can often just
23 merge-tools configuration section - see hgrc(5) - but they can often just
24 be named by their executable.
24 be named by their executable.
25
25
26 A merge tool is generally usable if its executable can be found on the
26 A merge tool is generally usable if its executable can be found on the
27 system and if it can handle the merge. The executable is found if it
27 system and if it can handle the merge. The executable is found if it
28 is an absolute or relative executable path or the name of an
28 is an absolute or relative executable path or the name of an
29 application in the executable search path. The tool is assumed to be
29 application in the executable search path. The tool is assumed to be
30 able to handle the merge if it can handle symlinks if the file is a
30 able to handle the merge if it can handle symlinks if the file is a
31 symlink, if it can handle binary files if the file is binary, and if a
31 symlink, if it can handle binary files if the file is binary, and if a
32 GUI is available if the tool requires a GUI.
32 GUI is available if the tool requires a GUI.
33
33
34 There are some internal merge tools which can be used. The internal
34 There are some internal merge tools which can be used. The internal
35 merge tools are:
35 merge tools are:
36
36
37 .. internaltoolsmarker
37 .. internaltoolsmarker
38
38
39 Internal tools are always available and do not require a GUI but will by default
39 Internal tools are always available and do not require a GUI but will by default
40 not handle symlinks or binary files.
40 not handle symlinks or binary files.
41
41
42 Choosing a merge tool
42 Choosing a merge tool
43 """""""""""""""""""""
43 =====================
44
44
45 Mercurial uses these rules when deciding which merge tool to use:
45 Mercurial uses these rules when deciding which merge tool to use:
46
46
47 1. If a tool has been specified with the --tool option to merge or resolve, it
47 1. If a tool has been specified with the --tool option to merge or resolve, it
48 is used. If it is the name of a tool in the merge-tools configuration, its
48 is used. If it is the name of a tool in the merge-tools configuration, its
49 configuration is used. Otherwise the specified tool must be executable by
49 configuration is used. Otherwise the specified tool must be executable by
50 the shell.
50 the shell.
51
51
52 2. If the ``HGMERGE`` environment variable is present, its value is used and
52 2. If the ``HGMERGE`` environment variable is present, its value is used and
53 must be executable by the shell.
53 must be executable by the shell.
54
54
55 3. If the filename of the file to be merged matches any of the patterns in the
55 3. If the filename of the file to be merged matches any of the patterns in the
56 merge-patterns configuration section, the first usable merge tool
56 merge-patterns configuration section, the first usable merge tool
57 corresponding to a matching pattern is used. Here, binary capabilities of the
57 corresponding to a matching pattern is used. Here, binary capabilities of the
58 merge tool are not considered.
58 merge tool are not considered.
59
59
60 4. If ui.merge is set it will be considered next. If the value is not the name
60 4. If ui.merge is set it will be considered next. If the value is not the name
61 of a configured tool, the specified value is used and must be executable by
61 of a configured tool, the specified value is used and must be executable by
62 the shell. Otherwise the named tool is used if it is usable.
62 the shell. Otherwise the named tool is used if it is usable.
63
63
64 5. If any usable merge tools are present in the merge-tools configuration
64 5. If any usable merge tools are present in the merge-tools configuration
65 section, the one with the highest priority is used.
65 section, the one with the highest priority is used.
66
66
67 6. If a program named ``hgmerge`` can be found on the system, it is used - but
67 6. If a program named ``hgmerge`` can be found on the system, it is used - but
68 it will by default not be used for symlinks and binary files.
68 it will by default not be used for symlinks and binary files.
69
69
70 7. If the file to be merged is not binary and is not a symlink, then
70 7. If the file to be merged is not binary and is not a symlink, then
71 ``internal:merge`` is used.
71 ``internal:merge`` is used.
72
72
73 8. The merge of the file fails and must be resolved before commit.
73 8. The merge of the file fails and must be resolved before commit.
74
74
75 .. note::
75 .. note::
76 After selecting a merge program, Mercurial will by default attempt
76 After selecting a merge program, Mercurial will by default attempt
77 to merge the files using a simple merge algorithm first. Only if it doesn't
77 to merge the files using a simple merge algorithm first. Only if it doesn't
78 succeed because of conflicting changes Mercurial will actually execute the
78 succeed because of conflicting changes Mercurial will actually execute the
79 merge program. Whether to use the simple merge algorithm first can be
79 merge program. Whether to use the simple merge algorithm first can be
80 controlled by the premerge setting of the merge tool. Premerge is enabled by
80 controlled by the premerge setting of the merge tool. Premerge is enabled by
81 default unless the file is binary or a symlink.
81 default unless the file is binary or a symlink.
82
82
83 See the merge-tools and ui sections of hgrc(5) for details on the
83 See the merge-tools and ui sections of hgrc(5) for details on the
84 configuration of merge tools.
84 configuration of merge tools.
@@ -1,84 +1,84 b''
1 What are phases?
1 What are phases?
2 ----------------
2 ================
3
3
4 Phases are a system for tracking which changesets have been or should
4 Phases are a system for tracking which changesets have been or should
5 be shared. This helps prevent common mistakes when modifying history
5 be shared. This helps prevent common mistakes when modifying history
6 (for instance, with the mq or rebase extensions).
6 (for instance, with the mq or rebase extensions).
7
7
8 Each changeset in a repository is in one of the following phases:
8 Each changeset in a repository is in one of the following phases:
9
9
10 - public : changeset is visible on a public server
10 - public : changeset is visible on a public server
11 - draft : changeset is not yet published
11 - draft : changeset is not yet published
12 - secret : changeset should not be pushed, pulled, or cloned
12 - secret : changeset should not be pushed, pulled, or cloned
13
13
14 These phases are ordered (public < draft < secret) and no changeset
14 These phases are ordered (public < draft < secret) and no changeset
15 can be in a lower phase than its ancestors. For instance, if a
15 can be in a lower phase than its ancestors. For instance, if a
16 changeset is public, all its ancestors are also public. Lastly,
16 changeset is public, all its ancestors are also public. Lastly,
17 changeset phases should only be changed towards the public phase.
17 changeset phases should only be changed towards the public phase.
18
18
19 How are phases managed?
19 How are phases managed?
20 -----------------------
20 =======================
21
21
22 For the most part, phases should work transparently. By default, a
22 For the most part, phases should work transparently. By default, a
23 changeset is created in the draft phase and is moved into the public
23 changeset is created in the draft phase and is moved into the public
24 phase when it is pushed to another repository.
24 phase when it is pushed to another repository.
25
25
26 Once changesets become public, extensions like mq and rebase will
26 Once changesets become public, extensions like mq and rebase will
27 refuse to operate on them to prevent creating duplicate changesets.
27 refuse to operate on them to prevent creating duplicate changesets.
28 Phases can also be manually manipulated with the :hg:`phase` command
28 Phases can also be manually manipulated with the :hg:`phase` command
29 if needed. See :hg:`help -v phase` for examples.
29 if needed. See :hg:`help -v phase` for examples.
30
30
31 Phases and servers
31 Phases and servers
32 ------------------
32 ==================
33
33
34 Normally, all servers are ``publishing`` by default. This means::
34 Normally, all servers are ``publishing`` by default. This means::
35
35
36 - all draft changesets that are pulled or cloned appear in phase
36 - all draft changesets that are pulled or cloned appear in phase
37 public on the client
37 public on the client
38
38
39 - all draft changesets that are pushed appear as public on both
39 - all draft changesets that are pushed appear as public on both
40 client and server
40 client and server
41
41
42 - secret changesets are neither pushed, pulled, or cloned
42 - secret changesets are neither pushed, pulled, or cloned
43
43
44 .. note::
44 .. note::
45 Pulling a draft changeset from a publishing server does not mark it
45 Pulling a draft changeset from a publishing server does not mark it
46 as public on the server side due to the read-only nature of pull.
46 as public on the server side due to the read-only nature of pull.
47
47
48 Sometimes it may be desirable to push and pull changesets in the draft
48 Sometimes it may be desirable to push and pull changesets in the draft
49 phase to share unfinished work. This can be done by setting a
49 phase to share unfinished work. This can be done by setting a
50 repository to disable publishing in its configuration file::
50 repository to disable publishing in its configuration file::
51
51
52 [phases]
52 [phases]
53 publish = False
53 publish = False
54
54
55 See :hg:`help config` for more information on config files.
55 See :hg:`help config` for more information on config files.
56
56
57 .. note::
57 .. note::
58 Servers running older versions of Mercurial are treated as
58 Servers running older versions of Mercurial are treated as
59 publishing.
59 publishing.
60
60
61 Examples
61 Examples
62 --------
62 ========
63
63
64 - list changesets in draft or secret phase::
64 - list changesets in draft or secret phase::
65
65
66 hg log -r "not public()"
66 hg log -r "not public()"
67
67
68 - change all secret changesets to draft::
68 - change all secret changesets to draft::
69
69
70 hg phase --draft "secret()"
70 hg phase --draft "secret()"
71
71
72 - forcibly move the current changeset and descendants from public to draft::
72 - forcibly move the current changeset and descendants from public to draft::
73
73
74 hg phase --force --draft .
74 hg phase --force --draft .
75
75
76 - show a list of changeset revision and phase::
76 - show a list of changeset revision and phase::
77
77
78 hg log --template "{rev} {phase}\n"
78 hg log --template "{rev} {phase}\n"
79
79
80 - resynchronize draft changesets relative to a remote repository::
80 - resynchronize draft changesets relative to a remote repository::
81
81
82 hg phase -fd 'outgoing(URL)'
82 hg phase -fd 'outgoing(URL)'
83
83
84 See :hg:`help phase` for more information on manually manipulating phases.
84 See :hg:`help phase` for more information on manually manipulating phases.
@@ -1,142 +1,142 b''
1 Subrepositories let you nest external repositories or projects into a
1 Subrepositories let you nest external repositories or projects into a
2 parent Mercurial repository, and make commands operate on them as a
2 parent Mercurial repository, and make commands operate on them as a
3 group.
3 group.
4
4
5 Mercurial currently supports Mercurial, Git, and Subversion
5 Mercurial currently supports Mercurial, Git, and Subversion
6 subrepositories.
6 subrepositories.
7
7
8 Subrepositories are made of three components:
8 Subrepositories are made of three components:
9
9
10 1. Nested repository checkouts. They can appear anywhere in the
10 1. Nested repository checkouts. They can appear anywhere in the
11 parent working directory.
11 parent working directory.
12
12
13 2. Nested repository references. They are defined in ``.hgsub``, which
13 2. Nested repository references. They are defined in ``.hgsub``, which
14 should be placed in the root of working directory, and
14 should be placed in the root of working directory, and
15 tell where the subrepository checkouts come from. Mercurial
15 tell where the subrepository checkouts come from. Mercurial
16 subrepositories are referenced like:
16 subrepositories are referenced like:
17
17
18 path/to/nested = https://example.com/nested/repo/path
18 path/to/nested = https://example.com/nested/repo/path
19
19
20 Git and Subversion subrepos are also supported:
20 Git and Subversion subrepos are also supported:
21
21
22 path/to/nested = [git]git://example.com/nested/repo/path
22 path/to/nested = [git]git://example.com/nested/repo/path
23 path/to/nested = [svn]https://example.com/nested/trunk/path
23 path/to/nested = [svn]https://example.com/nested/trunk/path
24
24
25 where ``path/to/nested`` is the checkout location relatively to the
25 where ``path/to/nested`` is the checkout location relatively to the
26 parent Mercurial root, and ``https://example.com/nested/repo/path``
26 parent Mercurial root, and ``https://example.com/nested/repo/path``
27 is the source repository path. The source can also reference a
27 is the source repository path. The source can also reference a
28 filesystem path.
28 filesystem path.
29
29
30 Note that ``.hgsub`` does not exist by default in Mercurial
30 Note that ``.hgsub`` does not exist by default in Mercurial
31 repositories, you have to create and add it to the parent
31 repositories, you have to create and add it to the parent
32 repository before using subrepositories.
32 repository before using subrepositories.
33
33
34 3. Nested repository states. They are defined in ``.hgsubstate``, which
34 3. Nested repository states. They are defined in ``.hgsubstate``, which
35 is placed in the root of working directory, and
35 is placed in the root of working directory, and
36 capture whatever information is required to restore the
36 capture whatever information is required to restore the
37 subrepositories to the state they were committed in a parent
37 subrepositories to the state they were committed in a parent
38 repository changeset. Mercurial automatically record the nested
38 repository changeset. Mercurial automatically record the nested
39 repositories states when committing in the parent repository.
39 repositories states when committing in the parent repository.
40
40
41 .. note::
41 .. note::
42 The ``.hgsubstate`` file should not be edited manually.
42 The ``.hgsubstate`` file should not be edited manually.
43
43
44
44
45 Adding a Subrepository
45 Adding a Subrepository
46 ----------------------
46 ======================
47
47
48 If ``.hgsub`` does not exist, create it and add it to the parent
48 If ``.hgsub`` does not exist, create it and add it to the parent
49 repository. Clone or checkout the external projects where you want it
49 repository. Clone or checkout the external projects where you want it
50 to live in the parent repository. Edit ``.hgsub`` and add the
50 to live in the parent repository. Edit ``.hgsub`` and add the
51 subrepository entry as described above. At this point, the
51 subrepository entry as described above. At this point, the
52 subrepository is tracked and the next commit will record its state in
52 subrepository is tracked and the next commit will record its state in
53 ``.hgsubstate`` and bind it to the committed changeset.
53 ``.hgsubstate`` and bind it to the committed changeset.
54
54
55 Synchronizing a Subrepository
55 Synchronizing a Subrepository
56 -----------------------------
56 =============================
57
57
58 Subrepos do not automatically track the latest changeset of their
58 Subrepos do not automatically track the latest changeset of their
59 sources. Instead, they are updated to the changeset that corresponds
59 sources. Instead, they are updated to the changeset that corresponds
60 with the changeset checked out in the top-level changeset. This is so
60 with the changeset checked out in the top-level changeset. This is so
61 developers always get a consistent set of compatible code and
61 developers always get a consistent set of compatible code and
62 libraries when they update.
62 libraries when they update.
63
63
64 Thus, updating subrepos is a manual process. Simply check out target
64 Thus, updating subrepos is a manual process. Simply check out target
65 subrepo at the desired revision, test in the top-level repo, then
65 subrepo at the desired revision, test in the top-level repo, then
66 commit in the parent repository to record the new combination.
66 commit in the parent repository to record the new combination.
67
67
68 Deleting a Subrepository
68 Deleting a Subrepository
69 ------------------------
69 ========================
70
70
71 To remove a subrepository from the parent repository, delete its
71 To remove a subrepository from the parent repository, delete its
72 reference from ``.hgsub``, then remove its files.
72 reference from ``.hgsub``, then remove its files.
73
73
74 Interaction with Mercurial Commands
74 Interaction with Mercurial Commands
75 -----------------------------------
75 ===================================
76
76
77 :add: add does not recurse in subrepos unless -S/--subrepos is
77 :add: add does not recurse in subrepos unless -S/--subrepos is
78 specified. However, if you specify the full path of a file in a
78 specified. However, if you specify the full path of a file in a
79 subrepo, it will be added even without -S/--subrepos specified.
79 subrepo, it will be added even without -S/--subrepos specified.
80 Git and Subversion subrepositories are currently silently
80 Git and Subversion subrepositories are currently silently
81 ignored.
81 ignored.
82
82
83 :archive: archive does not recurse in subrepositories unless
83 :archive: archive does not recurse in subrepositories unless
84 -S/--subrepos is specified.
84 -S/--subrepos is specified.
85
85
86 :commit: commit creates a consistent snapshot of the state of the
86 :commit: commit creates a consistent snapshot of the state of the
87 entire project and its subrepositories. If any subrepositories
87 entire project and its subrepositories. If any subrepositories
88 have been modified, Mercurial will abort. Mercurial can be made
88 have been modified, Mercurial will abort. Mercurial can be made
89 to instead commit all modified subrepositories by specifying
89 to instead commit all modified subrepositories by specifying
90 -S/--subrepos, or setting "ui.commitsubrepos=True" in a
90 -S/--subrepos, or setting "ui.commitsubrepos=True" in a
91 configuration file (see :hg:`help config`). After there are no
91 configuration file (see :hg:`help config`). After there are no
92 longer any modified subrepositories, it records their state and
92 longer any modified subrepositories, it records their state and
93 finally commits it in the parent repository.
93 finally commits it in the parent repository.
94
94
95 :diff: diff does not recurse in subrepos unless -S/--subrepos is
95 :diff: diff does not recurse in subrepos unless -S/--subrepos is
96 specified. Changes are displayed as usual, on the subrepositories
96 specified. Changes are displayed as usual, on the subrepositories
97 elements. Git and Subversion subrepositories are currently
97 elements. Git and Subversion subrepositories are currently
98 silently ignored.
98 silently ignored.
99
99
100 :forget: forget currently only handles exact file matches in subrepos.
100 :forget: forget currently only handles exact file matches in subrepos.
101 Git and Subversion subrepositories are currently silently ignored.
101 Git and Subversion subrepositories are currently silently ignored.
102
102
103 :incoming: incoming does not recurse in subrepos unless -S/--subrepos
103 :incoming: incoming does not recurse in subrepos unless -S/--subrepos
104 is specified. Git and Subversion subrepositories are currently
104 is specified. Git and Subversion subrepositories are currently
105 silently ignored.
105 silently ignored.
106
106
107 :outgoing: outgoing does not recurse in subrepos unless -S/--subrepos
107 :outgoing: outgoing does not recurse in subrepos unless -S/--subrepos
108 is specified. Git and Subversion subrepositories are currently
108 is specified. Git and Subversion subrepositories are currently
109 silently ignored.
109 silently ignored.
110
110
111 :pull: pull is not recursive since it is not clear what to pull prior
111 :pull: pull is not recursive since it is not clear what to pull prior
112 to running :hg:`update`. Listing and retrieving all
112 to running :hg:`update`. Listing and retrieving all
113 subrepositories changes referenced by the parent repository pulled
113 subrepositories changes referenced by the parent repository pulled
114 changesets is expensive at best, impossible in the Subversion
114 changesets is expensive at best, impossible in the Subversion
115 case.
115 case.
116
116
117 :push: Mercurial will automatically push all subrepositories first
117 :push: Mercurial will automatically push all subrepositories first
118 when the parent repository is being pushed. This ensures new
118 when the parent repository is being pushed. This ensures new
119 subrepository changes are available when referenced by top-level
119 subrepository changes are available when referenced by top-level
120 repositories. Push is a no-op for Subversion subrepositories.
120 repositories. Push is a no-op for Subversion subrepositories.
121
121
122 :status: status does not recurse into subrepositories unless
122 :status: status does not recurse into subrepositories unless
123 -S/--subrepos is specified. Subrepository changes are displayed as
123 -S/--subrepos is specified. Subrepository changes are displayed as
124 regular Mercurial changes on the subrepository
124 regular Mercurial changes on the subrepository
125 elements. Subversion subrepositories are currently silently
125 elements. Subversion subrepositories are currently silently
126 ignored.
126 ignored.
127
127
128 :update: update restores the subrepos in the state they were
128 :update: update restores the subrepos in the state they were
129 originally committed in target changeset. If the recorded
129 originally committed in target changeset. If the recorded
130 changeset is not available in the current subrepository, Mercurial
130 changeset is not available in the current subrepository, Mercurial
131 will pull it in first before updating. This means that updating
131 will pull it in first before updating. This means that updating
132 can require network access when using subrepositories.
132 can require network access when using subrepositories.
133
133
134 Remapping Subrepositories Sources
134 Remapping Subrepositories Sources
135 ---------------------------------
135 =================================
136
136
137 A subrepository source location may change during a project life,
137 A subrepository source location may change during a project life,
138 invalidating references stored in the parent repository history. To
138 invalidating references stored in the parent repository history. To
139 fix this, rewriting rules can be defined in parent repository ``hgrc``
139 fix this, rewriting rules can be defined in parent repository ``hgrc``
140 file or in Mercurial configuration. See the ``[subpaths]`` section in
140 file or in Mercurial configuration. See the ``[subpaths]`` section in
141 hgrc(5) for more details.
141 hgrc(5) for more details.
142
142
@@ -1,447 +1,447 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > convert=
3 > convert=
4 > [convert]
4 > [convert]
5 > hg.saverev=False
5 > hg.saverev=False
6 > EOF
6 > EOF
7 $ hg help convert
7 $ hg help convert
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
9
9
10 convert a foreign SCM repository to a Mercurial one.
10 convert a foreign SCM repository to a Mercurial one.
11
11
12 Accepted source formats [identifiers]:
12 Accepted source formats [identifiers]:
13
13
14 - Mercurial [hg]
14 - Mercurial [hg]
15 - CVS [cvs]
15 - CVS [cvs]
16 - Darcs [darcs]
16 - Darcs [darcs]
17 - git [git]
17 - git [git]
18 - Subversion [svn]
18 - Subversion [svn]
19 - Monotone [mtn]
19 - Monotone [mtn]
20 - GNU Arch [gnuarch]
20 - GNU Arch [gnuarch]
21 - Bazaar [bzr]
21 - Bazaar [bzr]
22 - Perforce [p4]
22 - Perforce [p4]
23
23
24 Accepted destination formats [identifiers]:
24 Accepted destination formats [identifiers]:
25
25
26 - Mercurial [hg]
26 - Mercurial [hg]
27 - Subversion [svn] (history on branches is not preserved)
27 - Subversion [svn] (history on branches is not preserved)
28
28
29 If no revision is given, all revisions will be converted. Otherwise,
29 If no revision is given, all revisions will be converted. Otherwise,
30 convert will only import up to the named revision (given in a format
30 convert will only import up to the named revision (given in a format
31 understood by the source).
31 understood by the source).
32
32
33 If no destination directory name is specified, it defaults to the basename
33 If no destination directory name is specified, it defaults to the basename
34 of the source with "-hg" appended. If the destination repository doesn't
34 of the source with "-hg" appended. If the destination repository doesn't
35 exist, it will be created.
35 exist, it will be created.
36
36
37 By default, all sources except Mercurial will use --branchsort. Mercurial
37 By default, all sources except Mercurial will use --branchsort. Mercurial
38 uses --sourcesort to preserve original revision numbers order. Sort modes
38 uses --sourcesort to preserve original revision numbers order. Sort modes
39 have the following effects:
39 have the following effects:
40
40
41 --branchsort convert from parent to child revision when possible, which
41 --branchsort convert from parent to child revision when possible, which
42 means branches are usually converted one after the other.
42 means branches are usually converted one after the other.
43 It generates more compact repositories.
43 It generates more compact repositories.
44 --datesort sort revisions by date. Converted repositories have good-
44 --datesort sort revisions by date. Converted repositories have good-
45 looking changelogs but are often an order of magnitude
45 looking changelogs but are often an order of magnitude
46 larger than the same ones generated by --branchsort.
46 larger than the same ones generated by --branchsort.
47 --sourcesort try to preserve source revisions order, only supported by
47 --sourcesort try to preserve source revisions order, only supported by
48 Mercurial sources.
48 Mercurial sources.
49
49
50 If "REVMAP" isn't given, it will be put in a default location
50 If "REVMAP" isn't given, it will be put in a default location
51 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
51 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
52 maps each source commit ID to the destination ID for that revision, like
52 maps each source commit ID to the destination ID for that revision, like
53 so:
53 so:
54
54
55 <source ID> <destination ID>
55 <source ID> <destination ID>
56
56
57 If the file doesn't exist, it's automatically created. It's updated on
57 If the file doesn't exist, it's automatically created. It's updated on
58 each commit copied, so "hg convert" can be interrupted and can be run
58 each commit copied, so "hg convert" can be interrupted and can be run
59 repeatedly to copy new commits.
59 repeatedly to copy new commits.
60
60
61 The authormap is a simple text file that maps each source commit author to
61 The authormap is a simple text file that maps each source commit author to
62 a destination commit author. It is handy for source SCMs that use unix
62 a destination commit author. It is handy for source SCMs that use unix
63 logins to identify authors (eg: CVS). One line per author mapping and the
63 logins to identify authors (eg: CVS). One line per author mapping and the
64 line format is:
64 line format is:
65
65
66 source author = destination author
66 source author = destination author
67
67
68 Empty lines and lines starting with a "#" are ignored.
68 Empty lines and lines starting with a "#" are ignored.
69
69
70 The filemap is a file that allows filtering and remapping of files and
70 The filemap is a file that allows filtering and remapping of files and
71 directories. Each line can contain one of the following directives:
71 directories. Each line can contain one of the following directives:
72
72
73 include path/to/file-or-dir
73 include path/to/file-or-dir
74
74
75 exclude path/to/file-or-dir
75 exclude path/to/file-or-dir
76
76
77 rename path/to/source path/to/destination
77 rename path/to/source path/to/destination
78
78
79 Comment lines start with "#". A specified path matches if it equals the
79 Comment lines start with "#". A specified path matches if it equals the
80 full relative name of a file or one of its parent directories. The
80 full relative name of a file or one of its parent directories. The
81 "include" or "exclude" directive with the longest matching path applies,
81 "include" or "exclude" directive with the longest matching path applies,
82 so line order does not matter.
82 so line order does not matter.
83
83
84 The "include" directive causes a file, or all files under a directory, to
84 The "include" directive causes a file, or all files under a directory, to
85 be included in the destination repository, and the exclusion of all other
85 be included in the destination repository, and the exclusion of all other
86 files and directories not explicitly included. The "exclude" directive
86 files and directories not explicitly included. The "exclude" directive
87 causes files or directories to be omitted. The "rename" directive renames
87 causes files or directories to be omitted. The "rename" directive renames
88 a file or directory if it is converted. To rename from a subdirectory into
88 a file or directory if it is converted. To rename from a subdirectory into
89 the root of the repository, use "." as the path to rename to.
89 the root of the repository, use "." as the path to rename to.
90
90
91 The splicemap is a file that allows insertion of synthetic history,
91 The splicemap is a file that allows insertion of synthetic history,
92 letting you specify the parents of a revision. This is useful if you want
92 letting you specify the parents of a revision. This is useful if you want
93 to e.g. give a Subversion merge two parents, or graft two disconnected
93 to e.g. give a Subversion merge two parents, or graft two disconnected
94 series of history together. Each entry contains a key, followed by a
94 series of history together. Each entry contains a key, followed by a
95 space, followed by one or two comma-separated values:
95 space, followed by one or two comma-separated values:
96
96
97 key parent1, parent2
97 key parent1, parent2
98
98
99 The key is the revision ID in the source revision control system whose
99 The key is the revision ID in the source revision control system whose
100 parents should be modified (same format as a key in .hg/shamap). The
100 parents should be modified (same format as a key in .hg/shamap). The
101 values are the revision IDs (in either the source or destination revision
101 values are the revision IDs (in either the source or destination revision
102 control system) that should be used as the new parents for that node. For
102 control system) that should be used as the new parents for that node. For
103 example, if you have merged "release-1.0" into "trunk", then you should
103 example, if you have merged "release-1.0" into "trunk", then you should
104 specify the revision on "trunk" as the first parent and the one on the
104 specify the revision on "trunk" as the first parent and the one on the
105 "release-1.0" branch as the second.
105 "release-1.0" branch as the second.
106
106
107 The branchmap is a file that allows you to rename a branch when it is
107 The branchmap is a file that allows you to rename a branch when it is
108 being brought in from whatever external repository. When used in
108 being brought in from whatever external repository. When used in
109 conjunction with a splicemap, it allows for a powerful combination to help
109 conjunction with a splicemap, it allows for a powerful combination to help
110 fix even the most badly mismanaged repositories and turn them into nicely
110 fix even the most badly mismanaged repositories and turn them into nicely
111 structured Mercurial repositories. The branchmap contains lines of the
111 structured Mercurial repositories. The branchmap contains lines of the
112 form:
112 form:
113
113
114 original_branch_name new_branch_name
114 original_branch_name new_branch_name
115
115
116 where "original_branch_name" is the name of the branch in the source
116 where "original_branch_name" is the name of the branch in the source
117 repository, and "new_branch_name" is the name of the branch is the
117 repository, and "new_branch_name" is the name of the branch is the
118 destination repository. No whitespace is allowed in the branch names. This
118 destination repository. No whitespace is allowed in the branch names. This
119 can be used to (for instance) move code in one repository from "default"
119 can be used to (for instance) move code in one repository from "default"
120 to a named branch.
120 to a named branch.
121
121
122 Mercurial Source
122 Mercurial Source
123 ''''''''''''''''
123 ################
124
124
125 The Mercurial source recognizes the following configuration options, which
125 The Mercurial source recognizes the following configuration options, which
126 you can set on the command line with "--config":
126 you can set on the command line with "--config":
127
127
128 convert.hg.ignoreerrors
128 convert.hg.ignoreerrors
129 ignore integrity errors when reading. Use it to fix
129 ignore integrity errors when reading. Use it to fix
130 Mercurial repositories with missing revlogs, by converting
130 Mercurial repositories with missing revlogs, by converting
131 from and to Mercurial. Default is False.
131 from and to Mercurial. Default is False.
132 convert.hg.saverev
132 convert.hg.saverev
133 store original revision ID in changeset (forces target IDs
133 store original revision ID in changeset (forces target IDs
134 to change). It takes a boolean argument and defaults to
134 to change). It takes a boolean argument and defaults to
135 False.
135 False.
136 convert.hg.startrev
136 convert.hg.startrev
137 convert start revision and its descendants. It takes a hg
137 convert start revision and its descendants. It takes a hg
138 revision identifier and defaults to 0.
138 revision identifier and defaults to 0.
139
139
140 CVS Source
140 CVS Source
141 ''''''''''
141 ##########
142
142
143 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
143 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
144 indicate the starting point of what will be converted. Direct access to
144 indicate the starting point of what will be converted. Direct access to
145 the repository files is not needed, unless of course the repository is
145 the repository files is not needed, unless of course the repository is
146 ":local:". The conversion uses the top level directory in the sandbox to
146 ":local:". The conversion uses the top level directory in the sandbox to
147 find the CVS repository, and then uses CVS rlog commands to find files to
147 find the CVS repository, and then uses CVS rlog commands to find files to
148 convert. This means that unless a filemap is given, all files under the
148 convert. This means that unless a filemap is given, all files under the
149 starting directory will be converted, and that any directory
149 starting directory will be converted, and that any directory
150 reorganization in the CVS sandbox is ignored.
150 reorganization in the CVS sandbox is ignored.
151
151
152 The following options can be used with "--config":
152 The following options can be used with "--config":
153
153
154 convert.cvsps.cache
154 convert.cvsps.cache
155 Set to False to disable remote log caching, for testing and
155 Set to False to disable remote log caching, for testing and
156 debugging purposes. Default is True.
156 debugging purposes. Default is True.
157 convert.cvsps.fuzz
157 convert.cvsps.fuzz
158 Specify the maximum time (in seconds) that is allowed
158 Specify the maximum time (in seconds) that is allowed
159 between commits with identical user and log message in a
159 between commits with identical user and log message in a
160 single changeset. When very large files were checked in as
160 single changeset. When very large files were checked in as
161 part of a changeset then the default may not be long enough.
161 part of a changeset then the default may not be long enough.
162 The default is 60.
162 The default is 60.
163 convert.cvsps.mergeto
163 convert.cvsps.mergeto
164 Specify a regular expression to which commit log messages
164 Specify a regular expression to which commit log messages
165 are matched. If a match occurs, then the conversion process
165 are matched. If a match occurs, then the conversion process
166 will insert a dummy revision merging the branch on which
166 will insert a dummy revision merging the branch on which
167 this log message occurs to the branch indicated in the
167 this log message occurs to the branch indicated in the
168 regex. Default is "{{mergetobranch ([-\w]+)}}"
168 regex. Default is "{{mergetobranch ([-\w]+)}}"
169 convert.cvsps.mergefrom
169 convert.cvsps.mergefrom
170 Specify a regular expression to which commit log messages
170 Specify a regular expression to which commit log messages
171 are matched. If a match occurs, then the conversion process
171 are matched. If a match occurs, then the conversion process
172 will add the most recent revision on the branch indicated in
172 will add the most recent revision on the branch indicated in
173 the regex as the second parent of the changeset. Default is
173 the regex as the second parent of the changeset. Default is
174 "{{mergefrombranch ([-\w]+)}}"
174 "{{mergefrombranch ([-\w]+)}}"
175 hook.cvslog Specify a Python function to be called at the end of
175 hook.cvslog Specify a Python function to be called at the end of
176 gathering the CVS log. The function is passed a list with
176 gathering the CVS log. The function is passed a list with
177 the log entries, and can modify the entries in-place, or add
177 the log entries, and can modify the entries in-place, or add
178 or delete them.
178 or delete them.
179 hook.cvschangesets
179 hook.cvschangesets
180 Specify a Python function to be called after the changesets
180 Specify a Python function to be called after the changesets
181 are calculated from the CVS log. The function is passed a
181 are calculated from the CVS log. The function is passed a
182 list with the changeset entries, and can modify the
182 list with the changeset entries, and can modify the
183 changesets in-place, or add or delete them.
183 changesets in-place, or add or delete them.
184
184
185 An additional "debugcvsps" Mercurial command allows the builtin changeset
185 An additional "debugcvsps" Mercurial command allows the builtin changeset
186 merging code to be run without doing a conversion. Its parameters and
186 merging code to be run without doing a conversion. Its parameters and
187 output are similar to that of cvsps 2.1. Please see the command help for
187 output are similar to that of cvsps 2.1. Please see the command help for
188 more details.
188 more details.
189
189
190 Subversion Source
190 Subversion Source
191 '''''''''''''''''
191 #################
192
192
193 Subversion source detects classical trunk/branches/tags layouts. By
193 Subversion source detects classical trunk/branches/tags layouts. By
194 default, the supplied "svn://repo/path/" source URL is converted as a
194 default, the supplied "svn://repo/path/" source URL is converted as a
195 single branch. If "svn://repo/path/trunk" exists it replaces the default
195 single branch. If "svn://repo/path/trunk" exists it replaces the default
196 branch. If "svn://repo/path/branches" exists, its subdirectories are
196 branch. If "svn://repo/path/branches" exists, its subdirectories are
197 listed as possible branches. If "svn://repo/path/tags" exists, it is
197 listed as possible branches. If "svn://repo/path/tags" exists, it is
198 looked for tags referencing converted branches. Default "trunk",
198 looked for tags referencing converted branches. Default "trunk",
199 "branches" and "tags" values can be overridden with following options. Set
199 "branches" and "tags" values can be overridden with following options. Set
200 them to paths relative to the source URL, or leave them blank to disable
200 them to paths relative to the source URL, or leave them blank to disable
201 auto detection.
201 auto detection.
202
202
203 The following options can be set with "--config":
203 The following options can be set with "--config":
204
204
205 convert.svn.branches
205 convert.svn.branches
206 specify the directory containing branches. The default is
206 specify the directory containing branches. The default is
207 "branches".
207 "branches".
208 convert.svn.tags
208 convert.svn.tags
209 specify the directory containing tags. The default is
209 specify the directory containing tags. The default is
210 "tags".
210 "tags".
211 convert.svn.trunk
211 convert.svn.trunk
212 specify the name of the trunk branch. The default is
212 specify the name of the trunk branch. The default is
213 "trunk".
213 "trunk".
214
214
215 Source history can be retrieved starting at a specific revision, instead
215 Source history can be retrieved starting at a specific revision, instead
216 of being integrally converted. Only single branch conversions are
216 of being integrally converted. Only single branch conversions are
217 supported.
217 supported.
218
218
219 convert.svn.startrev
219 convert.svn.startrev
220 specify start Subversion revision number. The default is 0.
220 specify start Subversion revision number. The default is 0.
221
221
222 Perforce Source
222 Perforce Source
223 '''''''''''''''
223 ###############
224
224
225 The Perforce (P4) importer can be given a p4 depot path or a client
225 The Perforce (P4) importer can be given a p4 depot path or a client
226 specification as source. It will convert all files in the source to a flat
226 specification as source. It will convert all files in the source to a flat
227 Mercurial repository, ignoring labels, branches and integrations. Note
227 Mercurial repository, ignoring labels, branches and integrations. Note
228 that when a depot path is given you then usually should specify a target
228 that when a depot path is given you then usually should specify a target
229 directory, because otherwise the target may be named "...-hg".
229 directory, because otherwise the target may be named "...-hg".
230
230
231 It is possible to limit the amount of source history to be converted by
231 It is possible to limit the amount of source history to be converted by
232 specifying an initial Perforce revision:
232 specifying an initial Perforce revision:
233
233
234 convert.p4.startrev
234 convert.p4.startrev
235 specify initial Perforce revision (a Perforce changelist
235 specify initial Perforce revision (a Perforce changelist
236 number).
236 number).
237
237
238 Mercurial Destination
238 Mercurial Destination
239 '''''''''''''''''''''
239 #####################
240
240
241 The following options are supported:
241 The following options are supported:
242
242
243 convert.hg.clonebranches
243 convert.hg.clonebranches
244 dispatch source branches in separate clones. The default is
244 dispatch source branches in separate clones. The default is
245 False.
245 False.
246 convert.hg.tagsbranch
246 convert.hg.tagsbranch
247 branch name for tag revisions, defaults to "default".
247 branch name for tag revisions, defaults to "default".
248 convert.hg.usebranchnames
248 convert.hg.usebranchnames
249 preserve branch names. The default is True.
249 preserve branch names. The default is True.
250
250
251 options:
251 options:
252
252
253 -s --source-type TYPE source repository type
253 -s --source-type TYPE source repository type
254 -d --dest-type TYPE destination repository type
254 -d --dest-type TYPE destination repository type
255 -r --rev REV import up to target revision REV
255 -r --rev REV import up to target revision REV
256 -A --authormap FILE remap usernames using this file
256 -A --authormap FILE remap usernames using this file
257 --filemap FILE remap file names using contents of file
257 --filemap FILE remap file names using contents of file
258 --splicemap FILE splice synthesized history into place
258 --splicemap FILE splice synthesized history into place
259 --branchmap FILE change branch names while converting
259 --branchmap FILE change branch names while converting
260 --branchsort try to sort changesets by branches
260 --branchsort try to sort changesets by branches
261 --datesort try to sort changesets by date
261 --datesort try to sort changesets by date
262 --sourcesort preserve source changesets order
262 --sourcesort preserve source changesets order
263
263
264 use "hg -v help convert" to show more info
264 use "hg -v help convert" to show more info
265 $ hg init a
265 $ hg init a
266 $ cd a
266 $ cd a
267 $ echo a > a
267 $ echo a > a
268 $ hg ci -d'0 0' -Ama
268 $ hg ci -d'0 0' -Ama
269 adding a
269 adding a
270 $ hg cp a b
270 $ hg cp a b
271 $ hg ci -d'1 0' -mb
271 $ hg ci -d'1 0' -mb
272 $ hg rm a
272 $ hg rm a
273 $ hg ci -d'2 0' -mc
273 $ hg ci -d'2 0' -mc
274 $ hg mv b a
274 $ hg mv b a
275 $ hg ci -d'3 0' -md
275 $ hg ci -d'3 0' -md
276 $ echo a >> a
276 $ echo a >> a
277 $ hg ci -d'4 0' -me
277 $ hg ci -d'4 0' -me
278 $ cd ..
278 $ cd ..
279 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
279 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
280 assuming destination a-hg
280 assuming destination a-hg
281 initializing destination a-hg repository
281 initializing destination a-hg repository
282 scanning source...
282 scanning source...
283 sorting...
283 sorting...
284 converting...
284 converting...
285 4 a
285 4 a
286 3 b
286 3 b
287 2 c
287 2 c
288 1 d
288 1 d
289 0 e
289 0 e
290 $ hg --cwd a-hg pull ../a
290 $ hg --cwd a-hg pull ../a
291 pulling from ../a
291 pulling from ../a
292 searching for changes
292 searching for changes
293 no changes found
293 no changes found
294
294
295 conversion to existing file should fail
295 conversion to existing file should fail
296
296
297 $ touch bogusfile
297 $ touch bogusfile
298 $ hg convert a bogusfile
298 $ hg convert a bogusfile
299 initializing destination bogusfile repository
299 initializing destination bogusfile repository
300 abort: cannot create new bundle repository
300 abort: cannot create new bundle repository
301 [255]
301 [255]
302
302
303 #if unix-permissions
303 #if unix-permissions
304
304
305 conversion to dir without permissions should fail
305 conversion to dir without permissions should fail
306
306
307 $ mkdir bogusdir
307 $ mkdir bogusdir
308 $ chmod 000 bogusdir
308 $ chmod 000 bogusdir
309
309
310 $ hg convert a bogusdir
310 $ hg convert a bogusdir
311 abort: Permission denied: bogusdir
311 abort: Permission denied: bogusdir
312 [255]
312 [255]
313
313
314 user permissions should succeed
314 user permissions should succeed
315
315
316 $ chmod 700 bogusdir
316 $ chmod 700 bogusdir
317 $ hg convert a bogusdir
317 $ hg convert a bogusdir
318 initializing destination bogusdir repository
318 initializing destination bogusdir repository
319 scanning source...
319 scanning source...
320 sorting...
320 sorting...
321 converting...
321 converting...
322 4 a
322 4 a
323 3 b
323 3 b
324 2 c
324 2 c
325 1 d
325 1 d
326 0 e
326 0 e
327
327
328 #endif
328 #endif
329
329
330 test pre and post conversion actions
330 test pre and post conversion actions
331
331
332 $ echo 'include b' > filemap
332 $ echo 'include b' > filemap
333 $ hg convert --debug --filemap filemap a partialb | \
333 $ hg convert --debug --filemap filemap a partialb | \
334 > grep 'run hg'
334 > grep 'run hg'
335 run hg source pre-conversion action
335 run hg source pre-conversion action
336 run hg sink pre-conversion action
336 run hg sink pre-conversion action
337 run hg sink post-conversion action
337 run hg sink post-conversion action
338 run hg source post-conversion action
338 run hg source post-conversion action
339
339
340 converting empty dir should fail "nicely
340 converting empty dir should fail "nicely
341
341
342 $ mkdir emptydir
342 $ mkdir emptydir
343
343
344 override $PATH to ensure p4 not visible; use $PYTHON in case we're
344 override $PATH to ensure p4 not visible; use $PYTHON in case we're
345 running from a devel copy, not a temp installation
345 running from a devel copy, not a temp installation
346
346
347 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
347 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
348 assuming destination emptydir-hg
348 assuming destination emptydir-hg
349 initializing destination emptydir-hg repository
349 initializing destination emptydir-hg repository
350 emptydir does not look like a CVS checkout
350 emptydir does not look like a CVS checkout
351 emptydir does not look like a Git repository
351 emptydir does not look like a Git repository
352 emptydir does not look like a Subversion repository
352 emptydir does not look like a Subversion repository
353 emptydir is not a local Mercurial repository
353 emptydir is not a local Mercurial repository
354 emptydir does not look like a darcs repository
354 emptydir does not look like a darcs repository
355 emptydir does not look like a monotone repository
355 emptydir does not look like a monotone repository
356 emptydir does not look like a GNU Arch repository
356 emptydir does not look like a GNU Arch repository
357 emptydir does not look like a Bazaar repository
357 emptydir does not look like a Bazaar repository
358 cannot find required "p4" tool
358 cannot find required "p4" tool
359 abort: emptydir: missing or unsupported repository
359 abort: emptydir: missing or unsupported repository
360 [255]
360 [255]
361
361
362 convert with imaginary source type
362 convert with imaginary source type
363
363
364 $ hg convert --source-type foo a a-foo
364 $ hg convert --source-type foo a a-foo
365 initializing destination a-foo repository
365 initializing destination a-foo repository
366 abort: foo: invalid source repository type
366 abort: foo: invalid source repository type
367 [255]
367 [255]
368
368
369 convert with imaginary sink type
369 convert with imaginary sink type
370
370
371 $ hg convert --dest-type foo a a-foo
371 $ hg convert --dest-type foo a a-foo
372 abort: foo: invalid destination repository type
372 abort: foo: invalid destination repository type
373 [255]
373 [255]
374
374
375 testing: convert must not produce duplicate entries in fncache
375 testing: convert must not produce duplicate entries in fncache
376
376
377 $ hg convert a b
377 $ hg convert a b
378 initializing destination b repository
378 initializing destination b repository
379 scanning source...
379 scanning source...
380 sorting...
380 sorting...
381 converting...
381 converting...
382 4 a
382 4 a
383 3 b
383 3 b
384 2 c
384 2 c
385 1 d
385 1 d
386 0 e
386 0 e
387
387
388 contents of fncache file:
388 contents of fncache file:
389
389
390 $ cat b/.hg/store/fncache | sort
390 $ cat b/.hg/store/fncache | sort
391 data/a.i
391 data/a.i
392 data/b.i
392 data/b.i
393
393
394 test bogus URL
394 test bogus URL
395
395
396 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
396 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
397 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
397 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
398 [255]
398 [255]
399
399
400 test revset converted() lookup
400 test revset converted() lookup
401
401
402 $ hg --config convert.hg.saverev=True convert a c
402 $ hg --config convert.hg.saverev=True convert a c
403 initializing destination c repository
403 initializing destination c repository
404 scanning source...
404 scanning source...
405 sorting...
405 sorting...
406 converting...
406 converting...
407 4 a
407 4 a
408 3 b
408 3 b
409 2 c
409 2 c
410 1 d
410 1 d
411 0 e
411 0 e
412 $ echo f > c/f
412 $ echo f > c/f
413 $ hg -R c ci -d'0 0' -Amf
413 $ hg -R c ci -d'0 0' -Amf
414 adding f
414 adding f
415 created new head
415 created new head
416 $ hg -R c log -r "converted(09d945a62ce6)"
416 $ hg -R c log -r "converted(09d945a62ce6)"
417 changeset: 1:98c3dd46a874
417 changeset: 1:98c3dd46a874
418 user: test
418 user: test
419 date: Thu Jan 01 00:00:01 1970 +0000
419 date: Thu Jan 01 00:00:01 1970 +0000
420 summary: b
420 summary: b
421
421
422 $ hg -R c log -r "converted()"
422 $ hg -R c log -r "converted()"
423 changeset: 0:31ed57b2037c
423 changeset: 0:31ed57b2037c
424 user: test
424 user: test
425 date: Thu Jan 01 00:00:00 1970 +0000
425 date: Thu Jan 01 00:00:00 1970 +0000
426 summary: a
426 summary: a
427
427
428 changeset: 1:98c3dd46a874
428 changeset: 1:98c3dd46a874
429 user: test
429 user: test
430 date: Thu Jan 01 00:00:01 1970 +0000
430 date: Thu Jan 01 00:00:01 1970 +0000
431 summary: b
431 summary: b
432
432
433 changeset: 2:3b9ca06ef716
433 changeset: 2:3b9ca06ef716
434 user: test
434 user: test
435 date: Thu Jan 01 00:00:02 1970 +0000
435 date: Thu Jan 01 00:00:02 1970 +0000
436 summary: c
436 summary: c
437
437
438 changeset: 3:4e0debd37cf2
438 changeset: 3:4e0debd37cf2
439 user: test
439 user: test
440 date: Thu Jan 01 00:00:03 1970 +0000
440 date: Thu Jan 01 00:00:03 1970 +0000
441 summary: d
441 summary: d
442
442
443 changeset: 4:9de3bc9349c5
443 changeset: 4:9de3bc9349c5
444 user: test
444 user: test
445 date: Thu Jan 01 00:00:04 1970 +0000
445 date: Thu Jan 01 00:00:04 1970 +0000
446 summary: e
446 summary: e
447
447
General Comments 0
You need to be logged in to leave comments. Login now