Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/SubrepoManager.java @ 571:e4ee4bf4c7d0
Let session context control creation of Path instances
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 11 Apr 2013 16:27:06 +0200 |
| parents | 6865eb742883 |
| children |
comparison
equal
deleted
inserted
replaced
| 570:36853bb80a35 | 571:e4ee4bf4c7d0 |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011-2012 TMate Software Ltd | 2 * Copyright (c) 2011-2013 TMate Software Ltd |
| 3 * | 3 * |
| 4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
| 5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
| 6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
| 7 * | 7 * |
| 79 private List<HgSubrepoLocation> readConfig(BufferedReader br, Map<String, String> substate) throws IOException { | 79 private List<HgSubrepoLocation> readConfig(BufferedReader br, Map<String, String> substate) throws IOException { |
| 80 try { | 80 try { |
| 81 String line; | 81 String line; |
| 82 LinkedList<HgSubrepoLocation> res = new LinkedList<HgSubrepoLocation>(); | 82 LinkedList<HgSubrepoLocation> res = new LinkedList<HgSubrepoLocation>(); |
| 83 HgInternals hgRepoInternal = new HgInternals(repo); | 83 HgInternals hgRepoInternal = new HgInternals(repo); |
| 84 final Path.Source pathFactory = repo.getSessionContext().getPathFactory(); | |
| 84 while ((line = br.readLine()) != null) { | 85 while ((line = br.readLine()) != null) { |
| 85 int sep = line.indexOf('='); | 86 int sep = line.indexOf('='); |
| 86 if (sep == -1) { | 87 if (sep == -1) { |
| 87 continue; | 88 continue; |
| 88 } | 89 } |
| 107 } | 108 } |
| 108 // TODO respect paths mappings in config file | 109 // TODO respect paths mappings in config file |
| 109 // | 110 // |
| 110 // apparently, key value can't end with '/', `hg commit` fails if it does: | 111 // apparently, key value can't end with '/', `hg commit` fails if it does: |
| 111 // abort: path ends in directory separator: fourth/ | 112 // abort: path ends in directory separator: fourth/ |
| 112 Path p = Path.create(key.charAt(key.length()-1) == '/' ? key : key + '/'); | 113 Path p = pathFactory.path(key.charAt(key.length()-1) == '/' ? key : key + '/'); |
| 113 String revValue = substate.get(key); | 114 String revValue = substate.get(key); |
| 114 HgSubrepoLocation loc = hgRepoInternal.newSubrepo(p, value, kind, revValue == null ? null : Nodeid.fromAscii(revValue)); | 115 HgSubrepoLocation loc = hgRepoInternal.newSubrepo(p, value, kind, revValue == null ? null : Nodeid.fromAscii(revValue)); |
| 115 res.add(loc); | 116 res.add(loc); |
| 116 } | 117 } |
| 117 return Arrays.asList(res.toArray(new HgSubrepoLocation[res.size()])); | 118 return Arrays.asList(res.toArray(new HgSubrepoLocation[res.size()])); |
