# HG changeset patch # User Vadim Gelfer # Date 1142209319 28800 # Node ID b7cc0f323a4cd98e70f45c18830484dd5a74b03d # Parent 8f565af14095d8c44e188d441d5c70f03f95bd48# Parent d7c038e805e91f79bfa108175fba6b957a968e35 merge with crew. diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -12,6 +12,7 @@ tests/*.err build dist doc/*.[0-9] +doc/*.[0-9].gendoc.txt doc/*.[0-9].{x,ht}ml MANIFEST patches diff --git a/PKG-INFO b/PKG-INFO deleted file mode 100644 --- a/PKG-INFO +++ /dev/null @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: mercurial -Version: 0.7 -Summary: scalable distributed SCM -Home-page: http://selenic.com/mercurial -Author: Matt Mackall -Author-email: mpm@selenic.com -License: GNU GPL -Description: UNKNOWN -Platform: UNKNOWN diff --git a/contrib/bash_completion b/contrib/bash_completion --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -1,27 +1,5 @@ shopt -s extglob -_hg_command_list() -{ - "$hg" --debug help 2>/dev/null | \ - awk 'function command_line(line) { - gsub(/,/, "", line) - gsub(/:.*/, "", line) - split(line, aliases) - command = aliases[1] - delete aliases[1] - print command - for (i in aliases) - if (index(command, aliases[i]) != 1) - print aliases[i] - } - /^list of commands:/ {commands=1} - commands && /^ debug/ {a[i++] = $0; next;} - commands && /^ [^ ]/ {command_line($0)} - /^global options:/ {exit 0} - END {for (i in a) command_line(a[i])}' - -} - _hg_option_list() { "$hg" -v help $1 2>/dev/null | \ @@ -37,21 +15,9 @@ shopt -s extglob _hg_commands() { - local all commands result - - all=$(_hg_command_list) - commands=${all%%$'\n'debug*} - result=$(compgen -W '$commands' -- "$cur") - - # hide debug commands from users, but complete them if - # there is no other possible command - if [ "$result" = "" ]; then - local debug - debug=debug${all#*$'\n'debug} - result=$(compgen -W '$debug' -- "$cur") - fi - - COMPREPLY=(${COMPREPLY[@]:-} $result) + local commands + commands="$("$hg" debugcomplete "$cur" 2>/dev/null)" || commands="" + COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur")) } _hg_paths() diff --git a/contrib/mercurial.spec b/contrib/mercurial.spec --- a/contrib/mercurial.spec +++ b/contrib/mercurial.spec @@ -1,7 +1,7 @@ Summary: Mercurial -- a distributed SCM Name: mercurial -Version: 0.7 -Release: 1 +Version: 0.8 +Release: 0 License: GPL Group: Development/Tools Source: http://www.selenic.com/mercurial/release/%{name}-%{version}.tar.gz @@ -10,6 +10,7 @@ BuildRoot: /tmp/build.%{name}-%{version} %define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))') %define pythonlib %{_libdir}/python%{pythonver}/site-packages/%{name} +%define hgext %{_libdir}/python%{pythonver}/site-packages/hgext %description Mercurial is a fast, lightweight source control management system designed @@ -30,10 +31,12 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%doc doc/* contrib/patchbomb *.cgi +%doc doc/* *.cgi %dir %{pythonlib} +%dir %{hgext} %{_bindir}/hgmerge %{_bindir}/hg %{pythonlib}/templates %{pythonlib}/*.py* %{pythonlib}/*.so +%{hgext}/*.py* diff --git a/contrib/win32/mercurial.iss b/contrib/win32/mercurial.iss --- a/contrib/win32/mercurial.iss +++ b/contrib/win32/mercurial.iss @@ -28,23 +28,22 @@ AllowNoIcons=true DefaultGroupName=Mercurial [Files] -Source: templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs +Source: ..\..\msys\1.0\bin\patch.exe; DestDir: {app} Source: contrib\mercurial.el; DestDir: {app}/Contrib -Source: contrib\patchbomb; DestDir: {app}/Contrib -Source: dist\w9xpopen.exe; DestDir: {app} +Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme +Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Flags: confirmoverwrite +Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt Source: dist\hg.exe; DestDir: {app} +Source: dist\library.zip; DestDir: {app} +Source: dist\mfc71.dll; DestDir: {sys}; Flags: sharedfile uninsnosharedfileprompt Source: dist\msvcr71.dll; DestDir: {sys}; Flags: sharedfile uninsnosharedfileprompt -Source: dist\library.zip; DestDir: {app} +Source: dist\w9xpopen.exe; DestDir: {app} Source: doc\*.txt; DestDir: {app}\Docs -Source: dist\mfc71.dll; DestDir: {sys}; Flags: sharedfile uninsnosharedfileprompt +Source: templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs +Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt Source: COPYING; DestDir: {app}; DestName: Copying.txt Source: comparison.txt; DestDir: {app}\Docs; DestName: Comparison.txt Source: notes.txt; DestDir: {app}\Docs; DestName: DesignNotes.txt -Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt -Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme -Source: ..\..\msys\1.0\bin\patch.exe; DestDir: {app} -Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Flags: confirmoverwrite -Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt [INI] Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: http://www.selenic.com/mercurial/ diff --git a/doc/Makefile b/doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -8,6 +8,12 @@ man: $(MAN) html: $(HTML) +hg.1.txt: hg.1.gendoc.txt + touch hg.1.txt + +hg.1.gendoc.txt: ../mercurial/commands.py + python gendoc.py > $@ + %: %.xml xmlto man $*.xml @@ -18,4 +24,4 @@ html: $(HTML) asciidoc -b html4 $*.txt || asciidoc -b html $*.txt clean: - $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) + $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt diff --git a/doc/gendoc.py b/doc/gendoc.py new file mode 100644 --- /dev/null +++ b/doc/gendoc.py @@ -0,0 +1,92 @@ +import sys, textwrap +# import from the live mercurial repo +sys.path.insert(0, "..") +from mercurial.commands import table, globalopts +from mercurial.i18n import gettext as _ + +def get_desc(docstr): + if not docstr: + return "", "" + # sanitize + docstr = docstr.strip("\n") + docstr = docstr.rstrip() + shortdesc = docstr.splitlines()[0].strip() + + i = docstr.find("\n") + if i != -1: + desc = docstr[i+2:] + else: + desc = " %s" % shortdesc + return (shortdesc, desc) + +def get_opts(opts): + for shortopt, longopt, default, desc in opts: + allopts = [] + if shortopt: + allopts.append("-%s" % shortopt) + if longopt: + allopts.append("--%s" % longopt) + desc += default and _(" (default: %s)") % default or "" + yield(", ".join(allopts), desc) + +def get_cmd(cmd): + d = {} + attr = table[cmd] + cmds = cmd.lstrip("^").split("|") + + d['synopsis'] = attr[2] + d['cmd'] = cmds[0] + d['aliases'] = cmd.split("|")[1:] + d['desc'] = get_desc(attr[0].__doc__) + d['opts'] = list(get_opts(attr[1])) + return d + + +def show_doc(ui): + def bold(s, text=""): + ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text)) + def underlined(s, text=""): + ui.write("%s\n%s\n%s\n" % (s, "-"*len(s), text)) + + # print options + underlined(_("OPTIONS")) + for optstr, desc in get_opts(globalopts): + ui.write("%s::\n %s\n\n" % (optstr, desc)) + + # print cmds + underlined(_("COMMANDS")) + h = {} + for c, attr in table.items(): + f = c.split("|")[0] + f = f.lstrip("^") + h[f] = c + cmds = h.keys() + cmds.sort() + + for f in cmds: + if f.startswith("debug"): continue + d = get_cmd(h[f]) + # synopsis + ui.write("%s::\n" % d['synopsis'].replace("hg ","", 1)) + # description + ui.write("%s\n\n" % d['desc'][1]) + # options + opt_output = list(d['opts']) + if opt_output: + opts_len = max([len(line[0]) for line in opt_output]) + ui.write(_(" options:\n")) + for optstr, desc in opt_output: + if desc: + s = "%-*s %s" % (opts_len, optstr, desc) + else: + s = optstr + s = textwrap.fill(s, initial_indent=4 * " ", + subsequent_indent=(6 + opts_len) * " ") + ui.write("%s\n" % s) + ui.write("\n") + # aliases + if d['aliases']: + ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) + +if __name__ == "__main__": + show_doc(sys.stdout) diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -14,42 +14,6 @@ DESCRIPTION ----------- The hg(1) command provides a command line interface to the Mercurial system. -OPTIONS -------- - --R, --repository:: - repository root directory - ---cwd:: - change working directory - --y, --noninteractive:: - do not prompt, assume 'yes' for any required answers - --q, --quiet:: - suppress output - --v, --verbose:: - enable additional output - ---debug:: - enable debugging output - ---traceback:: - print traceback on exception - ---time:: - time how long the command takes - ---profile:: - print command execution profile - ---version:: - output version information and exit - --h, --help:: - display help and exit - COMMAND ELEMENTS ---------------- @@ -70,617 +34,8 @@ repository path:: fast and the old-http:// protocol which is much slower but does not require a special server on the web host. -COMMANDS --------- -add [options] [files ...]:: - Schedule files to be version controlled and added to the repository. - - The files will be added to the repository at the next commit. - - If no names are given, add all files in the current directory and - its subdirectories. - -addremove [options] [files ...]:: - Add all new files and remove all missing files from the repository. - - New files are ignored if they match any of the patterns in .hgignore. As - with add, these changes take effect at the next commit. - -annotate [-r -u -n -c -d] [files ...]:: - List changes in files, showing the revision id responsible for each line - - This command is useful to discover who did a change or when a change took - place. - - Without the -a option, annotate will avoid processing files it - detects as binary. With -a, annotate will generate an annotation - anyway, probably with undesirable results. - - options: - -a, --text treat all files as text - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - -r, --revision annotate the specified revision - -u, --user list the author - -d, --date list the commit date - -c, --changeset list the changeset - -n, --number list the revision number (default) - -bundle :: - (EXPERIMENTAL) - - Generate a compressed changegroup file collecting all changesets - not found in the other repository. - - This file can then be transferred using conventional means and - applied to another repository with the unbundle command. This is - useful when native push and pull are not available or when - exporting an entire repository is undesirable. The standard file - extension is ".hg". - - Unlike import/export, this exactly preserves all changeset - contents including permissions, rename data, and revision history. - -cat [options] :: - Print the specified files as they were at the given revision. - If no revision is given then the tip is used. - - Output may be to a file, in which case the name of the file is - given using a format string. The formatting rules are the same as - for the export command, with the following additions: - - %s basename of file being printed - %d dirname of file being printed, or '.' if in repo root - %p root-relative path name of file being printed - - options: - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - -o, --output print output to file with formatted name - -r, --rev print the given revision - -clone [options] [dest]:: - Create a copy of an existing repository in a new directory. - - If no destination directory name is specified, it defaults to the - basename of the source. - - The location of the source is added to the new repository's - .hg/hgrc file, as the default to be used for future pulls. - - For efficiency, hardlinks are used for cloning whenever the source - and destination are on the same filesystem. Some filesystems, - such as AFS, implement hardlinking incorrectly, but do not report - errors. In these cases, use the --pull option to avoid - hardlinking. - - See pull for valid source format details. - - options: - -U, --noupdate do not update the new working directory - --pull use pull protocol to copy metadata - -e, --ssh specify ssh command to use - --remotecmd specify hg command to run on the remote side - -commit [options] [files...]:: - Commit changes to the given files into the repository. - - If a list of files is omitted, all changes reported by "hg status" - from the root of the repository will be commited. - - The HGEDITOR or EDITOR environment variables are used to start an - editor to add a commit comment. - - Options: - - -A, --addremove run addremove during commit - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - -m, --message use as commit message - -l, --logfile read the commit message from - -d, --date record datecode as commit date - -u, --user record user as commiter - - aliases: ci - -copy :: - Mark dest as having copies of source files. If dest is a - directory, copies are put in that directory. If dest is a file, - there can only be one source. - - By default, this command copies the contents of files as they - stand in the working directory. If invoked with --after, the - operation is recorded, but no copying is performed. - - This command takes effect in the next commit. - - NOTE: This command should be treated as experimental. While it - should properly record copied files, this information is not yet - fully used by merge, nor fully reported by log. - - Options: - -A, --after record a copy that has already occurred - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - -f, --force forcibly copy over an existing managed file - - aliases: cp - -diff [-a] [-r revision] [-r revision] [files ...]:: - Show differences between revisions for the specified files. - - Differences between files are shown using the unified diff format. - - When two revision arguments are given, then changes are shown - between those revisions. If only one revision is specified then - that revision is compared to the working directory, and, when no - revisions are specified, the working directory files are compared - to its parent. - - Without the -a option, diff will avoid generating diffs of files - it detects as binary. With -a, diff will generate a diff anyway, - probably with undesirable results. - - options: - -a, --text treat all files as text - -I, --include include names matching the given patterns - -p, --show-function show which function each change is in - -X, --exclude exclude names matching the given patterns - -w, --ignore-all-space ignore white space when comparing lines - -export [-o filespec] [revision] ...:: - Print the changeset header and diffs for one or more revisions. - - The information shown in the changeset header is: author, - changeset hash, parent and commit comment. - - Output may be to a file, in which case the name of the file is - given using a format string. The formatting rules are as follows: - - %% literal "%" character - %H changeset hash (40 bytes of hexadecimal) - %N number of patches being generated - %R changeset revision number - %b basename of the exporting repository - %h short-form changeset hash (12 bytes of hexadecimal) - %n zero-padded sequence number, starting at 1 - %r zero-padded changeset revision number - - Without the -a option, export will avoid generating diffs of files - it detects as binary. With -a, export will generate a diff anyway, - probably with undesirable results. - - options: - -a, --text treat all files as text - -o, --output print output to file with formatted name - -forget [options] [files]:: - Undo an 'hg add' scheduled for the next commit. - - options: - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - -grep [options] pattern [files]:: - Search revisions of files for a regular expression. - - This command behaves differently than Unix grep. It only accepts - Python/Perl regexps. It searches repository history, not the - working directory. It always prints the revision number in which - a match appears. - - By default, grep only prints output for the first revision of a - file in which it finds a match. To get it to print every revision - that contains a change in match status ("-" for a match that - becomes a non-match, or "+" for a non-match that becomes a match), - use the --all flag. - - options: - -0, --print0 end fields with NUL - -I, --include include names matching the given patterns - -X, --exclude exclude names matching the given patterns - --all print all revisions that match - -i, --ignore-case ignore case when matching - -l, --files-with-matches print only filenames and revs that match - -n, --line-number print matching line numbers - -r , --rev search in given revision range - -u, --user print user who committed change - -heads:: - Show all repository head changesets. - - Repository "heads" are changesets that don't have children - changesets. They are where development generally takes place and - are the usual targets for update and merge operations. - - options: - -b, --branches show branches - -r, --rev show only heads which are descendants of rev - --style