3r1co / hg4j

Automatically exported from code.google.com/p/hg4j
GNU General Public License v2.0
0 stars 1 forks source link

Duplicate revision information #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create local clone of the repository: 
http://code.google.com/p/droid-x86-tools/source/list?repo=srcview
2. When I show the repository log using HgLogCommand some revision has 
duplicated information. See attached screenshot.

I can see different nodeID's in debug mode, but comments, dates and other 
information are duplicate.

Also, I see the duplicates in changelog when execute HgIncomingCommand (see 
attached ChangeLog.png)

What I doing wrong? What additional information need?

Original issue reported on code.google.com by stinger...@gmail.com on 29 Oct 2012 at 9:52

Attachments:

GoogleCodeExporter commented 8 years ago
Try to run log command using console samples (available in download or one can 
build using sources), e.g:

$java -cp hg4j_1.1.0.jar:hg4j-console_1.1.0.jar org.tmatesoft.hg.console.Log -R 
/path-to/droid-x86-tools.srcview/ -v

I see exactly 11 revisions, no duplicates. Source code for 
org.tmatesoft.hg.console.Log is available 
(http://code.google.com/p/hg4j/source/browse/cmdline/org/tmatesoft/hg/console/Lo
g.java), there's nothing but HgLogCommand, check if anything is different from 
your code.

Original comment by tikhomir...@gmail.com on 29 Oct 2012 at 6:55

GoogleCodeExporter commented 8 years ago
Note, there's exception if I put --debug instead of -v key:
 org.tmatesoft.hg.repo.HgInvalidRevisionException: Can't find revision 000000000000 in org.tmatesoft.hg.repo.HgManifest@1b26af3 (000000000000)
    at org.tmatesoft.hg.repo.Revlog.getRevisionIndex(Revlog.java:150)
    at org.tmatesoft.hg.console.ChangesetDumpHandler.print(ChangesetDumpHandler.java:114)
    at org.tmatesoft.hg.console.ChangesetDumpHandler.cset(ChangesetDumpHandler.java:68)
    at org.tmatesoft.hg.core.ChangesetTransformer.next(ChangesetTransformer.java:75)
    at org.tmatesoft.hg.core.HgLogCommand.next(HgLogCommand.java:389)
    at org.tmatesoft.hg.repo.HgChangelog$RawCsetParser.next(HgChangelog.java:380)
    at org.tmatesoft.hg.internal.RevlogStream$ReaderN1.range(RevlogStream.java:533)
    at org.tmatesoft.hg.internal.RevlogStream.iterate(RevlogStream.java:226)
    at org.tmatesoft.hg.repo.HgChangelog.range(HgChangelog.java:63)
    at org.tmatesoft.hg.core.HgLogCommand.execute(HgLogCommand.java:245)

It's not error in the Hg4J library, rather very rough Log command-line example 
implementation. HgChangeset#getManifest states there might be Nodeid.NULL in 
certain scenarios, and the Dump handler from the sample doesn't respect that.

I wonder which tool did you use to create initial repository? TortoiseHg? I 
don't know a way to create a bogus repository (changeset with no list of 
changed files is rather error, imo) with the native client, but came across a 
TortoiseHg-managed repository with the similar issues.

Original comment by tikhomir...@gmail.com on 29 Oct 2012 at 7:03

GoogleCodeExporter commented 8 years ago
I've committed fix for the Log example to handle missing manifest without an 
error. (revision 37d97854c6ad).

Original comment by tikhomir...@gmail.com on 29 Oct 2012 at 7:08

GoogleCodeExporter commented 8 years ago
Thank you for reply. I'll investigate my code to the source of this problem.

I created this repository by the google-code web interface, when clone it by 
the Atlassian's SourceTree tool. I'll check the HgLog console tool, but the 
problem was found in my own tool, based on HG4J library. These tool is the 
Android application, implements th HG client functionality. May be Android 
environment affects to the issue emergence.

Thank you again for the support.

Original comment by stinger...@gmail.com on 30 Oct 2012 at 6:19

GoogleCodeExporter commented 8 years ago
I confirm that the cause of erroneous behavior is the Android environment. The 
clean copy of HG4J on my host system works fine.
It seems that android affects to data files or sizes of types. Patches and 
changelog/manifest parsing sometimes broken.
I'll continue investigation of the problem's cause.

Original comment by stinger...@gmail.com on 30 Oct 2012 at 12:01

GoogleCodeExporter commented 8 years ago
I found the problem itself, but not the problem source.
original 00changelog.i start like this:
0001 0001 0000 0000 0000 006a 0000 0090
0000 0000 0000 0000 ffff ffff ffff ffff
8542 349d 805e b813 5761 2f4d eb03 f923
662a cd8d 0000 0000 0000 0000 0000 0000
789c 3330 200e 7039 e6a5 14a5 962b 3826
1525 e6e6 9729 d814 9764 e6a5 a716 591a

But on Android system 00changelog.i starts with following content
0001 0001 0000 0000 0000 006a 0000 0090
0000 0000 0000 0000 ffff ffff ffff ffff
8542 349d 805e b813 5761 2f4d eb03 f923
662a cd8d 0000 0000 0000 0000 0000 0000
4889 3330 200e 7039 e6a5 14a5 962b 3826
1525 e6e6 9729 d814 9764 e6a5 a716 591a

Fourth line - the start of the compressed content of the first revision. 
Originally, it has flag 0x78 - compressed. On Android - 0x48. I had changed 
code for processing the 0x48 flag same as 0x78, but receive this issue. Without 
my patch I receive exception 'HgInvalidDataFormatException: Bad Changeset data 
(rev:0)'

It seems to incorrect server response - may be due client capabilities or so.

Original comment by stinger...@gmail.com on 30 Oct 2012 at 2:33

GoogleCodeExporter commented 8 years ago
PS: data in 00changelog.i differs deep in chunk too. Not only in the 
compression flag.

Original comment by stinger...@gmail.com on 30 Oct 2012 at 2:36

GoogleCodeExporter commented 8 years ago
Regular revlog data can't start with 0x48, only 0x75 ('u'), 0x78 ('x') and 0 
can appear as the first data byte. Besides, it's first revision, hence stored 
completely (not a delta to a previous), and based on the compressed length 
field (0x006a) and total length (0x0090) the data shall be compressed (0x6a < 
0x90). Processing 0x48 the same as 0x78 (where zip header is expected) won't 
work, for sure.

I have no idea how come changelog.i contents get changed. Did you just copy 
complete repository to your Android device or there's any tool to get 
repository there?

Original comment by tikhomir...@gmail.com on 30 Oct 2012 at 3:01

GoogleCodeExporter commented 8 years ago
The first revision information differs only in first two bytes (789c - normal, 
4889 - android). Second revision has more difference, even in the revision's 
header and in the revision's data. And data again starts with 4889 instead 789c.
I create repository on android device using the HgCloneCommand, btw it's fully 
native android environment.

I'll try to copy existing repository to the device and run my program against 
these repository. I'll notify you about results.

Original comment by stinger...@gmail.com on 31 Oct 2012 at 10:10

GoogleCodeExporter commented 8 years ago
I've tried to clone repository in question with hg clone counterpart from 
console samples:
$java -cp hg4j.jar:hg4j-console.jar org.tmatesoft.hg.console.Clone 
https://code.google.com/p/droid-x86-tools.srcview/ /destination/path/

and the outcome is legal Mercurial repository (at least 'hg verify' doesn't see 
any issue) and 'hg log' lists 11 revisions. Contents of the first revision 
00changelog.i starts with 0x78 ('x').

Original comment by tikhomir...@gmail.com on 31 Oct 2012 at 3:46

GoogleCodeExporter commented 8 years ago
Closing the issue to indicate Hg4J is not the origin of the trouble.
Please fill free to reopen with any new details.

Original comment by tikhomir...@gmail.com on 14 Dec 2012 at 6:05