doc/hg.1.txt
changeset 497 2dcced388cab
parent 496 6ce95a04999d
child 498 8cf3999b3d03
equal deleted inserted replaced
496:6ce95a04999d 497:2dcced388cab
    51 
    51 
    52 COMMANDS
    52 COMMANDS
    53 --------
    53 --------
    54 
    54 
    55 add [files ...]::
    55 add [files ...]::
    56     Add the given files to the repository.  Note that this just schedules the
    56     Schedule files to be version controlled and added to the repository.
    57     files for addition at the next hg commit time.
    57     
       
    58     The files get effectively added to the repository at the next commit.
    58 
    59 
    59 addremove::
    60 addremove::
    60     Add all new files and remove all missing files from the repository.  New
    61     Add all new files and remove all missing files from the repository.
    61     files are ignored if they match any of the patterns in .hgignore
    62     
       
    63     New files are ignored if they match any of the patterns in .hgignore. As
       
    64     with add, the effects of this command take place at the next commit.
    62 
    65 
    63 annotate [-r <rev> -u -n -c] [files ...]::
    66 annotate [-r <rev> -u -n -c] [files ...]::
    64     List the files with each line showing the revision id responsible
    67     List changes in files, showing the revision id responsible for each line
    65     for that line.
    68     
    66 
    69     This command is useful to discover who did a change or when a change took
       
    70     place.
       
    71     
    67     options:
    72     options:
    68     -r, --revision <rev>  annotate the specified revision
    73     -r, --revision <rev>  annotate the specified revision
    69     -u, --user            list the author
    74     -u, --user            list the author
    70     -c, --changeset       list the changeset
    75     -c, --changeset       list the changeset
    71     -n, --number          list the revision number (default)
    76     -n, --number          list the revision number (default)
    72 
    77 
    73 cat <file> [revision]::
    78 cat <file> [revision]::
    74     Output the given revision or tip of the specified file to stdout.
    79     Output to stdout the given revision for the specified file.
       
    80 
       
    81     In case no revision is given, then the tip is used.
    75 
    82 
    76 clone [-U] <source> [dest]::
    83 clone [-U] <source> [dest]::
    77     Create a new copy of an existing repository.
    84     Create a copy of an existing repository in a new directory.
       
    85 
       
    86     If the destination directory is specified, but doesn't exist, it is
       
    87     created. If no destination directory is specified, it defaults to the
       
    88     current directory.
       
    89 
       
    90     The source is added to the new copy's .hg/hgrc file to be used in
       
    91     future pulls.
       
    92 
       
    93     For speed and storage size, hardlinks are used to do the copy whenever
       
    94     the specified source and destination are on the same filesystem.
       
    95 
       
    96     options:
       
    97     -U, --no-update   do not update the new working directory
       
    98 
       
    99 commit [-A -t -l <file> -t <text> -u <user> -d <datecode>] [files...]::
       
   100     Incorporate changes from given files into the repository.
       
   101     
       
   102     If a list of files is ommited, all of the working dir files will
       
   103     be commited.
       
   104     
       
   105     The EDITOR environment variable is used to bring up an editor to add
       
   106     a commit comment.
       
   107 
       
   108     Options:
       
   109 
       
   110     -A, --addremove       run addremove during commit
       
   111     -t, --text <text>     use <text> as commit message
       
   112     -l, --logfile <file>  show the commit message for the given file
       
   113     -d, --date <datecode> record datecode as commit date
       
   114     -u, --user <user>     record user as commiter
       
   115 
       
   116     aliases: ci
       
   117 
       
   118 copy <source> <dest>::
       
   119     Mark <dest> file as a copy or rename of a <source> one
       
   120     
       
   121     This command takes effect for the next commit.
       
   122 
       
   123 diff [-r revision] [-r revision] [files ...]::
       
   124     Show differences between revisions for the specified files.
       
   125     
       
   126     Differences between files are shown using the unified diff format.
       
   127     
       
   128     When two revision arguments are given, then changes are shown between
       
   129     such revisions. If only one revision is specified then that revision is
       
   130     compared to the tip, and, when no revisions are specified, the working
       
   131     directory files are compared to the tip.
       
   132 
       
   133 export [revision]::
       
   134     Print the changeset header and diffs for a particular revision.
       
   135 
       
   136     The information shown in the changeset header is: author, changeset hash,
       
   137     parent and commit comment.
       
   138 
       
   139 forget [files]::
       
   140     Undo an 'hg add' scheduled for the next commit.
       
   141 
       
   142 heads::
       
   143     Show all repository head changesets.
       
   144     
       
   145     Repository "heads" are changesets that don't have children changesets.
       
   146     They are where development generally takes place and are the usual targets
       
   147     for update and merge operations.
       
   148 
       
   149 history::
       
   150     Print a log of the revision history of the repository.
       
   151     
       
   152     By default this command outputs: changeset id and hash, tags, parents,
       
   153     user, date and time, and a summary for each commit.
       
   154     The -v switch adds some more detail, such as changed files, manifest
       
   155     hashes or message signatures.
       
   156 
       
   157     To display the history of a given file, see the log command.
       
   158 
       
   159 identify::
       
   160     Print a short summary of the current state of the repo.
       
   161     
       
   162     This summary identifies the repository state using one or two parent
       
   163     hash identifiers, followed by a "+" if there are uncommitted changes
       
   164     in the working directory, followed by a list of tags for this revision.
       
   165 
       
   166     aliases: id
       
   167 
       
   168 import [-p <n> -b <base> -q] <patches>::
       
   169     Import a list of patches and commit them individually.
       
   170 
       
   171     options:
       
   172     -p, --strip <n>   directory strip option for patch. This has the same
       
   173                       meaning as the correnponding patch option
       
   174     -b <path>         base directory to read patches from
       
   175 
       
   176     aliases: patch
       
   177 
    78 
   178 
    79     If the specified source is on the same filesystem, the repository
   179     If the specified source is on the same filesystem, the repository
    80     will be copied via hardlinks. This is the fastest and most
   180     will be copied via hardlinks. This is the fastest and most
    81     space-efficient mode of operation.
   181     space-efficient mode of operation.
    82 
   182 
    89     future pulls.
   189     future pulls.
    90 
   190 
    91     options:
   191     options:
    92     -U, --no-update   do not update the new working directory
   192     -U, --no-update   do not update the new working directory
    93 
   193 
    94 commit [-A -t -l <file> -t <text> -u <user> -d <datecode>] [files...]::
       
    95     Commit all changed files in the working dir to the repository.  This uses
       
    96     the EDITOR environment variable to bring up an editor to add a commit
       
    97     comment.
       
    98 
       
    99     Options:
       
   100 
       
   101     -A, --addremove       run addremove during commit
       
   102     -t, --text <text>     use <text> as commit message
       
   103     -l, --logfile <file>  read the commit message from the specified
       
   104                           file
       
   105     -d, --date <datecode> use the specified date code
       
   106     -u, --user <user>     record commit as the specified user
       
   107 
       
   108     aliases: ci
       
   109 
       
   110 copy <source> <dest>::
       
   111     Mark a file as copied or renamed for the next commit.
       
   112 
       
   113 diff [-r revision] [-r revision] [files ...]::
       
   114     Generate a unified diff of the indicated files. If there are no
       
   115     revisions specified, the working directory file is compared to
       
   116     the tip, one revision specified indicates a comparison between the
       
   117     working directory file and the specified revision, and two revisions
       
   118     compares the two versions specified.
       
   119 
       
   120 export [revision]::
       
   121     Print the changeset header (author, changeset hash, parent, and commit
       
   122     comment) and the diffs for a particular revision.
       
   123 
       
   124 forget [files]::
       
   125     Undo an 'hg add' scheduled for the next commit.
       
   126 
       
   127 heads::
       
   128     Show all changesets with no children. These are the "heads" of
       
   129     development branches and are the usual targets for updates and merges.
       
   130 
       
   131 history::
       
   132     Print the revision history of the repository. Use the -v switch
       
   133     for more detail.
       
   134 
       
   135 identify::
       
   136     Print a short identifier of the current state of the repo. This
       
   137     includes one or two parent hash identifiers, followed by
       
   138     a "+" if there are uncommitted changes in the working directory,
       
   139     followed by a list of tags for this revision.
       
   140 
       
   141     aliases: id
       
   142 
       
   143 import [-p <n> -b <base> -q] <patches>::
       
   144     Import the listed patches and commit them individually.
       
   145 
       
   146     options:
       
   147     -p, --strip <n>   directory strip option for patch
       
   148     -b <path>         base directory to read patches from
       
   149 
       
   150     aliases: patch
       
   151 
       
   152 init::
   194 init::
   153     Initialize a new repository in the current directory.
   195     Initialize a new repository in the current directory.
   154 
   196 
   155 log <file>::
   197 log <file>::
   156     Print the revision history of the specified file.
   198     Print the revision history of the specified file.
   157 
   199 
       
   200     To display the revision history for the whole repository, use the history
       
   201     command.
       
   202 
   158 manifest [revision]::
   203 manifest [revision]::
   159     Print the indicated revision of the manifest (list of version controlled
   204     Print a list of version controlled files for the given revision.
   160     files).
   205 
       
   206     The manifest is the list of files being version controlled. If no revision
       
   207     is given then the tip is used.
   161 
   208 
   162 parents::
   209 parents::
   163     Print the working directory's parent revisions.
   210     Print the working directory's parent revisions.
   164 
   211 
   165 pull <repository path>::
   212 pull <repository path>::
   166     Pull any changes from the specified repository to the repository in the
   213     Pull any changes from a repository to the current directory's one.
   167     current directory.
   214 
       
   215     Pulling is a fundamental operation in a distributed version control system,
       
   216     as it eases handling changes from different branches, both local and
       
   217     remote, into the current repository. 
   168 
   218 
   169     options:
   219     options:
   170     -u, --update   update the working directory to tip after pull
   220     -u, --update   update the working directory to tip after pull
   171 
   221 
   172 push <destination>::
   222 push <destination>::
   173     Push changes from the local repository to the specified
   223     Push changes from the local repository to the given destination.
   174     destination. If the destination is local, this is identical to a
   224     
   175     a pull in that directory from the current directory.
   225     This is the symmetrical operation for pull. It helps to move changes from
       
   226     the current repository to a different one. If the destination is local
       
   227     this is identical to a pull in that directory from the current one.
   176 
   228 
   177     The other currently available push method is SSH. This requires an
   229     The other currently available push method is SSH. This requires an
   178     accessible shell account on the destination machine and a copy of
   230     accessible shell account on the destination machine and a copy of
   179     hg in the remote path. Destinations are specified in the following
   231     hg in the remote path. Destinations are specified in the following
   180     form:
   232     form:
   181 
   233 
   182       ssh://[user@]host[:port]/path
   234       ssh://[user@]host[:port]/path
   183 
   235 
   184 rawcommit [-p -d -u -F -t -l]::
   236 rawcommit [-p -d -u -F -t -l]::
   185     Primarily useful for importing from other SCMs.
   237     Lowlevel commit, for use in helper scripts.
       
   238     
       
   239     This command is not intended to be used by normal users, as it is
       
   240     primarily useful for importing from other SCMs.
   186 
   241 
   187 recover::
   242 recover::
   188     Recover from an interrupted commit or pull. This should only be
   243     Recover from an interrupted commit or pull.
   189     necessary when Mercurial suggests it.
   244     
       
   245     This command tries to fix the repository status after an interrupted
       
   246     operation. It should only be necessary when Mercurial suggests it.
   190 
   247 
   191 remove [files ...]::
   248 remove [files ...]::
   192     Schedule the indicated files for removal from the repository at the next
   249     Schedule the indicated files for removal from the repository.
   193     commit.
   250     
       
   251     This command shedules the files to be removed, but the actual removing
       
   252     takes place at the next commit.
   194 
   253 
   195     aliases: rm
   254     aliases: rm
   196 
   255 
   197 root::
   256 root::
   198     Print the root directory of the current repository.
   257     Print the root directory of the current repository.
   207     -t, --templatedir <path> web templates to use
   266     -t, --templatedir <path> web templates to use
   208 
   267 
   209 status::
   268 status::
   210     Show changed files in the working directory.
   269     Show changed files in the working directory.
   211 
   270 
       
   271     The codes used to show the status of files are:
       
   272     
   212     C = changed
   273     C = changed
   213     A = added
   274     A = added
   214     R = removed
   275     R = removed
   215     ? = not tracked
   276     ? = not tracked
   216 
   277 
   217 tag [-t <text> -d <datecode> -u <user>] <name> [revision]::
   278 tag [-t <text> -d <datecode> -u <user>] <name> [revision]::
   218     Add a tag <name> to the specified revision or the tip.
   279     Name a particular revision using <name>.
   219 
   280     
       
   281     Tags are used to name particular revisions of the repository and are
       
   282     very useful to compare different revision, to go back to significant
       
   283     earlier versions or to set special branch points, as releases, etc.
       
   284     
       
   285     If no revision is given as argument the tip is used.
       
   286 
       
   287     This tags are versioned, and kept along with the repository metadata. But
       
   288     Mercurial has support for other type of tags that can be used locally for
       
   289     convenience and that are created adding lines with a changeset hash value
       
   290     and a name or names to name the revision in a .hgtags file
       
   291     
   220     options:
   292     options:
   221     -t, --text <text>     message for tag commit log entry
   293     -t, --text <text>     message for tag commit log entry
   222     -d, --date <datecode> datecode for commit
   294     -d, --date <datecode> datecode for commit
   223     -u, --user <user>     user for commit
   295     -u, --user <user>     user for commit
   224 
   296 
   225 tags::
   297 tags::
   226     List the repository tags.
   298     List the repository tags.
   227 
   299 
       
   300     Local tags in the .hgtags don't get listed when using this command.
       
   301 
   228 tip::
   302 tip::
   229     Show the tip revision.
   303     Show the tip revision.
   230 
   304 
   231 undo::
   305 undo::
   232     Undo the last commit or pull transaction.
   306     Undo the last commit or pull transaction.
   233 
   307 
   234 update [-m -C] [revision]::
   308 update [-m -C] [revision]::
   235     Update or merge the working directory to a specified revision.
   309     Bring the working directory to the state of a given revision.
   236 
   310 
   237     If there are no outstanding changes in the working directory and
   311     After running this command the current directory will have the contents
   238     there is a linear relationship between the current version and the
   312     of the specified revision.
   239     requested version, the result is the requested version.
   313     
   240 
   314     If there were outstanding changes in the current directory and a merge
   241     Otherwise the result is a merge between the contents of the
   315     would be needed, the -m option can be used to merge those changes with
   242     current working directory and the requested version. Files that
   316     the target revision. Without the -m or --merge option, no merge
   243     changed between either parent are marked as changed for the next
   317     will happen.
   244     commit and a commit must be performed before any further updates
   318     
   245     are allowed. Merging will not be performed without the -m flag.
   319     The -C or --clean option must be used in case a pristine version is
   246 
   320     desired. In this case, existing changes will be discarded and lost. If
   247     The -C switch will tell Mercurial to forcibly update to the
   321     these changes should be kept, then a commit prior updating, or a merge
   248     specified version, adding, removing, and overwriting locally
   322     is due.
   249     changed fils as necessary.
   323     
   250 
       
   251     options:
   324     options:
   252     -m, --merge       allow merging of branches
   325     -m, --merge       allow merging of branches
   253     -C, --clean       overwrite locally modified files
   326     -C, --clean       overwrite locally modified files
   254 
   327 
   255     aliases: up checkout co
   328     aliases: up checkout co