Show More
@@ -5942,6 +5942,15 b' def push(ui, repo, dest=None, **opts):' | |||
|
5942 | 5942 | if not revs: |
|
5943 | 5943 | raise error.Abort(_("specified revisions evaluate to an empty set"), |
|
5944 | 5944 | hint=_("use different revision arguments")) |
|
5945 | elif path.pushrev: | |
|
5946 | # It doesn't make any sense to specify ancestor revisions. So limit | |
|
5947 | # to DAG heads to make discovery simpler. | |
|
5948 | expr = revset.formatspec('heads(%r)', path.pushrev) | |
|
5949 | revs = scmutil.revrange(repo, [expr]) | |
|
5950 | revs = [repo[rev].node() for rev in revs] | |
|
5951 | if not revs: | |
|
5952 | raise error.Abort(_('default push revset for path evaluates to an ' | |
|
5953 | 'empty set')) | |
|
5945 | 5954 | |
|
5946 | 5955 | repo._subtoppath = dest |
|
5947 | 5956 | try: |
@@ -1282,6 +1282,18 b' The following sub-options can be defined' | |||
|
1282 | 1282 | The URL to use for push operations. If not defined, the location |
|
1283 | 1283 | defined by the path's main entry is used. |
|
1284 | 1284 | |
|
1285 | ``pushrev`` | |
|
1286 | A revset defining which revisions to push by default. | |
|
1287 | ||
|
1288 | When :hg:`push` is executed without a ``-r`` argument, the revset | |
|
1289 | defined by this sub-option is evaluated to determine what to push. | |
|
1290 | ||
|
1291 | For example, a value of ``.`` will push the working directory's | |
|
1292 | revision by default. | |
|
1293 | ||
|
1294 | Revsets specifying bookmarks will not result in the bookmark being | |
|
1295 | pushed. | |
|
1296 | ||
|
1285 | 1297 | The following special named paths exist: |
|
1286 | 1298 | |
|
1287 | 1299 | ``default`` |
@@ -1281,6 +1281,10 b' def pushurlpathoption(ui, path, value):' | |||
|
1281 | 1281 | |
|
1282 | 1282 | return str(u) |
|
1283 | 1283 | |
|
1284 | @pathsuboption('pushrev', 'pushrev') | |
|
1285 | def pushrevpathoption(ui, path, value): | |
|
1286 | return value | |
|
1287 | ||
|
1284 | 1288 | class path(object): |
|
1285 | 1289 | """Represents an individual path and its configuration.""" |
|
1286 | 1290 |
@@ -105,4 +105,43 b' Windows needs a leading slash to make a ' | |||
|
105 | 105 | adding file changes |
|
106 | 106 | added 1 changesets with 1 changes to 1 files |
|
107 | 107 | |
|
108 | :pushrev is used when no -r is passed | |
|
109 | ||
|
110 | $ cat >> .hg/hgrc << EOF | |
|
111 | > default:pushrev = . | |
|
112 | > EOF | |
|
113 | $ hg -q up -r 0 | |
|
114 | $ echo head1 > foo | |
|
115 | $ hg -q commit -A -m head1 | |
|
116 | $ hg -q up -r 0 | |
|
117 | $ echo head2 > foo | |
|
118 | $ hg -q commit -A -m head2 | |
|
119 | $ hg push -f | |
|
120 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) | |
|
121 | searching for changes | |
|
122 | adding changesets | |
|
123 | adding manifests | |
|
124 | adding file changes | |
|
125 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
126 | ||
|
127 | $ hg --config 'paths.default:pushrev=draft()' push -f | |
|
128 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) | |
|
129 | searching for changes | |
|
130 | adding changesets | |
|
131 | adding manifests | |
|
132 | adding file changes | |
|
133 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
|
134 | ||
|
135 | Invalid :pushrev raises appropriately | |
|
136 | ||
|
137 | $ hg --config 'paths.default:pushrev=notdefined()' push | |
|
138 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) | |
|
139 | hg: parse error: unknown identifier: notdefined | |
|
140 | [255] | |
|
141 | ||
|
142 | $ hg --config 'paths.default:pushrev=(' push | |
|
143 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) | |
|
144 | hg: parse error at 1: not a prefix: end | |
|
145 | [255] | |
|
146 | ||
|
108 | 147 | $ cd .. |
@@ -1515,6 +1515,18 b' Test section lookup' | |||
|
1515 | 1515 | The URL to use for push operations. If not defined, the location |
|
1516 | 1516 | defined by the path's main entry is used. |
|
1517 | 1517 | |
|
1518 | "pushrev" | |
|
1519 | A revset defining which revisions to push by default. | |
|
1520 | ||
|
1521 | When 'hg push' is executed without a "-r" argument, the revset defined | |
|
1522 | by this sub-option is evaluated to determine what to push. | |
|
1523 | ||
|
1524 | For example, a value of "." will push the working directory's revision | |
|
1525 | by default. | |
|
1526 | ||
|
1527 | Revsets specifying bookmarks will not result in the bookmark being | |
|
1528 | pushed. | |
|
1529 | ||
|
1518 | 1530 | The following special named paths exist: |
|
1519 | 1531 | |
|
1520 | 1532 | "default" |
General Comments 0
You need to be logged in to leave comments.
Login now