@@ -64,8 +64,7 @@ You need to provide an SSH-2 key to be able to commit code. You may have
64
64
multiple keys if you wish (e.g., for work and home). Using Ed25519 keys is
65
65
encouraged. Send your key as an attachment in an email to
66
66
hgaccounts@python.org along with your GitHub username so you can be added to
67
- the "Python core" team at https://github.com/python. Help in generating an SSH
68
- key can be found in the :ref: `faq `.
67
+ the "Python core" team at https://github.com/python.
69
68
70
69
Your SSH key will be set to a username in the form of "first_name.last_name".
71
70
This should match your username on the issue tracker.
@@ -165,3 +164,142 @@ break or figure out what you need to do to make it enjoyable again.
165
164
166
165
167
166
.. _PSF Code of Conduct : https://www.python.org/psf/codeofconduct/
167
+
168
+
169
+ .. _version-core-devs :
170
+
171
+ Version control for core developers
172
+ -----------------------------------
173
+
174
+ .. _hg-commit :
175
+
176
+ How do I commit a change to a file?
177
+ '''''''''''''''''''''''''''''''''''
178
+
179
+ To commit any changes to a file (which includes adding a new file or deleting
180
+ an existing one), you use the command::
181
+
182
+ hg commit [PATH]
183
+
184
+ ``PATH `` is optional: if it is omitted, all changes in your working copy
185
+ will be committed to the local repository. When you commit, be sure that all
186
+ changes are desired by :ref: `reviewing them first <hg-status >`;
187
+ also, when making commits that you intend to push to public repositories,
188
+ you should **not ** commit together unrelated changes.
189
+
190
+ To abort a commit that you are in the middle of, leave the message
191
+ empty (i.e., close the text editor without adding any text for the
192
+ message). Mercurial will then abort the commit operation so that you can
193
+ try again later.
194
+
195
+ Once a change is committed to your local repository, it is still only visible
196
+ by you. This means you are free to experiment with as many local commits
197
+ you feel like.
198
+
199
+ .. note ::
200
+ If you do not like the default text editor Mercurial uses for
201
+ entering commit messages, you may specify a different editor,
202
+ either by changing the ``EDITOR `` environment variable or by setting
203
+ a Mercurial-specific editor in your global ``.hgrc `` with the ``editor ``
204
+ option in the ``[ui] `` section.
205
+
206
+
207
+ .. _hg-merge-conflicts :
208
+
209
+ How do I solve merge conflicts?
210
+ '''''''''''''''''''''''''''''''
211
+
212
+ The easiest way is to install KDiff3 --- Mercurial will open it automatically
213
+ in case of conflicts, and you can then use it to solve the conflicts and
214
+ save the resulting file(s). KDiff3 will also take care of marking the
215
+ conflicts as resolved.
216
+
217
+ If you don't use a merge tool, you can use ``hg resolve --list `` to list the
218
+ conflicting files, resolve the conflicts manually, and the use
219
+ ``hg resolve --mark <file path> `` to mark these conflicts as resolved.
220
+ You can also use ``hg resolve -am `` to mark all the conflicts as resolved.
221
+
222
+ .. note ::
223
+ Mercurial will use KDiff3 automatically if it's installed and it can find
224
+ it --- you don't need to change any settings. KDiff3 is also already
225
+ included in the installer of TortoiseHg. For more information, see
226
+ https://www.mercurial-scm.org/wiki/KDiff3.
227
+
228
+
229
+ .. _hg-null-merge :
230
+
231
+ How do I make a null merge?
232
+ '''''''''''''''''''''''''''
233
+
234
+ If you committed something (e.g. on 3.5) that shouldn't be ported on newer
235
+ branches (e.g. on default), you have to do a *null merge *::
236
+
237
+ cd 3.x
238
+ hg merge 3.5
239
+ hg revert -ar default
240
+ hg resolve -am # needed only if the merge created conflicts
241
+ hg ci -m '#12345: null merge with 3.5.'
242
+
243
+ Before committing, ``hg status `` should list all the merged files as ``M ``,
244
+ but ``hg diff `` should produce no output. This will record the merge without
245
+ actually changing the content of the files.
246
+
247
+
248
+ .. _hg-heads-merge :
249
+
250
+ I got "abort: push creates new remote heads!" while pushing, what do I do?
251
+ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
252
+
253
+ If you see this message while pushing, it means that you committed something
254
+ on a clone that was not up to date, thus creating a new head.
255
+ This usually happens for two reasons:
256
+
257
+ 1. You forgot to run ``hg pull `` and/or ``hg up `` before committing;
258
+ 2. Someone else pushed on the main repo just before you, causing a push race;
259
+
260
+ First of all you should pull the new changesets using ``hg pull ``. Then you can
261
+ use ``hg heads `` to see which branches have multiple heads.
262
+
263
+ If only one branch has multiple heads, you can do::
264
+
265
+ cd default
266
+ hg heads .
267
+ hg up csid-of-the-other-head
268
+ hg merge
269
+ hg ci -m 'Merge heads.'
270
+
271
+ ``hg heads . `` will show you the two heads of the current branch: the one you
272
+ pulled and the one you created with your commit (you can also specify a branch
273
+ with ``hg heads <branch> ``). While not strictly necessary, it is highly
274
+ recommended to switch to the other head before merging. This way you will be
275
+ merging only your changeset with the rest, and in case of conflicts it will be
276
+ a lot easier.
277
+
278
+ If more than one branch has multiple heads, you have to repeat these steps for
279
+ each branch. Since this creates new changesets, you will also have to
280
+ :ref: `merge them between branches <branch-merge >`. For example, if both ``3.5 ``
281
+ and ``default `` have multiple heads, you should first merge heads in ``3.5 ``,
282
+ then merge heads in ``default ``, and finally merge ``3.5 `` with ``default ``
283
+ using ``hg merge 3.5 `` as usual.
284
+
285
+ In order to avoid this, you should *always remember to pull and update before
286
+ committing *.
287
+
288
+
289
+ How do I undo the changes made in a recent commit?
290
+ ''''''''''''''''''''''''''''''''''''''''''''''''''
291
+
292
+ First, this should not happen if you take the habit of :ref: `reviewing changes
293
+ <hg-status>` before committing them.
294
+
295
+ In any case, run::
296
+
297
+ hg backout <revision number>
298
+
299
+ This will modify your working copy so that all changes in ``<revision number> ``
300
+ (including added or deleted files) are undone. You then need to :ref: `commit
301
+ <hg-commit>` these changes so that the backout gets permanently recorded.
302
+
303
+ .. note ::
304
+ These instructions are for Mercurial 1.7 and higher. ``hg backout `` has
305
+ a slightly different behaviour in versions before 1.7.
0 commit comments