Well, when Jesus told His disciples to sell their cloaks and buy a sword, the immediate context is that portion of His discourse where He was warning them that whereas previously they had had all their needs met while they went about Israel preaching the Kingdom, now that He was leaving, they would not have the protection of His immediate earthly presence, and would need to provide the tools for their own provision and protection (implicitly understanding that it is God who provides the means to get and utilise these, of course).
When the disciples said they had two swords, and Jesus said "It is enough" (which you are right, He was basically telling them to stop talkig about it), Jesus had by this point told His disciples that He was going to be taken and "reckoned among the transgressors", which was a parabolic way of telling them that all the events prophecied, such as His trials and crucifixion, were about to take place. The disciples apparently misunderstood, and thought that the swords were for the immediate purpose of fighting those who came to take Him away (which is what they subsequently tried to do).
Thank you. That makes sense.