Show More
@@ -223,9 +223,11 b' diff [-a] [-r revision] [-r revision] [f' | |||||
223 | probably with undesirable results. |
|
223 | probably with undesirable results. | |
224 |
|
224 | |||
225 | options: |
|
225 | options: | |
226 | -a, --text treat all files as text |
|
226 | -a, --text treat all files as text | |
227 | -I, --include <pat> include names matching the given patterns |
|
227 | -I, --include <pat> include names matching the given patterns | |
228 | -X, --exclude <pat> exclude names matching the given patterns |
|
228 | -p, --show-function show which function each change is in | |
|
229 | -X, --exclude <pat> exclude names matching the given patterns | |||
|
230 | -w, --ignore-all-space ignore white space when comparing lines | |||
229 |
|
231 | |||
230 | export [-o filespec] [revision] ...:: |
|
232 | export [-o filespec] [revision] ...:: | |
231 | Print the changeset header and diffs for one or more revisions. |
|
233 | Print the changeset header and diffs for one or more revisions. | |
@@ -600,9 +602,12 b' tags::' | |||||
600 |
|
602 | |||
601 | This lists both regular and local tags. |
|
603 | This lists both regular and local tags. | |
602 |
|
604 | |||
603 | tip:: |
|
605 | tip [-p]:: | |
604 | Show the tip revision. |
|
606 | Show the tip revision. | |
605 |
|
607 | |||
|
608 | options: | |||
|
609 | -p, --patch show patch | |||
|
610 | ||||
606 | unbundle <file>:: |
|
611 | unbundle <file>:: | |
607 | (EXPERIMENTAL) |
|
612 | (EXPERIMENTAL) | |
608 |
|
613 |
@@ -150,8 +150,8 b' hooks::' | |||||
150 | it is passed are listed with names of the form "$HG_foo". |
|
150 | it is passed are listed with names of the form "$HG_foo". | |
151 |
|
151 | |||
152 | changegroup;; |
|
152 | changegroup;; | |
153 |
Run after a changegroup has been added via push |
|
153 | Run after a changegroup has been added via push, pull or | |
154 | first new changeset is in $HG_NODE. |
|
154 | unbundle. ID of the first new changeset is in $HG_NODE. | |
155 | commit;; |
|
155 | commit;; | |
156 | Run after a changeset has been created in the local repository. |
|
156 | Run after a changeset has been created in the local repository. | |
157 | ID of the newly created changeset is in $HG_NODE. Parent |
|
157 | ID of the newly created changeset is in $HG_NODE. Parent | |
@@ -160,6 +160,10 b' hooks::' | |||||
160 | Run after a changeset has been pulled, pushed, or unbundled into |
|
160 | Run after a changeset has been pulled, pushed, or unbundled into | |
161 | the local repository. The ID of the newly arrived changeset is in |
|
161 | the local repository. The ID of the newly arrived changeset is in | |
162 | $HG_NODE. |
|
162 | $HG_NODE. | |
|
163 | prechangegroup;; | |||
|
164 | Run before a changegroup is added via push, pull or unbundle. | |||
|
165 | Exit status 0 allows the changegroup to proceed. Non-zero status | |||
|
166 | will cause the push, pull or unbundle to fail. | |||
163 | precommit;; |
|
167 | precommit;; | |
164 | Run before starting a local commit. Exit status 0 allows the |
|
168 | Run before starting a local commit. Exit status 0 allows the | |
165 | commit to proceed. Non-zero status will cause the commit to fail. |
|
169 | commit to proceed. Non-zero status will cause the commit to fail. | |
@@ -169,6 +173,14 b' hooks::' | |||||
169 | created. Non-zero status will cause the tag to fail. ID of |
|
173 | created. Non-zero status will cause the tag to fail. ID of | |
170 | changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag |
|
174 | changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag | |
171 | is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
175 | is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0. | |
|
176 | pretxnchangegroup;; | |||
|
177 | Run after a changegroup has been added via push, pull or unbundle, | |||
|
178 | but before the transaction has been committed. Changegroup is | |||
|
179 | visible to hook program. This lets you validate incoming changes | |||
|
180 | before accepting them. Passed the ID of the first new changeset | |||
|
181 | in $NODE. Exit status 0 allows the transaction to commit. | |||
|
182 | Non-zero status will cause the transaction to be rolled back and | |||
|
183 | the push, pull or unbundle will fail. | |||
172 | pretxncommit;; |
|
184 | pretxncommit;; | |
173 | Run after a changeset has been created but the transaction not yet |
|
185 | Run after a changeset has been created but the transaction not yet | |
174 | committed. Changeset is visible to hook program. This lets you |
|
186 | committed. Changeset is visible to hook program. This lets you |
@@ -261,7 +261,7 b' def make_file(repo, r, pat, node=None,' | |||||
261 | mode) |
|
261 | mode) | |
262 |
|
262 | |||
263 | def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, |
|
263 | def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, | |
264 | changes=None, text=False): |
|
264 | changes=None, text=False, opts={}): | |
265 | if not changes: |
|
265 | if not changes: | |
266 | changes = repo.changes(node1, node2, files, match=match) |
|
266 | changes = repo.changes(node1, node2, files, match=match) | |
267 | modified, added, removed, deleted, unknown = changes |
|
267 | modified, added, removed, deleted, unknown = changes | |
@@ -296,8 +296,8 b' def dodiff(fp, ui, repo, node1, node2, f' | |||||
296 | date1 = util.datestr(change[2]) |
|
296 | date1 = util.datestr(change[2]) | |
297 |
|
297 | |||
298 | diffopts = ui.diffopts() |
|
298 | diffopts = ui.diffopts() | |
299 | showfunc = diffopts['showfunc'] |
|
299 | showfunc = opts.get('show_function') or diffopts['showfunc'] | |
300 | ignorews = diffopts['ignorews'] |
|
300 | ignorews = opts.get('ignore_all_space') or diffopts['ignorews'] | |
301 | for f in modified: |
|
301 | for f in modified: | |
302 | to = None |
|
302 | to = None | |
303 | if f in mmap: |
|
303 | if f in mmap: | |
@@ -1140,7 +1140,7 b' def diff(ui, repo, *pats, **opts):' | |||||
1140 | fns, matchfn, anypats = matchpats(repo, pats, opts) |
|
1140 | fns, matchfn, anypats = matchpats(repo, pats, opts) | |
1141 |
|
1141 | |||
1142 | dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn, |
|
1142 | dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn, | |
1143 | text=opts['text']) |
|
1143 | text=opts['text'], opts=opts) | |
1144 |
|
1144 | |||
1145 | def doexport(ui, repo, changeset, seqno, total, revwidth, opts): |
|
1145 | def doexport(ui, repo, changeset, seqno, total, revwidth, opts): | |
1146 | node = repo.lookup(changeset) |
|
1146 | node = repo.lookup(changeset) | |
@@ -2158,13 +2158,15 b' def tags(ui, repo):' | |||||
2158 | r = " ?:?" |
|
2158 | r = " ?:?" | |
2159 | ui.write("%-30s %s\n" % (t, r)) |
|
2159 | ui.write("%-30s %s\n" % (t, r)) | |
2160 |
|
2160 | |||
2161 | def tip(ui, repo): |
|
2161 | def tip(ui, repo, **opts): | |
2162 | """show the tip revision |
|
2162 | """show the tip revision | |
2163 |
|
2163 | |||
2164 | Show the tip revision. |
|
2164 | Show the tip revision. | |
2165 | """ |
|
2165 | """ | |
2166 | n = repo.changelog.tip() |
|
2166 | n = repo.changelog.tip() | |
2167 | show_changeset(ui, repo, changenode=n) |
|
2167 | show_changeset(ui, repo, changenode=n) | |
|
2168 | if opts['patch']: | |||
|
2169 | dodiff(ui, ui, repo, repo.changelog.parents(n)[0], n) | |||
2168 |
|
2170 | |||
2169 | def unbundle(ui, repo, fname, **opts): |
|
2171 | def unbundle(ui, repo, fname, **opts): | |
2170 | """apply a changegroup file |
|
2172 | """apply a changegroup file | |
@@ -2340,7 +2342,12 b' table = {' | |||||
2340 | [('r', 'rev', [], _('revision')), |
|
2342 | [('r', 'rev', [], _('revision')), | |
2341 | ('a', 'text', None, _('treat all files as text')), |
|
2343 | ('a', 'text', None, _('treat all files as text')), | |
2342 | ('I', 'include', [], _('include names matching the given patterns')), |
|
2344 | ('I', 'include', [], _('include names matching the given patterns')), | |
2343 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
|
2345 | ('p', 'show-function', None, | |
|
2346 | _('show which function each change is in')), | |||
|
2347 | ('w', 'ignore-all-space', None, | |||
|
2348 | _('ignore white space when comparing lines')), | |||
|
2349 | ('X', 'exclude', [], | |||
|
2350 | _('exclude names matching the given patterns'))], | |||
2344 | _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), |
|
2351 | _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), | |
2345 | "^export": |
|
2352 | "^export": | |
2346 | (export, |
|
2353 | (export, | |
@@ -2501,7 +2508,7 b' table = {' | |||||
2501 | ('r', 'rev', '', _('revision to tag'))], |
|
2508 | ('r', 'rev', '', _('revision to tag'))], | |
2502 | _('hg tag [-r REV] [OPTION]... NAME')), |
|
2509 | _('hg tag [-r REV] [OPTION]... NAME')), | |
2503 | "tags": (tags, [], _('hg tags')), |
|
2510 | "tags": (tags, [], _('hg tags')), | |
2504 | "tip": (tip, [], _('hg tip')), |
|
2511 | "tip": (tip, [('p', 'patch', None, _('show patch'))], _('hg tip')), | |
2505 | "unbundle": |
|
2512 | "unbundle": | |
2506 | (unbundle, |
|
2513 | (unbundle, | |
2507 | [('u', 'update', None, |
|
2514 | [('u', 'update', None, |
@@ -1345,6 +1345,9 b' class localrepository(object):' | |||||
1345 |
|
1345 | |||
1346 | if not source: |
|
1346 | if not source: | |
1347 | return |
|
1347 | return | |
|
1348 | ||||
|
1349 | self.hook('prechangegroup', throw=True) | |||
|
1350 | ||||
1348 | changesets = files = revisions = 0 |
|
1351 | changesets = files = revisions = 0 | |
1349 |
|
1352 | |||
1350 | tr = self.transaction() |
|
1353 | tr = self.transaction() | |
@@ -1387,6 +1390,9 b' class localrepository(object):' | |||||
1387 | " with %d changes to %d files%s\n") |
|
1390 | " with %d changes to %d files%s\n") | |
1388 | % (changesets, revisions, files, heads)) |
|
1391 | % (changesets, revisions, files, heads)) | |
1389 |
|
1392 | |||
|
1393 | self.hook('pretxnchangegroup', throw=True, | |||
|
1394 | node=hex(self.changelog.node(cor+1))) | |||
|
1395 | ||||
1390 | tr.close() |
|
1396 | tr.close() | |
1391 |
|
1397 | |||
1392 | if changesets > 0: |
|
1398 | if changesets > 0: |
General Comments 0
You need to be logged in to leave comments.
Login now