Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'module' object has no attribute 'write' #62

Closed
hsharrison opened this issue Aug 2, 2016 · 8 comments
Closed

'module' object has no attribute 'write' #62

hsharrison opened this issue Aug 2, 2016 · 8 comments
Labels

Comments

@hsharrison
Copy link

I don't really know enough to troubleshoot this. I have this repo as a submodule in my personal dotfiles repo. Here's the bug reproduced in a standard clone. All the other hg submodules worked fine.

$ git clone hg::https://bitbucket.org/marmoute/mutable-history
Cloning into 'mutable-history'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 1720 changesets with 3018 changes to 168 files (+2 heads)
adding remote bookmark @
ERROR: 'module' object has no attribute 'write'
@mnauw
Copy link
Contributor

mnauw commented Aug 13, 2016

Have you tried this with the latest version, since that one does not reproduce the above error on a casual attempt (might also depend on the Mercurial version > 3.7)? It looks a lot like 822c6e4 addresses this.

@rightpad
Copy link

rightpad commented Nov 4, 2016

My apologies for commenting on an old issue, however I am experiencing the same issue when attempting to clone as well. I'm using the homebrew version on macOS, which I believe points to this repo's HEAD if I'm not mistaken.

...
remote:
requesting all changes
adding changesets
adding manifests
adding file changes
added 39 changesets with 110 changes to 30 files
adding remote bookmark master
adding remote bookmark remote/master
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1343, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1307, in main
    repo = get_repo(url, alias)
  File "/usr/local/bin/git-remote-hg", line 440, in get_repo
    updatebookmarks(repo, peer)
  File "/usr/local/bin/git-remote-hg", line 379, in updatebookmarks
    bookmarks.write(repo)
AttributeError: 'module' object has no attribute 'write'

@sooheon
Copy link

sooheon commented Nov 21, 2016

I'm getting the same as @peterdimou, with the exact same traceback.

@mnauw
Copy link
Contributor

mnauw commented Nov 22, 2016

The traceback shown above refers to bookmarks.write(repo) on line 379. However, git-remote-hg in HEAD (which is 822c6e4 at this time) does not have such on line 379. That line, however, does have exactly that content in HEAD^ (tagged v0.3). So, it looks like homebrew is pointing to that revision, not HEAD, where the HEAD commit is highly likely one that addresses this very issue.

@craiga
Copy link

craiga commented May 30, 2018

I'm getting the same issue, and can verify that Homebrew is installing version 0.3.

Any chance of getting a new release of this so it can be updated in Homebrew? I don't think it's unreasonable to expect that the following should work:

$ brew install git-remote-hg
$ git clone hg::https://bitbucket.org/morphus_imaia/django-otp
Cloning into 'django-otp'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 100 changesets with 892 changes to 321 files
adding remote bookmark stable/0.1.x
adding remote bookmark stable/0.2.x
adding remote bookmark stable/0.3.x
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1343, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1307, in main
    repo = get_repo(url, alias)
  File "/usr/local/bin/git-remote-hg", line 440, in get_repo
    updatebookmarks(repo, peer)
  File "/usr/local/bin/git-remote-hg", line 379, in updatebookmarks
    bookmarks.write(repo)
AttributeError: 'module' object has no attribute 'write'

@mnauw
Copy link
Contributor

mnauw commented Jun 3, 2018

Note that this issue is fixed (as well as other issues with recent Mercurial) in the latest version of this fork, though it is another matter for downstream to pick that up (see also issue #69).

@apjanke
Copy link

apjanke commented Jul 12, 2018

I'm getting a similar issue with bookmarks even when using the latest version from HEAD instead of v0.3.

$ git clone hg::https://www.octave.org/hg/octave
Cloning into 'octave'...
real URL is https://hg.savannah.gnu.org/hgweb/octave
requesting all changes
adding changesets
adding manifests
adding file changes
added 25590 changesets with 170203 changes to 13870 files (+1 heads)
adding remote bookmark @
new changesets 22412e3a4641:c21edcb90cbf
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1356, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1320, in main
    repo = get_repo(url, alias)
  File "/usr/local/bin/git-remote-hg", line 453, in get_repo
    updatebookmarks(repo, peer)
  File "/usr/local/bin/git-remote-hg", line 374, in updatebookmarks
    localmarks[k] = hgbin(v)
  File "/usr/local/lib/python2.7/site-packages/mercurial/bookmarks.py", line 106, in __setitem__
    raise error.ProgrammingError("use 'bookmarks.applychanges' instead")
mercurial.error.ProgrammingError: use 'bookmarks.applychanges' instead
[~/local/repos]
$ hg --version                                                                                 ✘ 128
Mercurial Distributed SCM (version 4.6.2)

Any chance of getting this fixed, and a new release tagged?

@felipec felipec added the bug label Jun 4, 2019
@felipec
Copy link
Owner

felipec commented Jun 4, 2019

Any chance of getting this fixed, and a new release tagged?

Yes, I finally got around to doing it. This should be fixed in v0.4.

The relevant commit is aaef56a.

@felipec felipec closed this as completed Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants