Issue #3 open

Access error on Windows when collapsing with a corrupt .hgtags file

Jason R. Coombs
created an issue

When verifying the fix for <<issue 2>>, I encountered an issue where mercurial/hgcollapse gets an access error in Windows when there is a corrupt .hgtags file. What follows is a transcript of a technique to reproduce the issue.

It's not obvious this error needs to be corrected, since it's caused by a corrupt .hgtags file and seems to work fine otherwise.

{{{ PS C:\Users\jaraco\sandbox> hg version Mercurial Distributed SCM (version 2.0) (see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2011 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. PS C:\Users\jaraco\sandbox> hg clone --pull -r b2be25be9e1e https://bitbucket.org/jaraco/jaraco.util jaraco.util-new requesting all changes adding changesets adding manifests adding file changes added 546 changesets with 934 changes to 220 files .hgtags@3e91ddcace77, line 12: cannot parse entry updating to branch default 62 files updated, 0 files merged, 0 files removed, 0 files unresolved PS C:\Users\jaraco\sandbox> cd .\jaraco.util-new PS C:\Users\jaraco\sandbox\jaraco.util-new> hg log --limit 2 changeset: 545:b2be25be9e1e tag: tip user: Jason R. Coombs jaraco@jaraco.com date: Thu Nov 10 13:59:12 2011 -0500 summary: Added some bounds checking

changeset: 544:5ebe816b9b8b user: Jason R. Coombs jaraco@jaraco.com date: Thu Nov 10 13:56:54 2011 -0500 summary: Updated pick_winner to use less-than for the comparator.

PS C:\Users\jaraco\sandbox\jaraco.util-new> hg collapse -r 544:545 reverting sandbox\pick_winner.py .hgtags@3e91ddcace77, line 12: cannot parse entry abort: The process cannot access the file because it is being used by another process PS C:\Users\jaraco\sandbox\jaraco.util-new> hg collapse -r 544:545 --debug PS C:\Users\jaraco\sandbox\jaraco.util-new> hg update -C 1 files updated, 0 files merged, 0 files removed, 0 files unresolved PS C:\Users\jaraco\sandbox\jaraco.util-new> hg collapse -r 544:545 PS C:\Users\jaraco\sandbox\jaraco.util-new> hg outgoing comparing with https://bitbucket.org/jaraco/jaraco.util searching for changes changeset: 546:48f91e9c5c4b tag: tip parent: 543:fd40a42aced6 user: Jason R. Coombs jaraco@jaraco.com date: Thu Nov 10 13:59:12 2011 -0500 summary: Updated pick_winner to use less-than for the comparator.

PS C:\Users\jaraco\sandbox\jaraco.util-new> hg strip --no-backup 546 1 files updated, 0 files merged, 0 files removed, 0 files unresolved PS C:\Users\jaraco\sandbox\jaraco.util-new> hg collapse -r 544:545 --debug Collapsing revisions set([544, 545]) .hgtags@3e91ddcace77, line 12: cannot parse entry invalidating branch cache (tip differs) get_hgtags_from_heads: rev: 545 heads: [545] get_hgtags_from_heads: head_hgtags[b2be25be9e1e7a3eeaebb2ec38a9ac3553022c62]: ae54e691ebb6540ed8cc137819d8f7abb733f216 3.3 ec9afc7554639a6fcd3963bcd0999bdfd6fdc5ee 3.3.1 88a5743e7780ba1735fce7bf0656f1897fce60ad 3.3.2 534fd28b10d8d18bf84c2a84f487ed29d8ac1717 3.4 edc83240ce25186b4372751ddd32cb5b13f2a738 3.5 0c4ac92e1be2460da207ec9607ecbada3984ddc0 3.5.1 327be09130c60750df4dd6f821814206be4e8e2b 3.6 0a7b6c96a180d101846621de34c52c6974762cb7 3.7 7a066ece3171c892dfb169ac5ce3c83e1f03583c 3.8 8db491b23d7cbcb0078f590760c75faed3c6f640 3.8.1 cbd4217e100defd8a2a9b4a40f80230bff477b53 3.9 hg 104e2fa6a8dbb841680abd52639195f9ebbe1475 3.9.1 7afb9e789334fa3bf0897b27de9c33a0ac7799d4 3.9.2 will move revisions: [] updating to revision 543 resolving manifests overwrite False partial False ancestor fd40a42aced6 local fd40a42aced6+ remote fd40a42aced6 calling hook preupdate.setupdated: <function preupdatehook at 0x0000000002BE8048> reverting to revision 545 reverting to revision 545 reverting sandbox\pick_winner.py sandbox/pick_winner.py makecollapsed 5ebe816b9b8b7d9ea2dd0ee258d3636213ddb077 -> 48f91e9c5c4b36d0a7a704e2742ba5931e5445c4 makecollapsed b2be25be9e1e7a3eeaebb2ec38a9ac3553022c62 -> 48f91e9c5c4b36d0a7a704e2742ba5931e5445c4 fix_hgtags: tagsmap b2be25be9e1e7a3eeaebb2ec38a9ac3553022c62 -> 48f91e9c5c4b36d0a7a704e2742ba5931e5445c4 fix_hgtags: tagsmap 5ebe816b9b8b7d9ea2dd0ee258d3636213ddb077 -> 48f91e9c5c4b36d0a7a704e2742ba5931e5445c4 fix_hgtags: head b2be25be9e1e7a3eeaebb2ec38a9ac3553022c62 -> 48f91e9c5c4b36d0a7a704e2742ba5931e5445c4 resolving manifests overwrite False partial False ancestor 48f91e9c5c4b local 48f91e9c5c4b+ remote 48f91e9c5c4b calling hook preupdate.setupdated: <function preupdatehook at 0x0000000002BE8048> .hgtags@3e91ddcace77, line 12: cannot parse entry fix_hgtags: hgtags write: ae54e691ebb6540ed8cc137819d8f7abb733f216 3.3 fix_hgtags: hgtags write: ec9afc7554639a6fcd3963bcd0999bdfd6fdc5ee 3.3.1 fix_hgtags: hgtags write: 88a5743e7780ba1735fce7bf0656f1897fce60ad 3.3.2 fix_hgtags: hgtags write: 534fd28b10d8d18bf84c2a84f487ed29d8ac1717 3.4 fix_hgtags: hgtags write: edc83240ce25186b4372751ddd32cb5b13f2a738 3.5 fix_hgtags: hgtags write: 0c4ac92e1be2460da207ec9607ecbada3984ddc0 3.5.1 fix_hgtags: hgtags write: 327be09130c60750df4dd6f821814206be4e8e2b 3.6 fix_hgtags: hgtags write: 0a7b6c96a180d101846621de34c52c6974762cb7 3.7 fix_hgtags: hgtags write: 7a066ece3171c892dfb169ac5ce3c83e1f03583c 3.8 fix_hgtags: hgtags write: 8db491b23d7cbcb0078f590760c75faed3c6f640 3.8.1 fix_hgtags: hgtags write: cbd4217e100defd8a2a9b4a40f80230bff477b53 3.9 resolving manifests overwrite True partial False ancestor 48f91e9c5c4b+ local 48f91e9c5c4b+ remote fd40a42aced6 .hgtags: remote is newer -> g sandbox/pick_winner.py: remote is newer -> g calling hook preupdate.setupdated: <function preupdatehook at 0x0000000002BE8048> updating: .hgtags 1/2 files (50.00%) getting .hgtags Traceback (most recent call last): File "mercurial\dispatch.pyo", line 87, in _runcatch File "mercurial\dispatch.pyo", line 684, in _dispatch File "mercurial\dispatch.pyo", line 466, in runcommand File "mercurial\dispatch.pyo", line 738, in _runcommand File "mercurial\dispatch.pyo", line 692, in checkargs File "mercurial\dispatch.pyo", line 681, in <lambda> File "mercurial\util.pyo", line 454, in check File "mercurial\extensions.pyo", line 139, in wrap File "mercurial\util.pyo", line 454, in check File "hgext\mq.pyo", line 3229, in mqcommand File "mercurial\util.pyo", line 454, in check File "C:\Users\jaraco/.hgext/hgcollapse/hgext/collapse.py", line 73, in collapse File "C:\Users\jaraco/.hgext/hgcollapse/hgext/collapse.py", line 168, in do_collapse File "mercurial\merge.pyo", line 553, in update File "mercurial\merge.pyo", line 350, in applyupdates File "mercurial\localrepo.pyo", line 696, in wwrite File "mercurial\scmutil.pyo", line 151, in write File "mercurial\scmutil.pyo", line 211, in call File "mercurial\win32.pyo", line 426, in unlink WindowsError: [Error 32] The process cannot access the file because it is being used by another process abort: The process cannot access the file because it is being used by another process }}}

Comments (10)

  1. Anonymous

    We have the same issue here on Windows. The .hgtags file it not corrupt though. It just happend regularly now:

    C:\er>hg collapse --debug -r"lastN(2)"
    Collapsing revisions set([2830, 2831])
    get_hgtags_from_heads: rev: 2831 heads: [2831]
    get_hgtags_from_heads: head_hgtags[e9ff0e4059a254beb7c55e4278dd57948bdea63b]:
    aad818e9b7bd1d25f6e89414bfae7acac5ddf43c 2012.05_M1
    897ba0324ea4a4b5a9bf18808bff74c66909fea1 2012.05_M2
    a1f7b36b969f2dffaf861576658e8062d209f2a0 2012.05_M3
    5703734f99b04e27ff26694b01b2a2608c782c5b 2012.05
    ebc5f66d7b4ff53e9791f809e0451f692d5c258b 2012.06_M1
    5d9a5b4581c7dbd0d37df32562694f9bca0baf57 2012.06_M2
    dc15cc14054dd24fe1941e4657e994ec89bf8526 2012.06_M3
    8499def812a1dded891ebae3d6c3e2bfc116331b 2012.06_M4
    4e9c4b3a3d7c9ef4f880b946b159e95bc2e82a3d 2012.06_M5
    
    f12bdc79bad46986051e3302ced9b2bd606870c2 2012.06_M6
    88bd777c0c4f2f64ec07a3111515dd8cbbacabfe 2012.06_M7
    9443231972bdef40cb1f7bc727ba98acb2281f20 2012.06_M8
    be0deee954bfff07d3fc9dfccf560f1fd94146a4 2012.06
    fdd6596fd8ba295e3deeba7bbe6198fe487eefc7 2012.07_M1
    b194844ef603496ec3bf869d26ab12c9712600ef 2012.07_M2
    
    will move revisions: []
    updating to revision 2829
    resolving manifests
     overwrite: False, partial: False
     ancestor: e9ff0e4059a2, local: e9ff0e4059a2+, remote: 6f41510f3d65
    

    ...

    makecollapsed e6ba36f21fbeffab9281e306ac601148bdd57534 -> 1888f08cba4cf035ca79e566f6c1e9c8fa742ddd
    makecollapsed e9ff0e4059a254beb7c55e4278dd57948bdea63b -> 1888f08cba4cf035ca79e566f6c1e9c8fa742ddd
    fix_hgtags: tagsmap e6ba36f21fbeffab9281e306ac601148bdd57534 -> 1888f08cba4cf035ca79e566f6c1e9c8fa742ddd
    fix_hgtags: tagsmap e9ff0e4059a254beb7c55e4278dd57948bdea63b -> 1888f08cba4cf035ca79e566f6c1e9c8fa742ddd
    fix_hgtags: head e9ff0e4059a254beb7c55e4278dd57948bdea63b -> 1888f08cba4cf035ca79e566f6c1e9c8fa742ddd
    resolving manifests
     overwrite: False, partial: False
     ancestor: 1888f08cba4c, local: 1888f08cba4c+, remote: 1888f08cba4c
    calling hook preupdate.eol: <function preupdate at 0x00000000028E9908>
    fix_hgtags: hgtags write: aad818e9b7bd1d25f6e89414bfae7acac5ddf43c 2012.05_M1
    fix_hgtags: hgtags write: 897ba0324ea4a4b5a9bf18808bff74c66909fea1 2012.05_M2
    fix_hgtags: hgtags write: a1f7b36b969f2dffaf861576658e8062d209f2a0 2012.05_M3
    fix_hgtags: hgtags write: 5703734f99b04e27ff26694b01b2a2608c782c5b 2012.05
    fix_hgtags: hgtags write: ebc5f66d7b4ff53e9791f809e0451f692d5c258b 2012.06_M1
    fix_hgtags: hgtags write: 5d9a5b4581c7dbd0d37df32562694f9bca0baf57 2012.06_M2
    fix_hgtags: hgtags write: dc15cc14054dd24fe1941e4657e994ec89bf8526 2012.06_M3
    fix_hgtags: hgtags write: 8499def812a1dded891ebae3d6c3e2bfc116331b 2012.06_M4
    fix_hgtags: hgtags write: 4e9c4b3a3d7c9ef4f880b946b159e95bc2e82a3d 2012.06_M5
    resolving manifests
     overwrite: True, partial: False
     ancestor: 1888f08cba4c+, local: 1888f08cba4c+, remote: e9ff0e4059a2
     .hgtags: remote is newer -> g
    calling hook preupdate.eol: <function preupdate at 0x00000000028E9908>
    updating: .hgtags 1/2 files (50.00%)
    getting .hgtags
    filtering .hgtags through
    abort: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird
    
    
  2. Jason R. Coombs reporter

    No problem. Use hgcollapse.jaraco.com (Windows Server 2008 R2 64-bit). I just created it for you. Username is Administrator. Password will follow in private message. Server is a fresh Rackspace VM courtesy of me.

  3. Peer Stritzinger repo owner

    Oh, thanks. I can't work on it until January/Februar due to other deadlines. So it probably better if you close the VM and I come back to you when I can work on it.

  4. Jason R. Coombs reporter

    I may have run into this error again, except this time maybe different. In this case, I didn't get a traceback. The changesets didn't involve .hgtags. And I'm using a much later version Mercurial. Perhaps related, perhaps not. In any case, I wanted to share.

    I worked around the issue by manually doing the rebases, strips, amends.

  5. Peer Stritzinger repo owner

    Since collapse is seemingly using hg internals that keep changing, it often doesn't work on newer versions of Mercurial. The initial use case why I fixed up hg collapse (autocollapsing converted CVS repos) no longer exists and I'm not using it anymore. Patches welcome that fix this.

  6. Log in to comment