A test at https://github.com/iterative/dvc/blob/master/tests/func/test_diff.py#L207 passes correctly. However, it seems that there's a bug in it:
# [............]
def setUp(self):
# [............]
self.a_ref = self.git.git.rev_parse(self.git.head.commit, short=True)
self.old_checksum = _get_checksum(self.dvc, self.DATA_DIR)
self.new_file_content = "new_test_file_bigger_content_123456789"
self.diff_len = len(self.new_file_content)
self.create(self.new_file, self.new_file_content)
self.dvc.add(self.DATA_DIR)
self.git.index.add([self.DATA_DIR + ".dvc"])
self.git.index.commit(message="modify file in the data dir")
self.new_checksum = _get_checksum(self.dvc, self.DATA_DIR)
self.b_ref = self.git.git.rev_parse(self.git.head.commit, short=True)
def test(self):
result = self.dvc.diff(self.a_ref, target=self.DATA_DIR)
test_dct = {
diff.DIFF_A_REF: self.git.git.rev_parse(self.a_ref, short=True),
diff.DIFF_B_REF: self.git.git.rev_parse(self.b_ref, short=True),
diff.DIFF_LIST: [
{
diff.DIFF_IDENT: 2, # <------
diff.DIFF_CHANGE: 1,
diff.DIFF_DEL: 0,
diff.DIFF_MOVE: 0,
diff.DIFF_NEW: 0,
# [.............]
}
],
}
self.assertEqual(test_dct, result)
And
class TestDiffDir(TestDvcGit):
def setUp(self):
super(TestDiffDir, self).setUp()
self.dvc.add(self.DATA_DIR)
self.git.index.add([self.DATA_DIR + ".dvc"])
self.git.index.commit("adds data_dir")
self.a_ref = self.git.git.rev_parse(
self.dvc.scm.git.head.commit, short=True
)
self.old_checksum = _get_checksum(self.dvc, self.DATA_DIR)
self.new_file = os.path.join(self.DATA_SUB_DIR, diff.DIFF_NEW_FILE)
self.create(self.new_file, self.new_file)
self.dvc.add(self.DATA_DIR)
self.git.index.add([self.DATA_DIR + ".dvc"])
self.git.index.commit(message="adds data_dir with new_file")
self.new_checksum = _get_checksum(self.dvc, self.DATA_DIR)
There're creating a directory, a file in it and changing a file. And there're 3 commits.
My understanding is that diff.DIFF_IDENT
-- the number of untouched files -- is supposed to be equal to either 0 or 1, and not 2.
dvc --version
0.53.2+b78843
Hi @GildedHonour ! Please check out our new version, it still lacks some features, but has these bugs fixed. Thanks for the feedback!
@efiop by the way. When I was working on my task in August, so are you on yours. You'd commited some code with "TODO" or "FIX" to master. I pulled it, from the master, and checkout to a new branch for my task. Since then I was getting remarks from Ivan @shcheklein -- "something is wrong with your code, why are we these 'warnings' in tests, where do they come from, there weren't there before you'. Even though my code -- for my issue which I fixed -- had nothing to do with those warnings. I didn't touch the files with "TODO" or "FIX".
And then I was done with the project.
@GildedHonour could you please provide a little bit context please, send a link, screenshot? I see only one closed PR - https://github.com/iterative/dvc/pull/2353 and I don't see any discussions regarding TODO or FIX in ti. So, I'm a little bit confused. Would be happy to explain any things that potentially looked weird/aggressive from my end - in most case it's just some misunderstanding and/or lack of verbal communication.