Opened 6 years ago
Closed 6 years ago
#13077 closed defect (fixed)
Error "No such node" for HG diff
Reported by: | anonymous | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | plugin - mercurial |
Component: | plugin/mercurial | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fix |
||
API Changes: | |||
Internal Changes: |
Description
- Go to https://trac.edgewall.org/diff?old_rev=12409&old_path=/jomae.hg/tracopt/notification/&new_rev=12431&new_path=/jomae.hg/tracopt/notification/subscriber/
- Click "View changes" → Result:
Error: No such node No node tracopt/notification/subscriber/prefs.py at revision 57272e5f3505770022d7b33f7f103918b5ea0470
But I did not request prefs.py
, so why does it show this error?
Attachments (0)
Change History (6)
follow-up: 2 comment:1 by , 6 years ago
comment:2 by , 6 years ago
You should use same path to both From: input and To: input in diff page.
Using different paths is a hugely useful feature:
git checkout -b feature13077 mkdir f && cd f vim a.py vim b.py vim c.py git add a.py git add b.py git add c.py git commit -m "New feature #13077" git push echo Trac comment:1 Me: "New feature in log:repo.git@feature13077" echo Trac comment:2 You reply: "Please rename folder `f` to `foo`. echo 1 year and many commits later: git fetch origin git rebase origin/master git branch -m feature13077 feature13077_v2 git mv f foo vim a.py vim b.py vim c.py git add a.py git add b.py git add c.py git commit --amend git push echo Trac comment:3 Me: "Rebased in log:repo@feature13077_v2. Renamed folder as requested. Please review further changes: /diff?old_rev=feature13077&old_path=/repo.git/f/&new_rev=feature13077_v2&new_path=/repo.git/foo/
This works well in some cases and is very useful.
comment:3 by , 6 years ago
Thank you for the example with get MercurialRepository.get_changes()
. It was easy to locate and fix the bug:
-
tracext/hg/backend.py
diff -r d54f77082b03 -r c837819ca8e8 tracext/hg/backend.py
a b 886 886 # 'deleted' if not present in new manifest 887 887 str_np = str_new_path + str_path[len(str_old_path):] 888 888 if str_np not in new_node.manifest: 889 changes.append((str_path, old_node.subnode(str_ np), None,889 changes.append((str_path, old_node.subnode(str_path), None, 890 890 Node.FILE, Changeset.DELETE)) 891 891 # Note: `str_path` only used as a key, no need to convert to_u 892 892 for change in sorted(changes, key=lambda c: c[0]):
comment:4 by , 6 years ago
Regression test:
-
tracext/hg/tests/backend.py
diff -r fedb9d2141eb -r c9f2efa16762 tracext/hg/tests/backend.py
a b 444 444 self.assertTrue(browser_mod.match_request(req)) 445 445 browser_mod.process_request(req) 446 446 447 def test_diff(self): 448 # regression test for #13077 449 self._hg_init(data=False) 450 self._add_repository() 451 repos = self._repomgr.get_repository('hgrepos') 452 self._create_commit('lunch', 'lunch/menu.txt') 453 self._create_commit('pasta', 'lunch/lasagna/pasta.txt') 454 self._create_commit('coke', 'lunch/lasagna/drink.txt', content='coke') 455 self._hg_update('0') 456 self._create_commit('fish', 'lunch/fish/chips.txt') 457 self._create_commit('coffee', 'lunch/fish/drink.txt', content='coffee') 458 repos.repo.invalidate() 459 460 diffs = list(repos.get_changes(new_path='lunch/fish/', new_rev='4', old_path='lunch/lasagna/', old_rev='2')) 461 self.assertEqual(3, len(diffs)) 462 463 add = diffs[0] 464 self.assertEqual('add', add[3]) 465 self.assertEqual('lunch/fish/chips.txt', add[1].path) 466 467 edit = diffs[1] 468 self.assertEqual('edit', edit[3]) 469 self.assertEqual('lunch/lasagna/drink.txt', edit[0].path) 470 self.assertEqual('lunch/fish/drink.txt', edit[1].path) 471 472 delete = diffs[2] 473 self.assertEqual('delete', delete[3]) 474 self.assertEqual('lunch/lasagna/pasta.txt', delete[0].path) 475 447 476 448 477 def test_suite(): 449 478 suite = unittest.TestSuite()
comment:5 by , 6 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
Tested with all versions of Trac and Mercurial. The changes work well.
[tox] envlist = py27-trac{10,12,13}-hg{26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,} [testenv] deps = trac10: Trac>=1.0,<1.1 trac12: Trac>=1.2,<1.3 trac13: https://download.edgewall.org/trac/Trac-1.3.3.tar.gz hg26: Mercurial>=2.6,<2.7 hg27: Mercurial>=2.7,<2.8 hg28: Mercurial>=2.8,<2.9 hg29: Mercurial>=2.9,<3.0 hg30: Mercurial>=3.0,<3.1 hg31: Mercurial>=3.1,<3.2 hg32: Mercurial>=3.2,<3.3 hg33: Mercurial>=3.3,<3.4 hg34: Mercurial>=3.4,<3.5 hg35: Mercurial>=3.5,<3.6 hg36: Mercurial>=3.6,<3.7 hg37: Mercurial>=3.7,<3.8 hg38: Mercurial>=3.8,<3.9 hg39: Mercurial>=3.9,<4.0 hg40: Mercurial>=4.0,<4.1 hg41: Mercurial>=4.1,<4.2 hg42: Mercurial>=4.2,<4.3 hg43: Mercurial>=4.3,<4.4 hg44: Mercurial>=4.4,<4.5 hg45: Mercurial>=4.5,<4.6 hg46: Mercurial>=4.6,<4.7 hg47: Mercurial>=4.7,<4.8 hg: Mercurial
comment:6 by , 6 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Pushed [1b6c6b50f742/mercurial-plugin]. Thanks.
You should use same path to both From: input and To: input in diff page.
Anyway, I think we could make
MercurialRepository.get_changes()
robust, or require same path forold_path
andnew_path
parameters like GitRepository.get_changes().