|
@@ -24,6 +24,7 @@ import info.knacki.pass.git.GitLocal;
|
|
|
import info.knacki.pass.git.GitSha1;
|
|
import info.knacki.pass.git.GitSha1;
|
|
|
import info.knacki.pass.git.entities.GitCommit;
|
|
import info.knacki.pass.git.entities.GitCommit;
|
|
|
import info.knacki.pass.git.entities.GitObject;
|
|
import info.knacki.pass.git.entities.GitObject;
|
|
|
|
|
+import info.knacki.pass.io.FileUtils;
|
|
|
import info.knacki.pass.io.OnResponseListener;
|
|
import info.knacki.pass.io.OnResponseListener;
|
|
|
import info.knacki.pass.io.OnStreamResponseListener;
|
|
import info.knacki.pass.io.OnStreamResponseListener;
|
|
|
import info.knacki.pass.io.PathUtils;
|
|
import info.knacki.pass.io.PathUtils;
|
|
@@ -41,6 +42,7 @@ public class GitPullActivity extends AppCompatActivity {
|
|
|
private GitCommit fHeadCommit;
|
|
private GitCommit fHeadCommit;
|
|
|
|
|
|
|
|
private void OnMsg(final String msg) {
|
|
private void OnMsg(final String msg) {
|
|
|
|
|
+ log.info(msg);
|
|
|
GitPullActivity.this.runOnUiThread(() -> {
|
|
GitPullActivity.this.runOnUiThread(() -> {
|
|
|
TextView logView = findViewById(R.id.logView);
|
|
TextView logView = findViewById(R.id.logView);
|
|
|
logView.append(msg +"\n");
|
|
logView.append(msg +"\n");
|
|
@@ -97,6 +99,8 @@ public class GitPullActivity extends AppCompatActivity {
|
|
|
Set<String> filesToPush = new HashSet<>();
|
|
Set<String> filesToPush = new HashSet<>();
|
|
|
HashMap<String, GitObject.GitBlob> conflictingFiles = new HashMap<>();
|
|
HashMap<String, GitObject.GitBlob> conflictingFiles = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
+ OnMsg("Done reading remote tree");
|
|
|
|
|
+ OnMsg("Building change list");
|
|
|
for (Map.Entry<String, GitObject.GitBlob>i: fHeadCommit.GetTree().FindAllBlobs().entrySet()) {
|
|
for (Map.Entry<String, GitObject.GitBlob>i: fHeadCommit.GetTree().FindAllBlobs().entrySet()) {
|
|
|
final String remoteKnownHash = localVersion.GetHash(i.getKey(), "");
|
|
final String remoteKnownHash = localVersion.GetHash(i.getKey(), "");
|
|
|
final String remoteHash = GitSha1.BytesToString(i.getValue().GetHash());
|
|
final String remoteHash = GitSha1.BytesToString(i.getValue().GetHash());
|
|
@@ -141,7 +145,9 @@ public class GitPullActivity extends AppCompatActivity {
|
|
|
int CheckNewFiles(GitLocal localVersion, File root, String rootPath, Set<String> filesToPull, Set<String> filesToPush, Set<String> conflicts) {
|
|
int CheckNewFiles(GitLocal localVersion, File root, String rootPath, Set<String> filesToPull, Set<String> filesToPush, Set<String> conflicts) {
|
|
|
int newFiles = 0;
|
|
int newFiles = 0;
|
|
|
for (final File i: root.listFiles()) {
|
|
for (final File i: root.listFiles()) {
|
|
|
- if (i.isDirectory()) {
|
|
|
|
|
|
|
+ if (PathUtils.IsHidden(i.getAbsolutePath())) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ } else if (i.isDirectory()) {
|
|
|
newFiles += CheckNewFiles(localVersion, i, rootPath +"/" +i.getName(), filesToPull, filesToPush, conflicts);
|
|
newFiles += CheckNewFiles(localVersion, i, rootPath +"/" +i.getName(), filesToPull, filesToPush, conflicts);
|
|
|
} else if (i.isFile()){
|
|
} else if (i.isFile()){
|
|
|
String path = rootPath +"/" +i.getName();
|
|
String path = rootPath +"/" +i.getName();
|
|
@@ -298,7 +304,7 @@ public class GitPullActivity extends AppCompatActivity {
|
|
|
if (files.peek().getValue() == null) {
|
|
if (files.peek().getValue() == null) {
|
|
|
// remove file
|
|
// remove file
|
|
|
String filename = files.pop().getKey();
|
|
String filename = files.pop().getKey();
|
|
|
- new File(PathUtils.GetPassDir(this) +filename).delete();
|
|
|
|
|
|
|
+ FileUtils.TrashFile(new File(PathUtils.GetPassDir(this) +filename));
|
|
|
localCache.remove(filename);
|
|
localCache.remove(filename);
|
|
|
DownloadNext(files, localCache, downloader, resp);
|
|
DownloadNext(files, localCache, downloader, resp);
|
|
|
log.info("Removed file " +filename);
|
|
log.info("Removed file " +filename);
|