forked from magit/forge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge.texi
More file actions
1243 lines (925 loc) · 38 KB
/
Copy pathforge.texi
File metadata and controls
1243 lines (925 loc) · 38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\input texinfo @c -*- texinfo -*-
@c %**start of header
@setfilename forge.info
@settitle Forge User and Developer Manual
@documentencoding UTF-8
@documentlanguage en
@c %**end of header
@copying
@quotation
Copyright (C) 2018-2020 Jonas Bernoulli <jonas@@bernoul.li>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any
later version.
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the GNU
General Public License for more details.
@end quotation
@end copying
@dircategory Emacs
@direntry
* Forge: (forge). Access Git Forges from Magit.
@end direntry
@finalout
@titlepage
@title Forge User and Developer Manual
@subtitle for version 0.1.0 (v0.1.0-320-g639ce512+1)
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
@contents
@ifnottex
@node Top
@top Forge User and Developer Manual
Forge allows you to work with Git forges, such as Github and Gitlab,
from the comfort of Magit and the rest of Emacs.
@noindent
This manual is for Forge version 0.1.0 (v0.1.0-320-g639ce512+1).
@quotation
Copyright (C) 2018-2020 Jonas Bernoulli <jonas@@bernoul.li>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any
later version.
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the GNU
General Public License for more details.
@end quotation
@end ifnottex
@menu
* Introduction::
* Supported Forges and Hosts::
* Getting Started::
* Usage::
* FAQ::
* Keystroke Index::
* Command Index::
* Function Index::
* Variable Index::
@detailmenu
--- The Detailed Node Listing ---
Getting Started
* Initial Pull::
* Token Creation::
* Repository Detection::
Usage
* Pulling::
* Branching::
* Working with Topics::
* Miscellaneous::
Working with Topics
* Visiting Topics::
* Listing Topics and Notifications::
* Creating Topics::
* Editing Topics and Posts::
FAQ
* Is it possible to create a single pull-request without pulling everything?::
@end detailmenu
@end menu
@node Introduction
@chapter Introduction
Forge allows you to work with Git forges, such as Github and Gitlab,
from the comfort of Magit and the rest of Emacs.
Forge fetches issues, pull-requests and other data using the forge's
API and stores that in a local database. Additionally it fetches the
pull-request references using Git. Forge implements various features
that use this data but the database and pull-request refs can also be
used by third-party packages.
@node Supported Forges and Hosts
@chapter Supported Forges and Hosts
Currently Forge supports two forges and three more forges partially.
Additionally it supports four semi-forges. Support for more forges
and semi-forges can and will be added.
Both forges and semi-forges provide web interfaces for Git
repositories. Forges additionally support pull-requests and issues
and make those and other information available using an API@.
When a forge is only partially supported, then that means that only
the functionality that does not require the API is implemented, or
in other words, that the forge is only supported as a semi-forge.
A host is a particular instance of a forge. For example the hosts
@uref{https://gitlab.com} and @uref{https://salsa.debian.org} are both instances of
the Gitlab forge. Forge supports some well known hosts out of the box
and additional hosts can easily be supported by adding entries to the
option @code{forge-alist}.
For more details about the caveats mentioned below (and some others)
also see @ref{Getting Started}.
@section Supported Forges
@itemize
@item
Github
Forge's support for Github can be considered the "reference
implementation". Support for other forges can lag behind a bit.
Github Caveats
@itemize
@item
Forge uses the Github GraphQL API when possible but has to fall
back to use the REST API in many cases because the former is still
rather incomplete.
@item
Forge depends on the @code{updated_at} field being updated when
appropriate. For Github pull-requests at least, that is not always
done.
@end itemize
Github Hosts
@itemize
@item
@uref{https://github.com}
@end itemize
@item
Gitlab
Gitlab Caveats
@itemize
@item
Forge cannot provide notifications because the Gitlab API does not
expose those.
@end itemize
Gitlab Hosts
@itemize
@item
@uref{https://gitlab.com}
@item
@uref{https://salsa.debian.org}
@item
@uref{https://framagit.org}
@end itemize
@end itemize
@section Partially Supported Forges
@itemize
@item
Gitea @uref{https://gitea.io/en-us}
This is the next forge whose API will to be supported.
Currently no public Gitea Hosts are known to me.
The Gitea maintainers plan to create their own instance,
see @uref{https://github.com/go-gitea/gitea/issues/1029}.
@item
Gogs @uref{https://gogs.io}
Once Gitea is supported it should be fairly simple to support Gogs
too, because the former is a fork of the latter and the APIs seem to
still be very similar.
Gogs Hosts
@itemize
@item
@uref{https://code.orgmode.org}
@end itemize
@item
Bitbucket
I don't plan to support Bitbucket's API any time soon, and it gets
less likely that I will every do it every time I look at it.
Bitbucket Caveats
@itemize
@item
The API documentation is poor and initial tests indicated that the
implementation is buggy.
@item
Atlassian's offering contains two very distinct implementations
that are both called "Bitbucket". Forge only supports the
implementation whose only instance is available at
@uref{https://bitbucket.org}, because I only have access to that.
@item
Unlike all other forges, Bitbucket does not expose pull-requests
as references in the upstream repository. For that reason Forge
actually treats it as a semi-forge, not as forge whose API is not
supported yet. This means that you cannot checkout pull-requests
locally. There is little hope that this will ever get fixed; the
respective issue was opened six years ago and there has been no
progress since: @uref{https://bitbucket.org/site/master/issues/5814}.
@end itemize
Bitbucket Hosts
@itemize
@item
@uref{https://bitbucket.org}
@end itemize
@end itemize
@section Supported Semi-Forges
@itemize
@item
Gitweb @uref{https://git-scm.com/docs/gitweb}
Gitweb Caveats
@itemize
@item
I could find only one public installation
(@uref{https://git.savannah.gnu.org}), which gives users the choice
between Gitweb and Cgit. The latter seems more popular (not
just on this site).
@end itemize
@item
Cgit @uref{https://git.zx2c4.com/cgit/about}
Cgit Caveats
@itemize
@item
Different sites use different URL schemata and some of the bigger
sites use a fork. For this reason Forge has to provide several
classes to support different variations of Cgit and you have to
look at their definitions to figure out which on is the correct
one for a particular installation.
@end itemize
Cgit Hosts
@itemize
@item
@uref{https://git.savannah.gnu.org/cgit}
@item
@uref{https://git.kernel.org}
@item
@uref{https://repo.or.cz}
@end itemize
@item
Stgit @uref{https://codemadness.org/git/stagit/file/README.html}
Stgit Caveats
@itemize
@item
Stgit cannot show logs for branches beside "master". For that
reason Forge takes users to a page listing the branches when they
request the log for a particular branch (even for "master" whose
log is just one click away from there).
@end itemize
Stgit Hosts
@itemize
@item
@uref{https://git.suckless.org}
@end itemize
@item
Srht @uref{https://meta.sr.ht}
Srht Caveats
@itemize
@item
Srht cannot show logs for branches beside "master". For that
reason Forge takes users to a page listing the branches when they
request the log for a particular branch (even for "master" whose
log is just one click away from there).
@end itemize
Srht Hosts
@itemize
@item
@uref{https://git.sr.ht}
@end itemize
@end itemize
@node Getting Started
@chapter Getting Started
Getting started using Forge should be fairly easy, but there are a few
caveats you should be aware of:
@itemize
@item
Forge uses the Ghub package to access forge APIs. For this purpose
you have to create a token as described in @ref{Token Creation}.
@item
Fetched information is stored in a database. The table schemata of
that database have not been finalized yet. Until that has happened
it will occasionally have to be discard. That isn't such a huge
deal because for now the database does not contain any information
that cannot simply be fetched again, see @ref{Initial Pull}.
@item
Fetching is implemented under the assumption that the API can be
asked to list the things that have changed since we last checked.
Unfortunately the APIs are not bug-free, so this is not always the
case. Especially in closed-source software it can take years for
issues to get fixed, so I am no longer delaying the initial Forge
release because of that. If in doubt, then re-fetch an individual
pull-request to ensure it is up-to-date using the command
@code{forge-pull-pullreq}.
@item
Some other, forge-specific, caveats are mentioned in @ref{Supported Forges and Hosts}.
@end itemize
Loading Magit doesn't cause Forge to be loaded automatically. Adding
something like this to your init file takes care of this:
@lisp
(with-eval-after-load 'magit
(require 'forge))
@end lisp
Or if you use @code{use-package}:
@lisp
(use-package forge
:after magit)
@end lisp
@menu
* Initial Pull::
* Token Creation::
* Repository Detection::
@end menu
@node Initial Pull
@section Initial Pull
To start using Forge in a certain repository visit the Magit status
buffer for that repository and type @code{f y} (@code{forge-pull}). Alternatively
you can use @code{M-x forge-add-repository}, which makes it possible to add a
forge repository without pulling all topics and even without having to
clone the respective Git repository.
When adding the first repository from @uref{https://github.com} to your local
database you will be guided through the process of creating the API
token. For other forges as well as for other Github instances some
additional setup is required @strong{before} you can add the first repository.
See @ref{Token Creation}.
The first time @code{forge-pull} is run in a repository, an entry for that
repository is added to the database and a new value is added to the
Git variable @code{remote.<remote>.fetch}, which fetches all pull-requests.
(@code{+refs/pull/*/head:refs/pullreqs/*} for Github)
@code{forge-pull} then fetches topics and other information using the forge's
API and pull-request references using Git.
The initial fetch can take a while but most of that is done
asynchronously. Storing the information in the database is done
synchronously though, so there can be a noticeable hang at the end.
Subsequent fetches are much faster.
Fetching issues from Github is much faster than fetching from other
forges because making a handful of GraphQL requests is much faster
than making hundreds of REST requests.
@node Token Creation
@section Token Creation
Forge uses the Ghub package to access the APIs of supported Git
forges. How this works an how to create and store a token is
documented in @ref{Getting Started,,,ghub,}.
Ghub used to provide a setup wizard, but that had to be removed for
reasons given in the manual just mentioned. Nowadays there is no way
around reading the documentation and doing this manually I am afraid.
Forge requires the following token scopes.
@itemize
@item
For Github these scopes are required.
@itemize
@item
@code{repo} grants full read/write access to private and public
repositories.
@item
@code{user} grants access to profile information.
@item
@code{read:org} grants read-only access to organization membership.
@end itemize
More information about these and other scopes can be found at
@uref{https://docs.github.com/en/developers/apps/scopes-for-oauth-apps}.
@item
For Gitlab instances @code{api} is the only required scope. It gives read
and write access to everything. The Gitlab API provides more
fine-grained scopes for read-only access, but when any write access
at all is required, then it is all or nothing.
@end itemize
@node Repository Detection
@section Repository Detection
Ghub does @strong{not} associate a given local repository with a repository on
a forge. The Forge package itself takes care of this. In doing so it
ignores the Git variable @code{ghub.host} and other @code{FORGE.host} variables used
by Ghub. (But @code{github.user} and other variables used to specify the
user are honored). Forge associates the local repository with a forge
repository by first determining which remote is associated with the
upstream repository and then looking that up in @code{forge-alist}.
If only one remote exists, then Forge uses that unconditionally.
If several remotes exist, then a remote may be selected based on its
name.
The convention is to name the upstream remote @code{origin}. If you follow
this convention, then you have to do nothing else and the remote by
that name is automatically used, provided it exists and regardless of
whether other remotes exist. If it does not exist, then no other
remotes are tried.
If you do not follow the naming convention, then you have to inform
Forge about that by setting the Git variable @code{forge.remote} to the name
that you instead use for upstream remotes. If this variable is set,
then Forge uses the remote by that name, if it exists, the same way
it may have used @code{origin} if the the variable were undefined. I.e. it
does not fall through to try @code{origin} if no remote by your chosen name
exists.
Once the upstream remote has been determined, Forge looks it up in
@code{forge-alist}, using the host part of the URL as the key. For example
the key for @code{git@@github.com:magit/forge.git} is @code{github.com}.
@node Usage
@chapter Usage
Once information has been pulled from a repository's forge for the
first time, Forge adds two additional sections, named "Pull requests"
and "Issues" to Magit's status buffer. It is also possible to add a
repository to the local database without pulling all the data, which
is useful if you want to create a single pull-request.
@table @asis
@kindex ' a
@cindex forge-add-repository
@item @kbd{' a} @tie{}@tie{}@tie{}@tie{}(@code{forge-add-repository})
This command add a repository to the database.
It offers to either pull topics (now and in the future) or to only
pull individual topics when the user invokes @code{forge-pull-topic}.
@end table
Some of Forge's commands are only bound when point is within one of
these sections but other commands are also available elsewhere in
Magit's status buffer and/or from Magit's transient commands.
@table @asis
@kindex '
@cindex forge-dispatch
@item @kbd{'} @tie{}@tie{}@tie{}@tie{}(@code{forge-dispatch})
This prefix command is available in any Magit buffer and provides
access to several of the available Forge commands. Most of these
commands are also bound elsewhere, but some are not. See the
following sections for information about the available commands.
@end table
@menu
* Pulling::
* Branching::
* Working with Topics::
* Miscellaneous::
@end menu
@node Pulling
@section Pulling
The commands that fetch forge data are available from the same
transient prefix command (@code{magit-fetch} on @code{f}) that is used to fetch Git
data. If option @code{magit-pull-or-fetch} is non-nil, then they are also
available from the @code{magit-pull} transient (on @code{F}).
@table @asis
@kindex f y
@cindex forge-pull
@item @kbd{f y} @tie{}@tie{}@tie{}@tie{}(@code{forge-pull})
This command uses a forge's API to fetch topics and other
information about the current repository and stores the fetched
information in the database. It also fetches notifications for all
repositories from the same forge host. (Currently this is limited
to Github.) Finally it fetches pull-request references using Git.
After using this command for the first time in a given repository
the status buffer for that repository always lists the pull-requests
and issues. See @ref{Initial Pull}.
@kindex f Y
@cindex forge-pull-notifications
@item @kbd{f Y} @tie{}@tie{}@tie{}@tie{}(@code{forge-pull-notifications})
This command uses a forge's API to fetch all notifications from that
forge, including but not limited to the notifications for the current
repository.
Fetching all notifications fetches associated topics even if you
have not started fetching @strong{all} topics for the respective repositories
(using @code{forge-pull}), but it does not cause the topics to be listed in
the status buffer of such "uninitialized" repositories.
@end table
Note how pulling data from a forge's API works the same way as pulling
Git data does; you do it explicitly when you want to see the work done
by others.
This is less disruptive, more reliable and easier to understand than
if Forge did the pulling by itself at random intervals. It might
however mean that you occasionally invoke a command expecting the most
recent data to be available and then having to abort to pull first.
The same can happen with Git, e.g. you might attempt to merge a branch
that you know exists but haven't actually pulled yet.
@table @asis
@kindex M-x forge-pull-pullreq
@cindex forge-pull-pullreq
@item @kbd{M-x forge-pull-pullreq} @tie{}@tie{}@tie{}@tie{}(@code{forge-pull-pullreq})
This command uses a forge's API to fetch a single pull-request and
stores it in the database.
Normally you wouldn't want to pull a single pull-request by itself,
but due to a bug in the Github API you might sometimes have to do
so.
Fetching is implemented under the assumption that the API can be
asked to list the things that have changed since we last checked.
Unfortunately the APIs are not bug-free, so this is not always the
case. Especially in closed-source software it can take years for
issues to get fixed, so I am no longer delaying the initial Forge
release because of that. If in doubt, then re-fetch an individual
pull-request to ensure it is up-to-date using the command
@code{forge-pull-pullreq}.
@end table
@node Branching
@section Branching
Forge provides commands for creating and checking out a new branch or
work tree from a pull-request. These commands are available from the
same transient prefix commands as the suffix commands used to create
and check out branches and work trees in a more generic fashion
(@code{magit-branch} on @code{b} and @code{magit-worktree} on @code{%}).
@table @asis
@kindex b Y
@cindex forge-branch-pullreq
@item @kbd{b Y} @tie{}@tie{}@tie{}@tie{}(@code{forge-branch-pullreq})
This command creates and configures a new branch from a pull-request,
creating and configuring a new remote if necessary.
The name of the local branch is the same as the name of the remote
branch that you are being asked to merge, unless the contributor
could not be bothered to properly name the branch before opening the
pull-request. The most likely such case is when you are being asked
to merge something like "fork/master" into "origin/master". In such
cases the local branch will be named "pr-N", where @code{N} is the
pull-request number.
These variables are always set by this command:
@itemize
@item
@code{branch.<name>.pullRequest} is set to the pull-request number.
@item
@code{branch.<name>.pullRequestRemote} is set to the remote on which the
pull-request branch is located.
@item
@code{branch.<name>.pushRemote} is set to the same remote as
@code{branch.<name>.pullRequestRemote} if that is possible, otherwise
it is set to the upstream remote.
@item
@code{branch.<name>.description} is set to the pull-request title.
@item
@code{branch.<name>.rebase} is set to @code{true} because there should be no
merge commits among the commits in a pull-request.
@end itemize
This command also configures the upstream and the push-remote of the
local branch that it creates.
The branch against which the pull-request was opened, is always used
as the upstream. This makes it easy to see what commits you are
being asked to merge in the section titled something like "Unmerged
into origin/master".
Like for other commands that create a branch it depends on the
option @code{magit-branch-prefer-remote-upstream} whether the remote branch
itself or the respective local branch is used as the upstream, so
this section may also be titled e.g. "Unmerged into master".
When necessary and possible, then the remote pull-request branch is
configured to be used as the push-target. This makes it easy to see
what further changes the contributor has made since you last
reviewed their changes in the section titled something like
"Unpulled from origin/new-feature" or "Unpulled from
fork/new-feature".
@itemize
@item
If the pull-request branch is located in the upstream repository,
then you probably have set @code{remote.pushDefault} to that repository.
However some users like to set that variable to their personal
fork, even if they have push access to the upstream, so
@code{branch.<name>.pushRemote} is set anyway.
@item
If the pull-request branch is located inside a fork, then you are
usually able to push to that branch, because Github by default
allows the recipient of a pull-request to push to the remote
pull-request branch even if it is located in a fork. The
contributor has to explicitly disable this.
@itemize
@item
If you are not allowed to push to the pull-request branch on
the fork, then a branch by the same name located in the
upstream repository is configured as the push-target.
@item
A—sadly rather common—special case is when the contributor
didn't bother to use a dedicated branch for the pull-request.
The most likely such case is when you are being asked to merge
something like "fork/master" into "origin/master". The special
push permission mentioned above is never granted for the branch
that is the repository's default branch, and that would almost
certainly be the case in this scenario.
To enable you to easily push somewhere anyway, the local branch
is named "pr-N" (where @code{N} is the pull-request number) and the
upstream repository is used as the push-remote.
@item
Finally, if you are allowed to push to the pull-request branch
and the contributor had the foresight to use a dedicated branch,
then the fork is configured as the push-remote.
@end itemize
The push-remote is configured using @code{branch.<name>.pushRemote}, even
if the used value is identical to that of @code{remote.pushDefault}, just
in case you change the value of the latter later on. Additionally
the variable @code{branch.<name>.pullRequestRemote} is set to the remote
on which the pull-request branch is located.
@end itemize
@kindex b y
@cindex forge-checkout-pullreq
@item @kbd{b y} @tie{}@tie{}@tie{}@tie{}(@code{forge-checkout-pullreq})
This command creates and configures a new branch from a pull-request
the same way @code{forge-branch-pullreq} does. Additionally it checks out
the new branch.
@kindex % y
@cindex forge-checkout-worktree
@item @kbd{% y} @tie{}@tie{}@tie{}@tie{}(@code{forge-checkout-worktree})
This command creates and configures a new branch from a pull-request
the same way @code{forge-branch-pullreq} does. Additionally it checks out
the new branch using a new working tree.
@end table
When you delete a pull-request branch, which was created using one of
the above three commands, then @code{magit-branch-delete} usually offers to
also delete the corresponding remote. It does not offer to delete a
remote if (1) the remote is the upstream remote, and/or (2) if other
branches are being fetched from the remote.
Note that you have to delete the local branch (e.g. "feature") for
this to work. If you delete the tracking branch (e.g "fork/feature"),
then the remote is never removed.
@node Working with Topics
@section Working with Topics
We call both issues and pull-requests "topics". The contributions to
the conversation are called "posts".
@menu
* Visiting Topics::
* Listing Topics and Notifications::
* Creating Topics::
* Editing Topics and Posts::
@end menu
@node Visiting Topics
@subsection Visiting Topics
Magit's status buffer contains lists of issues and pull-requests.
Topics are ordered by last modification time. All open issues and
some recently edited and closed topics are listed.
Forge provides some commands that act on the listed topics. These
commands can also be used in other contexts, such as when point is
on a commit or branch section.
@table @asis
@kindex C-c C-w
@cindex forge-browse-TYPE
@item @kbd{C-c C-w} @tie{}@tie{}@tie{}@tie{}(@code{forge-browse-TYPE})
@kindex C-c C-w
@cindex forge-browse-dwim
@item @kbd{C-c C-w} @tie{}@tie{}@tie{}@tie{}(@code{forge-browse-dwim})
These commands visit the pull-request(s), issue(s), post, branch,
commit or remote at point in a browser.
This is implemented using various commands named @code{forge-browse-TYPE},
and the key binding is defined by remapping @code{magit-browse-thing} (as
defined in @code{magit-mode-map)}. For commit sections this key is bound
to @code{forge-browse-dwim}, which prefers a topic over a branch and a
branch over a commit.
@kindex RET
@cindex forge-visit-TYPE
@item @kbd{RET} @tie{}@tie{}@tie{}@tie{}(@code{forge-visit-TYPE})
@kindex C-c C-v
@cindex forge-visit-topic
@item @kbd{C-c C-v} @tie{}@tie{}@tie{}@tie{}(@code{forge-visit-topic})
These commands visit the pull-request(s), issue(s), or repository in
a separate buffer.
The @code{RET} binding is only available when point is on a issue or
pull-request section because that key is already bound to something
else for most of Magit's own sections. @code{C-c C-v} however is also
available on regular commit (e.g. in a log) and branch sections.
This is implemented using various commands named @code{forge-visit-TYPE}
and the key binding is defined by remapping @code{magit-visit-thing} (as
defined in @code{magit-mode-map}).
@end table
@node Listing Topics and Notifications
@subsection Listing Topics and Notifications
By default Forge lists a subset of topics directly in the Magit status
buffer. It also provides commands to list topics and notifications in
separate buffers.
Forge adds the following two functions to @code{magit-status-sections-hook}:
@defun forge-insert-pullreqs
This function inserts a list of mostly recent and/or open
pull-requests.
@end defun
@defun forge-insert-issues
This function inserts a list of mostly recent and/or open issues.
@end defun
@itemize
@item
User Options: forge-topic-list-limit
This option limits the number of topics listed by the above
functions.
All unread topics are always shown. If the value of this option has
the form @code{(OPEN . CLOSED)}, then the integer @code{OPEN} specifies the
maximal number of topics and @code{CLOSED} specifies the maximal number of
closed topics. IF @code{CLOSED} is negative then show no closed topics
until the command @code{forge-toggle-closed-visibility} changes the sign.
@end itemize
@cindex forge-toggle-closed-visibility
@deffn Command forge-toggle-closed-visibility
This command toggles whether the above two functions list recently
closed issues in the current buffer.
@end deffn
The following three functions are also suitable for
@code{magit-status-sections-hook}:
@defun forge-insert-assigned-pullreqs
This function inserts a list of open pull-requests that are assigned
to you.
@end defun
@defun forge-insert-requested-reviews
This function inserts a list of open pull-requests that are awaiting
your review.
@end defun
@defun forge-insert-assigned-issues
This function inserts a list of open issues that are assigned to
you.
@end defun
The following commands list repositories, notifications and topics in
dedicated buffers:
@table @asis
@kindex ' r
@cindex forge-list-repositories
@item @kbd{' r} @tie{}@tie{}@tie{}@tie{}(@code{forge-list-repositories})
This command lists all known repositories in a separate buffer.
@kindex ' l
@cindex forge-list-notifications
@item @kbd{' l} @tie{}@tie{}@tie{}@tie{}(@code{forge-list-notifications})
This command lists all notifications for all forges in a separate
buffer.
@kindex ' P
@cindex forge-list-pull-requests
@item @kbd{' P} @tie{}@tie{}@tie{}@tie{}(@code{forge-list-pull-requests})
This command lists the current repository's pull-requests in a
separate buffer.
@kindex ' I
@cindex forge-list-issues
@item @kbd{' I} @tie{}@tie{}@tie{}@tie{}(@code{forge-list-issues})
This command lists the current repository's issues in a separate
buffer.
@end table
@cindex forge-list-assigned-pullreqs
@deffn Command forge-list-assigned-pullreqs
This command lists the current repository's open issues that are
assigned to you in a separate buffer.
@end deffn
@cindex forge-list-assigned-issues
@deffn Command forge-list-assigned-issues
This command lists the current repository's open pull-requests that
are assigned to you in a separate buffer.
@end deffn
@cindex forge-list-requested-reviews
@deffn Command forge-list-requested-reviews
This command lists pull-requests of the current repository that are
awaiting your review in a separate buffer.
@end deffn
@cindex forge-list-owned-pullreqs
@deffn Command forge-list-owned-pullreqs
This command lists open pull-requests from all the repositories that
you own. Options @code{forge-owned-accounts} and @code{forge-owned-blacklist}
controls which repositories are considered to be owned by you. Only
Github is supported for now.
@end deffn
@cindex forge-list-owned-issues
@deffn Command forge-list-owned-issues
This command lists open issues from all the repositories that
you own. Options @code{forge-owned-accounts} and @code{forge-owned-blacklist}
controls which repositories are considered to be owned by you. Only
Github is supported for now.
@end deffn
@defopt forge-owned-accounts
This is a list of accounts that are owned by you. This should
include your username as well as any organization that you own.
@end defopt
@defopt forge-owned-blacklist
This is a list of repository names that are considered to not be
owned by you even though they would have been considered to be owned
by you based on @code{forge-owned-accounts}.
@end defopt
@node Creating Topics
@subsection Creating Topics
@table @asis
@kindex ' c p
@cindex forge-create-pullreq
@item @kbd{' c p} @tie{}@tie{}@tie{}@tie{}(@code{forge-create-pullreq})
@kindex C-c C-n [on "Pull requests" section]
@cindex forge-create-pullreq
@item @kbd{C-c C-n [on "Pull requests" section]} @tie{}@tie{}@tie{}@tie{}(@code{forge-create-pullreq})
This command creates a new pull-request for the current repository.
@kindex ' c i
@cindex forge-create-issue