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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
|
# Copyright 2010-2025 The pygit2 contributors
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# In addition to the permissions in the GNU General Public License,
# the authors give you unlimited permission to link the compiled
# version of this file into combinations with other programs,
# and to distribute those combinations without any restriction
# coming from the use of this file. (The General Public License
# restrictions do apply in other respects; for example, they cover
# modification of the file, and distribution when not linked into
# a combined executable.)
#
# This file 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
from enum import IntEnum, IntFlag
from . import _pygit2
from .ffi import C
class ApplyLocation(IntEnum):
"""Possible application locations for patches"""
WORKDIR = _pygit2.GIT_APPLY_LOCATION_WORKDIR
"""
Apply the patch to the workdir, leaving the index untouched.
This is the equivalent of `git apply` with no location argument.
"""
INDEX = _pygit2.GIT_APPLY_LOCATION_INDEX
"""
Apply the patch to the index, leaving the working directory
untouched. This is the equivalent of `git apply --cached`.
"""
BOTH = _pygit2.GIT_APPLY_LOCATION_BOTH
"""
Apply the patch to both the working directory and the index.
This is the equivalent of `git apply --index`.
"""
class AttrCheck(IntFlag):
FILE_THEN_INDEX = C.GIT_ATTR_CHECK_FILE_THEN_INDEX
INDEX_THEN_FILE = C.GIT_ATTR_CHECK_INDEX_THEN_FILE
INDEX_ONLY = C.GIT_ATTR_CHECK_INDEX_ONLY
NO_SYSTEM = C.GIT_ATTR_CHECK_NO_SYSTEM
INCLUDE_HEAD = C.GIT_ATTR_CHECK_INCLUDE_HEAD
INCLUDE_COMMIT = C.GIT_ATTR_CHECK_INCLUDE_COMMIT
class BlameFlag(IntFlag):
NORMAL = _pygit2.GIT_BLAME_NORMAL
'Normal blame, the default'
TRACK_COPIES_SAME_FILE = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_FILE
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'
TRACK_COPIES_SAME_COMMIT_MOVES = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'
TRACK_COPIES_SAME_COMMIT_COPIES = _pygit2.GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'
TRACK_COPIES_ANY_COMMIT_COPIES = _pygit2.GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES
'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'
FIRST_PARENT = _pygit2.GIT_BLAME_FIRST_PARENT
'Restrict the search of commits to those reachable following only the first parents.'
USE_MAILMAP = _pygit2.GIT_BLAME_USE_MAILMAP
"""
Use mailmap file to map author and committer names and email addresses
to canonical real names and email addresses. The mailmap will be read
from the working directory, or HEAD in a bare repository.
"""
IGNORE_WHITESPACE = _pygit2.GIT_BLAME_IGNORE_WHITESPACE
'Ignore whitespace differences'
class BlobFilter(IntFlag):
CHECK_FOR_BINARY = _pygit2.GIT_BLOB_FILTER_CHECK_FOR_BINARY
'Do not apply filters to binary files.'
NO_SYSTEM_ATTRIBUTES = _pygit2.GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES
'Filters will not load configuration from the system-wide `gitattributes` in `/etc` (or system equivalent).'
ATTRIBUTES_FROM_HEAD = _pygit2.GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD
'Load filters from a `.gitattributes` file in the HEAD commit.'
ATTRIBUTES_FROM_COMMIT = _pygit2.GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT
'Load filters from a `.gitattributes` file in the specified commit.'
class BranchType(IntFlag):
LOCAL = _pygit2.GIT_BRANCH_LOCAL
REMOTE = _pygit2.GIT_BRANCH_REMOTE
ALL = _pygit2.GIT_BRANCH_ALL
class CheckoutNotify(IntFlag):
"""
Checkout notification flags
Checkout will invoke an options notification callback
(`CheckoutCallbacks.checkout_notify`) for certain cases - you pick which
ones via `CheckoutCallbacks.checkout_notify_flags`.
"""
NONE = C.GIT_CHECKOUT_NOTIFY_NONE
CONFLICT = C.GIT_CHECKOUT_NOTIFY_CONFLICT
'Invokes checkout on conflicting paths.'
DIRTY = C.GIT_CHECKOUT_NOTIFY_DIRTY
"""
Notifies about "dirty" files, i.e. those that do not need an update
but no longer match the baseline. Core git displays these files when
checkout runs, but won't stop the checkout.
"""
UPDATED = C.GIT_CHECKOUT_NOTIFY_UPDATED
'Sends notification for any file changed.'
UNTRACKED = C.GIT_CHECKOUT_NOTIFY_UNTRACKED
'Notifies about untracked files.'
IGNORED = C.GIT_CHECKOUT_NOTIFY_IGNORED
'Notifies about ignored files.'
ALL = C.GIT_CHECKOUT_NOTIFY_ALL
class CheckoutStrategy(IntFlag):
NONE = _pygit2.GIT_CHECKOUT_NONE
'Dry run, no actual updates'
SAFE = _pygit2.GIT_CHECKOUT_SAFE
"""
Allow safe updates that cannot overwrite uncommitted data.
If the uncommitted changes don't conflict with the checked out files,
the checkout will still proceed, leaving the changes intact.
Mutually exclusive with FORCE.
FORCE takes precedence over SAFE.
"""
FORCE = _pygit2.GIT_CHECKOUT_FORCE
"""
Allow all updates to force working directory to look like index.
Mutually exclusive with SAFE.
FORCE takes precedence over SAFE.
"""
RECREATE_MISSING = _pygit2.GIT_CHECKOUT_RECREATE_MISSING
""" Allow checkout to recreate missing files """
ALLOW_CONFLICTS = _pygit2.GIT_CHECKOUT_ALLOW_CONFLICTS
""" Allow checkout to make safe updates even if conflicts are found """
REMOVE_UNTRACKED = _pygit2.GIT_CHECKOUT_REMOVE_UNTRACKED
""" Remove untracked files not in index (that are not ignored) """
REMOVE_IGNORED = _pygit2.GIT_CHECKOUT_REMOVE_IGNORED
""" Remove ignored files not in index """
UPDATE_ONLY = _pygit2.GIT_CHECKOUT_UPDATE_ONLY
""" Only update existing files, don't create new ones """
DONT_UPDATE_INDEX = _pygit2.GIT_CHECKOUT_DONT_UPDATE_INDEX
"""
Normally checkout updates index entries as it goes; this stops that.
Implies `DONT_WRITE_INDEX`.
"""
NO_REFRESH = _pygit2.GIT_CHECKOUT_NO_REFRESH
""" Don't refresh index/config/etc before doing checkout """
SKIP_UNMERGED = _pygit2.GIT_CHECKOUT_SKIP_UNMERGED
""" Allow checkout to skip unmerged files """
USE_OURS = _pygit2.GIT_CHECKOUT_USE_OURS
""" For unmerged files, checkout stage 2 from index """
USE_THEIRS = _pygit2.GIT_CHECKOUT_USE_THEIRS
""" For unmerged files, checkout stage 3 from index """
DISABLE_PATHSPEC_MATCH = _pygit2.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH
""" Treat pathspec as simple list of exact match file paths """
SKIP_LOCKED_DIRECTORIES = _pygit2.GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES
""" Ignore directories in use, they will be left empty """
DONT_OVERWRITE_IGNORED = _pygit2.GIT_CHECKOUT_DONT_OVERWRITE_IGNORED
""" Don't overwrite ignored files that exist in the checkout target """
CONFLICT_STYLE_MERGE = _pygit2.GIT_CHECKOUT_CONFLICT_STYLE_MERGE
""" Write normal merge files for conflicts """
CONFLICT_STYLE_DIFF3 = _pygit2.GIT_CHECKOUT_CONFLICT_STYLE_DIFF3
""" Include common ancestor data in diff3 format files for conflicts """
DONT_REMOVE_EXISTING = _pygit2.GIT_CHECKOUT_DONT_REMOVE_EXISTING
""" Don't overwrite existing files or folders """
DONT_WRITE_INDEX = _pygit2.GIT_CHECKOUT_DONT_WRITE_INDEX
""" Normally checkout writes the index upon completion; this prevents that. """
DRY_RUN = _pygit2.GIT_CHECKOUT_DRY_RUN
"""
Show what would be done by a checkout. Stop after sending
notifications; don't update the working directory or index.
"""
CONFLICT_STYLE_ZDIFF3 = _pygit2.GIT_CHECKOUT_CONFLICT_STYLE_DIFF3
""" Include common ancestor data in zdiff3 format for conflicts """
class ConfigLevel(IntEnum):
"""
Priority level of a config file.
These priority levels correspond to the natural escalation logic
(from higher to lower) when searching for config entries in git.git.
"""
PROGRAMDATA = _pygit2.GIT_CONFIG_LEVEL_PROGRAMDATA
'System-wide on Windows, for compatibility with portable git'
SYSTEM = _pygit2.GIT_CONFIG_LEVEL_SYSTEM
'System-wide configuration file; /etc/gitconfig on Linux systems'
XDG = _pygit2.GIT_CONFIG_LEVEL_XDG
'XDG compatible configuration file; typically ~/.config/git/config'
GLOBAL = _pygit2.GIT_CONFIG_LEVEL_GLOBAL
'User-specific configuration file (also called Global configuration file); typically ~/.gitconfig'
LOCAL = _pygit2.GIT_CONFIG_LEVEL_LOCAL
'Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos'
WORKTREE = _pygit2.GIT_CONFIG_LEVEL_WORKTREE
'Worktree specific configuration file; $GIT_DIR/config.worktree'
APP = _pygit2.GIT_CONFIG_LEVEL_APP
'Application specific configuration file; freely defined by applications'
HIGHEST_LEVEL = _pygit2.GIT_CONFIG_HIGHEST_LEVEL
"""Represents the highest level available config file (i.e. the most
specific config file available that actually is loaded)"""
class CredentialType(IntFlag):
"""
Supported credential types. This represents the various types of
authentication methods supported by the library.
"""
USERPASS_PLAINTEXT = C.GIT_CREDENTIAL_USERPASS_PLAINTEXT
'A vanilla user/password request'
SSH_KEY = C.GIT_CREDENTIAL_SSH_KEY
'An SSH key-based authentication request'
SSH_CUSTOM = C.GIT_CREDENTIAL_SSH_CUSTOM
'An SSH key-based authentication request, with a custom signature'
DEFAULT = C.GIT_CREDENTIAL_DEFAULT
'An NTLM/Negotiate-based authentication request.'
SSH_INTERACTIVE = C.GIT_CREDENTIAL_SSH_INTERACTIVE
'An SSH interactive authentication request.'
USERNAME = C.GIT_CREDENTIAL_USERNAME
"""
Username-only authentication request.
Used as a pre-authentication step if the underlying transport (eg. SSH,
with no username in its URL) does not know which username to use.
"""
SSH_MEMORY = C.GIT_CREDENTIAL_SSH_MEMORY
"""
An SSH key-based authentication request.
Allows credentials to be read from memory instead of files.
Note that because of differences in crypto backend support, it might
not be functional.
"""
class DeltaStatus(IntEnum):
"""
What type of change is described by a DiffDelta?
`RENAMED` and `COPIED` will only show up if you run
`find_similar()` on the Diff object.
`TYPECHANGE` only shows up given `INCLUDE_TYPECHANGE`
in the DiffOption option flags (otherwise type changes
will be split into ADDED / DELETED pairs).
"""
UNMODIFIED = _pygit2.GIT_DELTA_UNMODIFIED
'no changes'
ADDED = _pygit2.GIT_DELTA_ADDED
'entry does not exist in old version'
DELETED = _pygit2.GIT_DELTA_DELETED
'entry does not exist in new version'
MODIFIED = _pygit2.GIT_DELTA_MODIFIED
'entry content changed between old and new'
RENAMED = _pygit2.GIT_DELTA_RENAMED
'entry was renamed between old and new'
COPIED = _pygit2.GIT_DELTA_COPIED
'entry was copied from another old entry'
IGNORED = _pygit2.GIT_DELTA_IGNORED
'entry is ignored item in workdir'
UNTRACKED = _pygit2.GIT_DELTA_UNTRACKED
'entry is untracked item in workdir'
TYPECHANGE = _pygit2.GIT_DELTA_TYPECHANGE
'type of entry changed between old and new'
UNREADABLE = _pygit2.GIT_DELTA_UNREADABLE
'entry is unreadable'
CONFLICTED = _pygit2.GIT_DELTA_CONFLICTED
'entry in the index is conflicted'
class DescribeStrategy(IntEnum):
"""
Reference lookup strategy.
These behave like the --tags and --all options to git-describe,
namely they say to look for any reference in either refs/tags/ or
refs/ respectively.
"""
DEFAULT = _pygit2.GIT_DESCRIBE_DEFAULT
TAGS = _pygit2.GIT_DESCRIBE_TAGS
ALL = _pygit2.GIT_DESCRIBE_ALL
class DiffFind(IntFlag):
"""Flags to control the behavior of diff rename/copy detection."""
FIND_BY_CONFIG = _pygit2.GIT_DIFF_FIND_BY_CONFIG
""" Obey `diff.renames`. Overridden by any other FIND_... flag. """
FIND_RENAMES = _pygit2.GIT_DIFF_FIND_RENAMES
""" Look for renames? (`--find-renames`) """
FIND_RENAMES_FROM_REWRITES = _pygit2.GIT_DIFF_FIND_RENAMES_FROM_REWRITES
""" Consider old side of MODIFIED for renames? (`--break-rewrites=N`) """
FIND_COPIES = _pygit2.GIT_DIFF_FIND_COPIES
""" Look for copies? (a la `--find-copies`). """
FIND_COPIES_FROM_UNMODIFIED = _pygit2.GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED
"""
Consider UNMODIFIED as copy sources? (`--find-copies-harder`).
For this to work correctly, use INCLUDE_UNMODIFIED when the initial
`Diff` is being generated.
"""
FIND_REWRITES = _pygit2.GIT_DIFF_FIND_REWRITES
""" Mark significant rewrites for split (`--break-rewrites=/M`) """
BREAK_REWRITES = _pygit2.GIT_DIFF_BREAK_REWRITES
""" Actually split large rewrites into delete/add pairs """
FIND_AND_BREAK_REWRITES = _pygit2.GIT_DIFF_FIND_AND_BREAK_REWRITES
""" Mark rewrites for split and break into delete/add pairs """
FIND_FOR_UNTRACKED = _pygit2.GIT_DIFF_FIND_FOR_UNTRACKED
"""
Find renames/copies for UNTRACKED items in working directory.
For this to work correctly, use INCLUDE_UNTRACKED when the initial
`Diff` is being generated (and obviously the diff must be against
the working directory for this to make sense).
"""
FIND_ALL = _pygit2.GIT_DIFF_FIND_ALL
""" Turn on all finding features. """
FIND_IGNORE_LEADING_WHITESPACE = _pygit2.GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE
""" Measure similarity ignoring leading whitespace (default) """
FIND_IGNORE_WHITESPACE = _pygit2.GIT_DIFF_FIND_IGNORE_WHITESPACE
""" Measure similarity ignoring all whitespace """
FIND_DONT_IGNORE_WHITESPACE = _pygit2.GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE
""" Measure similarity including all data """
FIND_EXACT_MATCH_ONLY = _pygit2.GIT_DIFF_FIND_EXACT_MATCH_ONLY
""" Measure similarity only by comparing SHAs (fast and cheap) """
BREAK_REWRITES_FOR_RENAMES_ONLY = _pygit2.GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY
"""
Do not break rewrites unless they contribute to a rename.
Normally, FIND_AND_BREAK_REWRITES will measure the self-
similarity of modified files and split the ones that have changed a
lot into a DELETE / ADD pair. Then the sides of that pair will be
considered candidates for rename and copy detection.
If you add this flag in and the split pair is *not* used for an
actual rename or copy, then the modified record will be restored to
a regular MODIFIED record instead of being split.
"""
FIND_REMOVE_UNMODIFIED = _pygit2.GIT_DIFF_FIND_REMOVE_UNMODIFIED
"""
Remove any UNMODIFIED deltas after find_similar is done.
Using FIND_COPIES_FROM_UNMODIFIED to emulate the
--find-copies-harder behavior requires building a diff with the
INCLUDE_UNMODIFIED flag. If you do not want UNMODIFIED records
in the final result, pass this flag to have them removed.
"""
class DiffFlag(IntFlag):
"""
Flags for the delta object and the file objects on each side.
These flags are used for both the `flags` value of the `DiffDelta`
and the flags for the `DiffFile` objects representing the old and
new sides of the delta. Values outside of this public range should be
considered reserved for internal or future use.
"""
BINARY = _pygit2.GIT_DIFF_FLAG_BINARY
'file(s) treated as binary data'
NOT_BINARY = _pygit2.GIT_DIFF_FLAG_NOT_BINARY
'file(s) treated as text data'
VALID_ID = _pygit2.GIT_DIFF_FLAG_VALID_ID
'`id` value is known correct'
EXISTS = _pygit2.GIT_DIFF_FLAG_EXISTS
'file exists at this side of the delta'
VALID_SIZE = _pygit2.GIT_DIFF_FLAG_VALID_SIZE
'file size value is known correct'
class DiffOption(IntFlag):
"""
Flags for diff options. A combination of these flags can be passed
in via the `flags` value in `diff_*` functions.
"""
NORMAL = _pygit2.GIT_DIFF_NORMAL
'Normal diff, the default'
REVERSE = _pygit2.GIT_DIFF_REVERSE
'Reverse the sides of the diff'
INCLUDE_IGNORED = _pygit2.GIT_DIFF_INCLUDE_IGNORED
'Include ignored files in the diff'
RECURSE_IGNORED_DIRS = _pygit2.GIT_DIFF_RECURSE_IGNORED_DIRS
"""
Even with INCLUDE_IGNORED, an entire ignored directory
will be marked with only a single entry in the diff; this flag
adds all files under the directory as IGNORED entries, too.
"""
INCLUDE_UNTRACKED = _pygit2.GIT_DIFF_INCLUDE_UNTRACKED
'Include untracked files in the diff'
RECURSE_UNTRACKED_DIRS = _pygit2.GIT_DIFF_RECURSE_UNTRACKED_DIRS
"""
Even with INCLUDE_UNTRACKED, an entire untracked
directory will be marked with only a single entry in the diff
(a la what core Git does in `git status`); this flag adds *all*
files under untracked directories as UNTRACKED entries, too.
"""
INCLUDE_UNMODIFIED = _pygit2.GIT_DIFF_INCLUDE_UNMODIFIED
'Include unmodified files in the diff'
INCLUDE_TYPECHANGE = _pygit2.GIT_DIFF_INCLUDE_TYPECHANGE
"""
Normally, a type change between files will be converted into a
DELETED record for the old and an ADDED record for the new; this
options enabled the generation of TYPECHANGE delta records.
"""
INCLUDE_TYPECHANGE_TREES = _pygit2.GIT_DIFF_INCLUDE_TYPECHANGE_TREES
"""
Even with INCLUDE_TYPECHANGE, blob->tree changes still generally
show as a DELETED blob. This flag tries to correctly label
blob->tree transitions as TYPECHANGE records with new_file's
mode set to tree. Note: the tree SHA will not be available.
"""
IGNORE_FILEMODE = _pygit2.GIT_DIFF_IGNORE_FILEMODE
'Ignore file mode changes'
IGNORE_SUBMODULES = _pygit2.GIT_DIFF_IGNORE_SUBMODULES
'Treat all submodules as unmodified'
IGNORE_CASE = _pygit2.GIT_DIFF_IGNORE_CASE
'Use case insensitive filename comparisons'
INCLUDE_CASECHANGE = _pygit2.GIT_DIFF_INCLUDE_CASECHANGE
"""
May be combined with IGNORE_CASE to specify that a file
that has changed case will be returned as an add/delete pair.
"""
DISABLE_PATHSPEC_MATCH = _pygit2.GIT_DIFF_DISABLE_PATHSPEC_MATCH
"""
If the pathspec is set in the diff options, this flags indicates
that the paths will be treated as literal paths instead of
fnmatch patterns. Each path in the list must either be a full
path to a file or a directory. (A trailing slash indicates that
the path will _only_ match a directory). If a directory is
specified, all children will be included.
"""
SKIP_BINARY_CHECK = _pygit2.GIT_DIFF_SKIP_BINARY_CHECK
"""
Disable updating of the `binary` flag in delta records. This is
useful when iterating over a diff if you don't need hunk and data
callbacks and want to avoid having to load file completely.
"""
ENABLE_FAST_UNTRACKED_DIRS = _pygit2.GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS
"""
When diff finds an untracked directory, to match the behavior of
core Git, it scans the contents for IGNORED and UNTRACKED files.
If *all* contents are IGNORED, then the directory is IGNORED; if
any contents are not IGNORED, then the directory is UNTRACKED.
This is extra work that may not matter in many cases. This flag
turns off that scan and immediately labels an untracked directory
as UNTRACKED (changing the behavior to not match core Git).
"""
UPDATE_INDEX = _pygit2.GIT_DIFF_UPDATE_INDEX
"""
When diff finds a file in the working directory with stat
information different from the index, but the OID ends up being the
same, write the correct stat information into the index. Note:
without this flag, diff will always leave the index untouched.
"""
INCLUDE_UNREADABLE = _pygit2.GIT_DIFF_INCLUDE_UNREADABLE
'Include unreadable files in the diff'
INCLUDE_UNREADABLE_AS_UNTRACKED = _pygit2.GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED
'Include unreadable files in the diff'
INDENT_HEURISTIC = _pygit2.GIT_DIFF_INDENT_HEURISTIC
"""
Use a heuristic that takes indentation and whitespace into account
which generally can produce better diffs when dealing with ambiguous
diff hunks.
"""
IGNORE_BLANK_LINES = _pygit2.GIT_DIFF_IGNORE_BLANK_LINES
'Ignore blank lines'
FORCE_TEXT = _pygit2.GIT_DIFF_FORCE_TEXT
'Treat all files as text, disabling binary attributes & detection'
FORCE_BINARY = _pygit2.GIT_DIFF_FORCE_BINARY
'Treat all files as binary, disabling text diffs'
IGNORE_WHITESPACE = _pygit2.GIT_DIFF_IGNORE_WHITESPACE
'Ignore all whitespace'
IGNORE_WHITESPACE_CHANGE = _pygit2.GIT_DIFF_IGNORE_WHITESPACE_CHANGE
'Ignore changes in amount of whitespace'
IGNORE_WHITESPACE_EOL = _pygit2.GIT_DIFF_IGNORE_WHITESPACE_EOL
'Ignore whitespace at end of line'
SHOW_UNTRACKED_CONTENT = _pygit2.GIT_DIFF_SHOW_UNTRACKED_CONTENT
"""
When generating patch text, include the content of untracked files.
This automatically turns on INCLUDE_UNTRACKED but it does not turn
on RECURSE_UNTRACKED_DIRS. Add that flag if you want the content
of every single UNTRACKED file.
"""
SHOW_UNMODIFIED = _pygit2.GIT_DIFF_SHOW_UNMODIFIED
"""
When generating output, include the names of unmodified files if
they are included in the git_diff. Normally these are skipped in
the formats that list files (e.g. name-only, name-status, raw).
Even with this, these will not be included in patch format.
"""
PATIENCE = _pygit2.GIT_DIFF_PATIENCE
"Use the 'patience diff' algorithm"
MINIMAL = _pygit2.GIT_DIFF_MINIMAL
'Take extra time to find minimal diff'
SHOW_BINARY = _pygit2.GIT_DIFF_SHOW_BINARY
"""
Include the necessary deflate / delta information so that `git-apply`
can apply given diff information to binary files.
"""
class DiffStatsFormat(IntFlag):
"""Formatting options for diff stats"""
NONE = _pygit2.GIT_DIFF_STATS_NONE
'No stats'
FULL = _pygit2.GIT_DIFF_STATS_FULL
'Full statistics, equivalent of `--stat`'
SHORT = _pygit2.GIT_DIFF_STATS_SHORT
'Short statistics, equivalent of `--shortstat`'
NUMBER = _pygit2.GIT_DIFF_STATS_NUMBER
'Number statistics, equivalent of `--numstat`'
INCLUDE_SUMMARY = _pygit2.GIT_DIFF_STATS_INCLUDE_SUMMARY
'Extended header information such as creations, renames and mode changes, equivalent of `--summary`'
class Feature(IntFlag):
"""
Combinations of these values describe the features with which libgit2
was compiled.
"""
THREADS = C.GIT_FEATURE_THREADS
HTTPS = C.GIT_FEATURE_HTTPS
SSH = C.GIT_FEATURE_SSH
NSEC = C.GIT_FEATURE_NSEC
class FetchPrune(IntEnum):
"""Acceptable prune settings when fetching."""
UNSPECIFIED = C.GIT_FETCH_PRUNE_UNSPECIFIED
'Use the setting from the configuration'
PRUNE = C.GIT_FETCH_PRUNE
"""Force pruning on: remove any remote branch in the local repository
that does not exist in the remote."""
NO_PRUNE = C.GIT_FETCH_NO_PRUNE
"""Force pruning off: always keep the remote branches."""
class FileMode(IntFlag):
UNREADABLE = _pygit2.GIT_FILEMODE_UNREADABLE
TREE = _pygit2.GIT_FILEMODE_TREE
BLOB = _pygit2.GIT_FILEMODE_BLOB
BLOB_EXECUTABLE = _pygit2.GIT_FILEMODE_BLOB_EXECUTABLE
LINK = _pygit2.GIT_FILEMODE_LINK
COMMIT = _pygit2.GIT_FILEMODE_COMMIT
class FileStatus(IntFlag):
"""
Status flags for a single file.
A combination of these values will be returned to indicate the status of
a file. Status compares the working directory, the index, and the current
HEAD of the repository. The `INDEX_...` set of flags represents the status
of the file in the index relative to the HEAD, and the `WT_...` set of
flags represents the status of the file in the working directory relative
to the index.
"""
CURRENT = _pygit2.GIT_STATUS_CURRENT
INDEX_NEW = _pygit2.GIT_STATUS_INDEX_NEW
INDEX_MODIFIED = _pygit2.GIT_STATUS_INDEX_MODIFIED
INDEX_DELETED = _pygit2.GIT_STATUS_INDEX_DELETED
INDEX_RENAMED = _pygit2.GIT_STATUS_INDEX_RENAMED
INDEX_TYPECHANGE = _pygit2.GIT_STATUS_INDEX_TYPECHANGE
WT_NEW = _pygit2.GIT_STATUS_WT_NEW
WT_MODIFIED = _pygit2.GIT_STATUS_WT_MODIFIED
WT_DELETED = _pygit2.GIT_STATUS_WT_DELETED
WT_TYPECHANGE = _pygit2.GIT_STATUS_WT_TYPECHANGE
WT_RENAMED = _pygit2.GIT_STATUS_WT_RENAMED
WT_UNREADABLE = _pygit2.GIT_STATUS_WT_UNREADABLE
IGNORED = _pygit2.GIT_STATUS_IGNORED
CONFLICTED = _pygit2.GIT_STATUS_CONFLICTED
class FilterFlag(IntFlag):
"""Filter option flags."""
DEFAULT = _pygit2.GIT_FILTER_DEFAULT
ALLOW_UNSAFE = _pygit2.GIT_FILTER_ALLOW_UNSAFE
"Don't error for `safecrlf` violations, allow them to continue."
NO_SYSTEM_ATTRIBUTES = _pygit2.GIT_FILTER_NO_SYSTEM_ATTRIBUTES
"Don't load `/etc/gitattributes` (or the system equivalent)"
ATTRIBUTES_FROM_HEAD = _pygit2.GIT_FILTER_ATTRIBUTES_FROM_HEAD
'Load attributes from `.gitattributes` in the root of HEAD'
ATTRIBUTES_FROM_COMMIT = _pygit2.GIT_FILTER_ATTRIBUTES_FROM_COMMIT
'Load attributes from `.gitattributes` in a given commit. This can only be specified in a `git_filter_options`.'
class FilterMode(IntEnum):
"""
Filters are applied in one of two directions: smudging - which is
exporting a file from the Git object database to the working directory,
and cleaning - which is importing a file from the working directory to
the Git object database. These values control which direction of
change is being applied.
"""
TO_WORKTREE = _pygit2.GIT_FILTER_TO_WORKTREE
SMUDGE = _pygit2.GIT_FILTER_SMUDGE
TO_ODB = _pygit2.GIT_FILTER_TO_ODB
CLEAN = _pygit2.GIT_FILTER_CLEAN
class MergeAnalysis(IntFlag):
"""The results of `Repository.merge_analysis` indicate the merge opportunities."""
NONE = _pygit2.GIT_MERGE_ANALYSIS_NONE
'No merge is possible. (Unused.)'
NORMAL = _pygit2.GIT_MERGE_ANALYSIS_NORMAL
"""
A "normal" merge; both HEAD and the given merge input have diverged
from their common ancestor. The divergent commits must be merged.
"""
UP_TO_DATE = _pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE
"""
All given merge inputs are reachable from HEAD, meaning the
repository is up-to-date and no merge needs to be performed.
"""
FASTFORWARD = _pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD
"""
The given merge input is a fast-forward from HEAD and no merge
needs to be performed. Instead, the client can check out the
given merge input.
"""
UNBORN = _pygit2.GIT_MERGE_ANALYSIS_UNBORN
"""
The HEAD of the current repository is "unborn" and does not point to
a valid commit. No merge can be performed, but the caller may wish
to simply set HEAD to the target commit(s).
"""
class MergeFavor(IntEnum):
"""
Merge file favor options for `Repository.merge` instruct the file-level
merging functionality how to deal with conflicting regions of the files.
"""
NORMAL = C.GIT_MERGE_FILE_FAVOR_NORMAL
"""
When a region of a file is changed in both branches, a conflict will be
recorded in the index so that `checkout` can produce a merge file with
conflict markers in the working directory.
This is the default.
"""
OURS = C.GIT_MERGE_FILE_FAVOR_OURS
"""
When a region of a file is changed in both branches, the file created in
the index will contain the "ours" side of any conflicting region.
The index will not record a conflict.
"""
THEIRS = C.GIT_MERGE_FILE_FAVOR_THEIRS
"""
When a region of a file is changed in both branches, the file created in
the index will contain the "theirs" side of any conflicting region.
The index will not record a conflict.
"""
UNION = C.GIT_MERGE_FILE_FAVOR_UNION
"""
When a region of a file is changed in both branches, the file
created in the index will contain each unique line from each side,
which has the result of combining both files.
The index will not record a conflict.
"""
class MergeFileFlag(IntFlag):
"""File merging flags"""
DEFAULT = C.GIT_MERGE_FILE_DEFAULT
""" Defaults """
STYLE_MERGE = C.GIT_MERGE_FILE_STYLE_MERGE
""" Create standard conflicted merge files """
STYLE_DIFF3 = C.GIT_MERGE_FILE_STYLE_DIFF3
""" Create diff3-style files """
SIMPLIFY_ALNUM = C.GIT_MERGE_FILE_SIMPLIFY_ALNUM
""" Condense non-alphanumeric regions for simplified diff file """
IGNORE_WHITESPACE = C.GIT_MERGE_FILE_IGNORE_WHITESPACE
""" Ignore all whitespace """
IGNORE_WHITESPACE_CHANGE = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE
""" Ignore changes in amount of whitespace """
IGNORE_WHITESPACE_EOL = C.GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL
""" Ignore whitespace at end of line """
DIFF_PATIENCE = C.GIT_MERGE_FILE_DIFF_PATIENCE
""" Use the "patience diff" algorithm """
DIFF_MINIMAL = C.GIT_MERGE_FILE_DIFF_MINIMAL
""" Take extra time to find minimal diff """
STYLE_ZDIFF3 = C.GIT_MERGE_FILE_STYLE_ZDIFF3
""" Create zdiff3 ("zealous diff3")-style files """
ACCEPT_CONFLICTS = C.GIT_MERGE_FILE_ACCEPT_CONFLICTS
"""
Do not produce file conflicts when common regions have changed;
keep the conflict markers in the file and accept that as the merge result.
"""
class MergeFlag(IntFlag):
"""
Flags for `Repository.merge` options.
A combination of these flags can be passed in via the `flags` value.
"""
FIND_RENAMES = C.GIT_MERGE_FIND_RENAMES
"""
Detect renames that occur between the common ancestor and the "ours"
side or the common ancestor and the "theirs" side. This will enable
the ability to merge between a modified and renamed file.
"""
FAIL_ON_CONFLICT = C.GIT_MERGE_FAIL_ON_CONFLICT
"""
If a conflict occurs, exit immediately instead of attempting to
continue resolving conflicts. The merge operation will raise GitError
(GIT_EMERGECONFLICT) and no index will be returned.
"""
SKIP_REUC = C.GIT_MERGE_SKIP_REUC
"""
Do not write the REUC extension on the generated index.
"""
NO_RECURSIVE = C.GIT_MERGE_NO_RECURSIVE
"""
If the commits being merged have multiple merge bases, do not build
a recursive merge base (by merging the multiple merge bases),
instead simply use the first base. This flag provides a similar
merge base to `git-merge-resolve`.
"""
VIRTUAL_BASE = C.GIT_MERGE_VIRTUAL_BASE
"""
Treat this merge as if it is to produce the virtual base of a recursive
merge. This will ensure that there are no conflicts, any conflicting
regions will keep conflict markers in the merge result.
"""
class MergePreference(IntFlag):
"""The user's stated preference for merges."""
NONE = _pygit2.GIT_MERGE_PREFERENCE_NONE
'No configuration was found that suggests a preferred behavior for merge.'
NO_FASTFORWARD = _pygit2.GIT_MERGE_PREFERENCE_NO_FASTFORWARD
"""
There is a `merge.ff=false` configuration setting, suggesting that
the user does not want to allow a fast-forward merge.
"""
FASTFORWARD_ONLY = _pygit2.GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY
"""
There is a `merge.ff=only` configuration setting, suggesting that
the user only wants fast-forward merges.
"""
class ObjectType(IntEnum):
ANY = _pygit2.GIT_OBJECT_ANY
'Object can be any of the following'
INVALID = _pygit2.GIT_OBJECT_INVALID
'Object is invalid.'
COMMIT = _pygit2.GIT_OBJECT_COMMIT
'A commit object.'
TREE = _pygit2.GIT_OBJECT_TREE
'A tree (directory listing) object.'
BLOB = _pygit2.GIT_OBJECT_BLOB
'A file revision object.'
TAG = _pygit2.GIT_OBJECT_TAG
'An annotated tag object.'
OFS_DELTA = _pygit2.GIT_OBJECT_OFS_DELTA
'A delta, base is given by an offset.'
REF_DELTA = _pygit2.GIT_OBJECT_REF_DELTA
'A delta, base is given by object id.'
class Option(IntEnum):
"""Global libgit2 library options"""
# Commented out values --> exists in libgit2 but not supported in pygit2's options.c yet
GET_MWINDOW_SIZE = _pygit2.GIT_OPT_GET_MWINDOW_SIZE
SET_MWINDOW_SIZE = _pygit2.GIT_OPT_SET_MWINDOW_SIZE
GET_MWINDOW_MAPPED_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_MAPPED_LIMIT
SET_MWINDOW_MAPPED_LIMIT = _pygit2.GIT_OPT_SET_MWINDOW_MAPPED_LIMIT
GET_SEARCH_PATH = _pygit2.GIT_OPT_GET_SEARCH_PATH
SET_SEARCH_PATH = _pygit2.GIT_OPT_SET_SEARCH_PATH
SET_CACHE_OBJECT_LIMIT = _pygit2.GIT_OPT_SET_CACHE_OBJECT_LIMIT
SET_CACHE_MAX_SIZE = _pygit2.GIT_OPT_SET_CACHE_MAX_SIZE
ENABLE_CACHING = _pygit2.GIT_OPT_ENABLE_CACHING
GET_CACHED_MEMORY = _pygit2.GIT_OPT_GET_CACHED_MEMORY
GET_TEMPLATE_PATH = _pygit2.GIT_OPT_GET_TEMPLATE_PATH
SET_TEMPLATE_PATH = _pygit2.GIT_OPT_SET_TEMPLATE_PATH
SET_SSL_CERT_LOCATIONS = _pygit2.GIT_OPT_SET_SSL_CERT_LOCATIONS
SET_USER_AGENT = _pygit2.GIT_OPT_SET_USER_AGENT
ENABLE_STRICT_OBJECT_CREATION = _pygit2.GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
ENABLE_STRICT_SYMBOLIC_REF_CREATION = (
_pygit2.GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION
)
SET_SSL_CIPHERS = _pygit2.GIT_OPT_SET_SSL_CIPHERS
GET_USER_AGENT = _pygit2.GIT_OPT_GET_USER_AGENT
ENABLE_OFS_DELTA = _pygit2.GIT_OPT_ENABLE_OFS_DELTA
ENABLE_FSYNC_GITDIR = _pygit2.GIT_OPT_ENABLE_FSYNC_GITDIR
GET_WINDOWS_SHAREMODE = _pygit2.GIT_OPT_GET_WINDOWS_SHAREMODE
SET_WINDOWS_SHAREMODE = _pygit2.GIT_OPT_SET_WINDOWS_SHAREMODE
ENABLE_STRICT_HASH_VERIFICATION = _pygit2.GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION
SET_ALLOCATOR = _pygit2.GIT_OPT_SET_ALLOCATOR
ENABLE_UNSAVED_INDEX_SAFETY = _pygit2.GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY
GET_PACK_MAX_OBJECTS = _pygit2.GIT_OPT_GET_PACK_MAX_OBJECTS
SET_PACK_MAX_OBJECTS = _pygit2.GIT_OPT_SET_PACK_MAX_OBJECTS
DISABLE_PACK_KEEP_FILE_CHECKS = _pygit2.GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS
# ENABLE_HTTP_EXPECT_CONTINUE = _pygit2.GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE
GET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_FILE_LIMIT
SET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_SET_MWINDOW_FILE_LIMIT
# SET_ODB_PACKED_PRIORITY = _pygit2.GIT_OPT_SET_ODB_PACKED_PRIORITY
# SET_ODB_LOOSE_PRIORITY = _pygit2.GIT_OPT_SET_ODB_LOOSE_PRIORITY
# GET_EXTENSIONS = _pygit2.GIT_OPT_GET_EXTENSIONS
# SET_EXTENSIONS = _pygit2.GIT_OPT_SET_EXTENSIONS
GET_OWNER_VALIDATION = _pygit2.GIT_OPT_GET_OWNER_VALIDATION
SET_OWNER_VALIDATION = _pygit2.GIT_OPT_SET_OWNER_VALIDATION
# GET_HOMEDIR = _pygit2.GIT_OPT_GET_HOMEDIR
# SET_HOMEDIR = _pygit2.GIT_OPT_SET_HOMEDIR
# SET_SERVER_CONNECT_TIMEOUT = _pygit2.GIT_OPT_SET_SERVER_CONNECT_TIMEOUT
# GET_SERVER_CONNECT_TIMEOUT = _pygit2.GIT_OPT_GET_SERVER_CONNECT_TIMEOUT
# SET_SERVER_TIMEOUT = _pygit2.GIT_OPT_SET_SERVER_TIMEOUT
# GET_SERVER_TIMEOUT = _pygit2.GIT_OPT_GET_SERVER_TIMEOUT
class ReferenceFilter(IntEnum):
"""Filters for References.iterator()."""
ALL = _pygit2.GIT_REFERENCES_ALL
BRANCHES = _pygit2.GIT_REFERENCES_BRANCHES
TAGS = _pygit2.GIT_REFERENCES_TAGS
class ReferenceType(IntFlag):
"""Basic type of any Git reference."""
INVALID = C.GIT_REFERENCE_INVALID
'Invalid reference'
DIRECT = C.GIT_REFERENCE_DIRECT
'A reference that points at an object id'
SYMBOLIC = C.GIT_REFERENCE_SYMBOLIC
'A reference that points at another reference'
ALL = C.GIT_REFERENCE_ALL
'Bitwise OR of (DIRECT | SYMBOLIC)'
class RepositoryInitFlag(IntFlag):
"""
Option flags for pygit2.init_repository().
"""
BARE = C.GIT_REPOSITORY_INIT_BARE
'Create a bare repository with no working directory.'
NO_REINIT = C.GIT_REPOSITORY_INIT_NO_REINIT
'Raise GitError if the path appears to already be a git repository.'
NO_DOTGIT_DIR = C.GIT_REPOSITORY_INIT_NO_DOTGIT_DIR
"""Normally a "/.git/" will be appended to the repo path for
non-bare repos (if it is not already there), but passing this flag
prevents that behavior."""
MKDIR = C.GIT_REPOSITORY_INIT_MKDIR
"""Make the repo_path (and workdir_path) as needed. Init is always willing
to create the ".git" directory even without this flag. This flag tells
init to create the trailing component of the repo and workdir paths
as needed."""
MKPATH = C.GIT_REPOSITORY_INIT_MKPATH
'Recursively make all components of the repo and workdir paths as necessary.'
EXTERNAL_TEMPLATE = C.GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE
"""libgit2 normally uses internal templates to initialize a new repo.
This flags enables external templates, looking at the "template_path" from
the options if set, or the `init.templatedir` global config if not,
or falling back on "/usr/share/git-core/templates" if it exists."""
RELATIVE_GITLINK = C.GIT_REPOSITORY_INIT_RELATIVE_GITLINK
"""If an alternate workdir is specified, use relative paths for the gitdir
and core.worktree."""
class RepositoryInitMode(IntEnum):
"""
Mode options for pygit2.init_repository().
"""
SHARED_UMASK = C.GIT_REPOSITORY_INIT_SHARED_UMASK
'Use permissions configured by umask - the default.'
SHARED_GROUP = C.GIT_REPOSITORY_INIT_SHARED_GROUP
"""
Use '--shared=group' behavior, chmod'ing the new repo to be group
writable and "g+sx" for sticky group assignment.
"""
SHARED_ALL = C.GIT_REPOSITORY_INIT_SHARED_ALL
"Use '--shared=all' behavior, adding world readability."
class RepositoryOpenFlag(IntFlag):
"""
Option flags for Repository.__init__().
"""
DEFAULT = 0
'Default flags.'
NO_SEARCH = C.GIT_REPOSITORY_OPEN_NO_SEARCH
"""
Only open the repository if it can be immediately found in the
start_path. Do not walk up from the start_path looking at parent
directories.
"""
CROSS_FS = C.GIT_REPOSITORY_OPEN_CROSS_FS
"""
Unless this flag is set, open will not continue searching across
filesystem boundaries (i.e. when `st_dev` changes from the `stat`
system call). For example, searching in a user's home directory at
"/home/user/source/" will not return "/.git/" as the found repo if
"/" is a different filesystem than "/home".
"""
BARE = C.GIT_REPOSITORY_OPEN_BARE
"""
Open repository as a bare repo regardless of core.bare config, and
defer loading config file for faster setup.
Unlike `git_repository_open_bare`, this can follow gitlinks.
"""
NO_DOTGIT = C.GIT_REPOSITORY_OPEN_NO_DOTGIT
"""
Do not check for a repository by appending /.git to the start_path;
only open the repository if start_path itself points to the git
directory.
"""
FROM_ENV = C.GIT_REPOSITORY_OPEN_FROM_ENV
"""
Find and open a git repository, respecting the environment variables
used by the git command-line tools.
If set, `git_repository_open_ext` will ignore the other flags and
the `ceiling_dirs` argument, and will allow a NULL `path` to use
`GIT_DIR` or search from the current directory.
The search for a repository will respect $GIT_CEILING_DIRECTORIES and
$GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will
respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and
$GIT_ALTERNATE_OBJECT_DIRECTORIES.
In the future, this flag will also cause `git_repository_open_ext`
to respect $GIT_WORK_TREE and $GIT_COMMON_DIR; currently,
`git_repository_open_ext` with this flag will error out if either
$GIT_WORK_TREE or $GIT_COMMON_DIR is set.
"""
class RepositoryState(IntEnum):
"""
Repository state: These values represent possible states for the repository
to be in, based on the current operation which is ongoing.
"""
NONE = C.GIT_REPOSITORY_STATE_NONE
MERGE = C.GIT_REPOSITORY_STATE_MERGE
REVERT = C.GIT_REPOSITORY_STATE_REVERT
REVERT_SEQUENCE = C.GIT_REPOSITORY_STATE_REVERT_SEQUENCE
CHERRYPICK = C.GIT_REPOSITORY_STATE_CHERRYPICK
CHERRYPICK_SEQUENCE = C.GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE
BISECT = C.GIT_REPOSITORY_STATE_BISECT
REBASE = C.GIT_REPOSITORY_STATE_REBASE
REBASE_INTERACTIVE = C.GIT_REPOSITORY_STATE_REBASE_INTERACTIVE
REBASE_MERGE = C.GIT_REPOSITORY_STATE_REBASE_MERGE
APPLY_MAILBOX = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX
APPLY_MAILBOX_OR_REBASE = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE
class ResetMode(IntEnum):
"""Kinds of reset operation."""
SOFT = _pygit2.GIT_RESET_SOFT
'Move the head to the given commit'
MIXED = _pygit2.GIT_RESET_MIXED
'SOFT plus reset index to the commit'
HARD = _pygit2.GIT_RESET_HARD
'MIXED plus changes in working tree discarded'
class RevSpecFlag(IntFlag):
"""
Revparse flags.
These indicate the intended behavior of the spec passed to Repository.revparse()
"""
SINGLE = _pygit2.GIT_REVSPEC_SINGLE
'The spec targeted a single object.'
RANGE = _pygit2.GIT_REVSPEC_RANGE
'The spec targeted a range of commits.'
MERGE_BASE = _pygit2.GIT_REVSPEC_MERGE_BASE
"The spec used the '...' operator, which invokes special semantics."
class SortMode(IntFlag):
"""
Flags to specify the sorting which a revwalk should perform.
"""
NONE = _pygit2.GIT_SORT_NONE
"""
Sort the output with the same default method from `git`: reverse
chronological order. This is the default sorting for new walkers.
"""
TOPOLOGICAL = _pygit2.GIT_SORT_TOPOLOGICAL
"""
Sort the repository contents in topological order (no parents before
all of its children are shown); this sorting mode can be combined
with TIME sorting to produce `git`'s `--date-order``.
"""
TIME = _pygit2.GIT_SORT_TIME
"""
Sort the repository contents by commit time; this sorting mode can be
combined with TOPOLOGICAL.
"""
REVERSE = _pygit2.GIT_SORT_REVERSE
"""
Iterate through the repository contents in reverse order;
this sorting mode can be combined with any of the above.
"""
class StashApplyProgress(IntEnum):
"""
Stash apply progression states
"""
NONE = C.GIT_STASH_APPLY_PROGRESS_NONE
LOADING_STASH = C.GIT_STASH_APPLY_PROGRESS_LOADING_STASH
'Loading the stashed data from the object database.'
ANALYZE_INDEX = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX
'The stored index is being analyzed.'
ANALYZE_MODIFIED = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED
'The modified files are being analyzed.'
ANALYZE_UNTRACKED = C.GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED
'The untracked and ignored files are being analyzed.'
CHECKOUT_UNTRACKED = C.GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED
'The untracked files are being written to disk.'
CHECKOUT_MODIFIED = C.GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED
'The modified files are being written to disk.'
DONE = C.GIT_STASH_APPLY_PROGRESS_DONE
'The stash was applied successfully.'
class SubmoduleIgnore(IntEnum):
UNSPECIFIED = _pygit2.GIT_SUBMODULE_IGNORE_UNSPECIFIED
"use the submodule's configuration"
NONE = _pygit2.GIT_SUBMODULE_IGNORE_NONE
'any change or untracked == dirty'
UNTRACKED = _pygit2.GIT_SUBMODULE_IGNORE_UNTRACKED
'dirty if tracked files change'
DIRTY = _pygit2.GIT_SUBMODULE_IGNORE_DIRTY
'only dirty if HEAD moved'
ALL = _pygit2.GIT_SUBMODULE_IGNORE_ALL
'never dirty'
class SubmoduleStatus(IntFlag):
IN_HEAD = _pygit2.GIT_SUBMODULE_STATUS_IN_HEAD
'superproject head contains submodule'
IN_INDEX = _pygit2.GIT_SUBMODULE_STATUS_IN_INDEX
'superproject index contains submodule'
IN_CONFIG = _pygit2.GIT_SUBMODULE_STATUS_IN_CONFIG
'superproject gitmodules has submodule'
IN_WD = _pygit2.GIT_SUBMODULE_STATUS_IN_WD
'superproject workdir has submodule'
INDEX_ADDED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_ADDED
'in index, not in head (flag available if ignore is not ALL)'
INDEX_DELETED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_DELETED
'in head, not in index (flag available if ignore is not ALL)'
INDEX_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_MODIFIED
"index and head don't match (flag available if ignore is not ALL)"
WD_UNINITIALIZED = _pygit2.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED
'workdir contains empty repository (flag available if ignore is not ALL)'
WD_ADDED = _pygit2.GIT_SUBMODULE_STATUS_WD_ADDED
'in workdir, not index (flag available if ignore is not ALL)'
WD_DELETED = _pygit2.GIT_SUBMODULE_STATUS_WD_DELETED
'in index, not workdir (flag available if ignore is not ALL)'
WD_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_MODIFIED
"index and workdir head don't match (flag available if ignore is not ALL)"
WD_INDEX_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED
'submodule workdir index is dirty (flag available if ignore is NONE or UNTRACKED)'
WD_WD_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED
'submodule workdir has modified files (flag available if ignore is NONE or UNTRACKED)'
WD_UNTRACKED = _pygit2.GIT_SUBMODULE_STATUS_WD_UNTRACKED
'submodule workdir contains untracked files (flag available if ignore is NONE)'
|