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
1=== modified file 'filegraph.py'
2--- filegraph.py 2018-02-17 03:33:59 +0000
3+++ filegraph.py 2018-03-08 11:53:46 +0000
4@@ -18,6 +18,8 @@
5
6 from __future__ import absolute_import
7
8+import stat
9+
10 from dulwich.errors import (
11 NotTreeError,
12 )
13@@ -40,6 +42,9 @@
14 commit = self.store[commit_id]
15 target_mode, target_sha = tree_lookup_path(self.store.__getitem__,
16 commit.tree, path)
17+ if path == '':
18+ target_mode = stat.S_IFDIR | 0644
19+ assert target_mode is not None, "sha %r for %r in %r" % (target_sha, path, commit_id)
20 while True:
21 parent_commits = []
22 for parent_commit in [self.store[c] for c in commit.parents]:
23@@ -50,8 +55,13 @@
24 continue
25 else:
26 parent_commits.append(parent_commit)
27- if mode != target_mode or sha != target_sha:
28- return (path, commit.id)
29+ if path == '':
30+ mode = stat.S_IFDIR | 0644
31+ # Candidate found iff, mode or text changed,
32+ # or is a directory that didn't previously exist.
33+ if mode != target_mode or (
34+ not stat.S_ISDIR(target_mode) and sha != target_sha):
35+ return (path, commit.id)
36 if parent_commits == []:
37 break
38 commit = parent_commits[0]

Subscribers

People subscribed via source and target branches

to all changes: