0

I have been struggling with following problem regarding source codes versioning with Mercurial usage. On one hand I have got source codes in local working directory and those source codes are under Mercurial control. On the other hand I have a copy of those source codes in automatically generated workspace in my IDE and those source codes are not under Mercurial control. That is the problem. Because I will do modifications in the source codes via my IDE. So I will modify the source codes which are not under Mercurial control. I need to have some synchronization mechanism ensuring that changes done in my source codes via my IDE will reflect into the working directory.

I have got an idea that I can achieve this synchronization mechanism by extending the hg commit command somehow in such a manner that it first copies the source codes from workspace into the working directory and then the commit actually executes.

Can anybody tell me whether the idea described above is feasible? Thanks for any suggestions.

Steve
  • 805
  • 7
  • 27

1 Answers1

2

Can anybody tell me whether the idea described above is feasible?

In short - no. Just because your IDE-space (now) doesn't linked to Mercurial at all

Good and correct and practical way will be:

  • work in Working Directory, which have to be also your IDE-space, with ignoring all unwanted artefacts of you IDE
  • don't duplicate amount of authoritative sources
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Thank you for your answer. I have spent some time by investigation of feasibility of my idea above and I think that I have probably found a solution. Mercurial enables definition of so called hooks. As far as I understand correctly these hooks enable invoking of a user defined Python script in case some action regarding the repository occurs e.g. hg commit command is invoked. My idea is to use the pre-commit hook which will invoke Python script for copying source codes from IDE workspace into the local working directory in case the hg commit is invoked for the working directory. – Steve May 13 '20 at 16:55
  • @Steve you might be able to make that work but why make it so hard on yourself? Just point HG to your actual working folder. – StayOnTarget May 18 '20 at 13:30
  • I am sorry, Lazy Badger and UuDdLrLrSs. My question was based on my misunderstanding of documentation to my IDE. The answer from Lazy Badger helped me to understand the correct meaning of the documentation. Thank you. – Steve May 18 '20 at 13:43