Skip to content
Snippets Groups Projects
Commit 75d6aa32 authored by Georges Racinet's avatar Georges Racinet
Browse files

hgitaly.git: manifest flags to git modes constant

Was previously duplicated in `hgitaly.diff`
parent edce6404
No related branches found
No related tags found
2 merge requests!232Merged stable branch into default,!228DiffService.GetPatchID and install/config doc
......@@ -19,6 +19,7 @@
from .file_context import git_perms
from .git import (
FILECTX_FLAGS_TO_GIT_MODE_BYTES,
NULL_BLOB_OID,
OBJECT_MODE_DOES_NOT_EXIST,
)
......@@ -143,12 +144,6 @@
return diffutil.difffeatureopts(repo.ui, opts=opts, git=True)
# Copied from mercurial/patch.py
# TODO even though, this is bytes and not octal, would be better
# to use the constants in `hgitaly.git`
gitmode = {b'l': b'120000', b'x': b'100755', b'': b'100644'}
def _get_filectx(changeset, path):
try:
return changeset[path]
......@@ -219,6 +214,6 @@
from_mode, to_mode = b'0', b'0'
from_filectx = self.from_filectx
if from_filectx is not None:
from_mode = gitmode[from_filectx.flags()]
from_mode = FILECTX_FLAGS_TO_GIT_MODE_BYTES[from_filectx.flags()]
to_filectx = self.to_filectx
if to_filectx is not None:
......@@ -223,6 +218,6 @@
to_filectx = self.to_filectx
if to_filectx is not None:
to_mode = gitmode[to_filectx.flags()]
to_mode = FILECTX_FLAGS_TO_GIT_MODE_BYTES[to_filectx.flags()]
return from_mode, to_mode
def additions_deletions(self):
......
......@@ -29,6 +29,12 @@
OBJECT_MODE_NON_EXECUTABLE = 0o100644 # for blobs only
OBJECT_MODE_TREE = 0o40000
FILECTX_FLAGS_TO_GIT_MODE_BYTES = {
b'l': b'%o' % OBJECT_MODE_LINK,
b'x': b'%o' % OBJECT_MODE_EXECUTABLE,
b'': b'%o' % OBJECT_MODE_NON_EXECUTABLE,
}
class GitPathSpec:
"""File path matching as Git pathspecs do.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment