Merge lp:~jelmer/brz-git/dir-change-content into lp:brz-git

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 1834
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz-git/dir-change-content
Merge into: lp:brz-git
Diff against target: 38 lines (+12/-2)
1 file modified
filegraph.py (+12/-2)
To merge this branch: bzr merge lp:~jelmer/brz-git/dir-change-content
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+341127@code.launchpad.net

Commit message

Directories don't change when their contents do.

Description of the change

Directories don't change when their contents do.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Rubberstamp! Proposer approves of own proposal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'filegraph.py'
--- filegraph.py 2018-02-17 03:33:59 +0000
+++ filegraph.py 2018-03-08 11:53:46 +0000
@@ -18,6 +18,8 @@
1818
19from __future__ import absolute_import19from __future__ import absolute_import
2020
21import stat
22
21from dulwich.errors import (23from dulwich.errors import (
22 NotTreeError,24 NotTreeError,
23 )25 )
@@ -40,6 +42,9 @@
40 commit = self.store[commit_id]42 commit = self.store[commit_id]
41 target_mode, target_sha = tree_lookup_path(self.store.__getitem__,43 target_mode, target_sha = tree_lookup_path(self.store.__getitem__,
42 commit.tree, path)44 commit.tree, path)
45 if path == '':
46 target_mode = stat.S_IFDIR | 0644
47 assert target_mode is not None, "sha %r for %r in %r" % (target_sha, path, commit_id)
43 while True:48 while True:
44 parent_commits = []49 parent_commits = []
45 for parent_commit in [self.store[c] for c in commit.parents]:50 for parent_commit in [self.store[c] for c in commit.parents]:
@@ -50,8 +55,13 @@
50 continue55 continue
51 else:56 else:
52 parent_commits.append(parent_commit)57 parent_commits.append(parent_commit)
53 if mode != target_mode or sha != target_sha:58 if path == '':
54 return (path, commit.id)59 mode = stat.S_IFDIR | 0644
60 # Candidate found iff, mode or text changed,
61 # or is a directory that didn't previously exist.
62 if mode != target_mode or (
63 not stat.S_ISDIR(target_mode) and sha != target_sha):
64 return (path, commit.id)
55 if parent_commits == []:65 if parent_commits == []:
56 break66 break
57 commit = parent_commits[0]67 commit = parent_commits[0]

Subscribers

People subscribed via source and target branches

to all changes: